-
Notifications
You must be signed in to change notification settings - Fork 629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Orientation Sensor support #2440
Comments
So looking more into this request. I think we can get by with reporting the rotation angle of the device that can translate to portrait/landscape based on the 4 data points (0, 90, 180, 270). The other part of this request should be doable already. The proximity sensor should be able to tell the user if something is blocking the sensor or not so on a flat surface that can determine if its laying face down or not. Might be a bit of a stretch, if that is not good enough here then yes we will be needing to create a sensor with raw values from the accelerometer so the user can translate them for their own use case. |
Any update on this? |
I would use this to give more power to NFC tags. Here is an example: |
Hey guys I have a submitted a PR adding 3 sensors containing the requested data. It would be great to get some end user testing on this to make sure it works as one would expect. In particular if anyone has a foldable to test on that would be great. You can grab the debug APK from the artifact in https://github.com/home-assistant/android/actions/runs/10854606133 Extract the file and install the full or minimal debug APK. This will install side by side production, the app will have an easy identifiable red icon. I recommend using a unique device name to easily delete after the test. The 3 sensors:
please let me know how it works for you! you may need to grant the app background access if you dont see updates continuing in the background |
Hi, thx a lot. Unfortunately I can't test it, cause I don't use HA at the moment. |
I tried it with a Huawei Mate20Pro. |
ok thats to be expected
that is also to be expected thats all the API reports
not sure what you mean by sensors that rely solely on the accelerometer will not update immediately otherwise it will be a big battery drain, pair those sensors with another sensor like interactive and it should update more quickly as one would expect. |
oh yeah i didn't wait 15min i will try again today. |
speed up your testing and enable the "interactive" sensor then you can turn the screen on/off and it will force an update faster :) |
i believe we may be able to do that so a sensor that has |
well thank you for developing! Thats awesome. And yeah some considerations may be the activity sensor from android. Still? Not aktive like in hand. |
that is not a real state that sensor provides. https://developers.google.com/android/reference/com/google/android/gms/location/DetectedActivity#constant-summary you can probably infer device in hand using something like the interactive sensor paired with light sensor and maybe proximity. |
Describe the solution you'd like
An extra Sensor that is made avaliable.
It should output an orientation like face down, face up, horizontal, and so on like a dice.
Describe alternatives you've considered, if any
Alternative i think one could give the raw degree angles for each axis. XYZ
But it would be a pain to use.
Additional context
Example: You want to Automate something that is only Triggered if you wake up at night. if state was face up and charging and between 10pm and 5am(you where probably asleep) then turn on some light in nightlight mode.
Or in the Car if connected to specific Bluetooth device and upright orientation (phone holder) + leaving home zone
=> send notification to partner phone with text "I'am leaving"
The text was updated successfully, but these errors were encountered: