Add sleep as android sensors for users that have the app #1124
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #483
Integrates with the Intent API from sleep as android: https://docs.sleep.urbandroid.org/devs/intent_api.html#events-emitted-by-sleep
If the app is not installed then the sensors will not show up and the user won't be able to enable them. The intents that we register to are only for sleep as android so they do not cause any harm if the app is not installed or if the user decides not to enable them. We will also only process these events from sleep as android as they are received, all other updates are ignored.
I picked Sleep tracking and Lullaby to be binary sensors as I can reliably turn them on and off. All other events are one time based and are better suited for a sensor of its own.