Add low battery binary sensor to deCONZ integration (#64168)

* Make tamper sensor a property sensor

* Add low battery binary sensor as a binary property sensor

* Change according to review comment

* Use value_fn lambda

* Fix comparison

* Specific entity_description typing

* Minimize the code block affected by catching AttributeError

* Update homeassistant/components/deconz/binary_sensor.py

Co-authored-by: Franck Nijhof <frenck@frenck.nl>

* Update homeassistant/components/deconz/binary_sensor.py

Co-authored-by: Franck Nijhof <frenck@frenck.nl>

* Avoid try statement

* Reflect review changes in sensor platform as well

* Store known sensor entities once per device

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
Robert Svensson 2022-01-17 22:35:20 +01:00 committed by GitHub
parent 259befa65f
commit deed5f327c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 105 additions and 38 deletions

View file

@ -269,7 +269,7 @@ async def test_deconz_alarm_events(hass, aioclient_mock, mock_deconz_websocket):
device_registry = await hass.helpers.device_registry.async_get_registry()
assert len(hass.states.async_all()) == 3
assert len(hass.states.async_all()) == 4
# 1 alarm control device + 2 additional devices for deconz service and host
assert (
len(async_entries_for_config_entry(device_registry, config_entry.entry_id)) == 3
@ -404,7 +404,7 @@ async def test_deconz_alarm_events(hass, aioclient_mock, mock_deconz_websocket):
await hass.config_entries.async_unload(config_entry.entry_id)
states = hass.states.async_all()
assert len(hass.states.async_all()) == 3
assert len(hass.states.async_all()) == 4
for state in states:
assert state.state == STATE_UNAVAILABLE