Allow multiple attribute reads in ZHA (#32498)

* multi attribute reads for lights

* catch specific exceptions

* get attributes

* fix mains powered update

* add guards and use get_attributes

* use debug for read failures

* cleanup

* update return value for read_attributes

* fix on with timed off
This commit is contained in:
David F. Mulcahey authored and GitHub committed 2020-03-07 07:33:59 -05:00
1 parent dd91b51435
commit e52542c4d7
14 files changed
+136 -78

No files matched your search

@@ -112,7 +112,9 @@ class BinarySensor(ZhaEntity, BinarySensorDevice):
"""Attempt to retrieve on off state from the binary sensor."""
await super().async_update()
attribute = getattr(self._channel, "value_attribute", "on_off")
self._state = await self._channel.get_attribute_value(attribute)
attr_value = await self._channel.get_attribute_value(attribute)
if attr_value is not None:
self._state = attr_value
@STRICT_MATCH(channel_names=CHANNEL_ACCELEROMETER)