Sync sensor enabled state with core 2022.6+ #2547
Merged
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.
Summary
home-assistant/core#71561 and home-assistant/core#71562 added support for enabling/disabling entities and getting the current state of entities registered by the app, to allow apps and core to stay in sync. This PR implements these features for the sensors in the Android app.
The change should be seamless; when using core <2022.6 nothing changes, starting with core 2022.6 all sensors from the app will be registered with core and changing the enabled state in one place should also change it in another (unless additional permissions are required, in that case you have to enable the sensor in the app).
Screenshots
The only UI for this not in the frontend is the notification the app will post when a sensor is enabled in core, but the app doesn't have the required permissions:
Opening the notification links to the specific sensor settings screen.
This also technically works on Wear OS (except for the link to the settings screen), although it will never happen with the existing battery sensors:
Link to pull request in Documentation repository
I don't think this is necessary, there is currently no documentation on this behavior and the new behavior matches what is expected / other integrations
Any other notes
Is 1 device with 79 entities a new record for highest number of entities per device?