Bump python matter server to 1.0.8 (#84692)

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Marcel van der Veldt 2022-12-28 18:29:37 +01:00 committed by GitHub
parent 5bdaad9c13
commit 0e9c6b2bba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 44 additions and 26 deletions

View file

@ -39,9 +39,8 @@ class MatterBinarySensor(MatterEntity, BinarySensorEntity):
@callback
def _update_from_device(self) -> None:
"""Update from device."""
self._attr_is_on = self._device_type_instance.get_cluster(
clusters.BooleanState
).stateValue
cluster = self._device_type_instance.get_cluster(clusters.BooleanState)
self._attr_is_on = cluster.stateValue if cluster else None
class MatterOccupancySensor(MatterBinarySensor):
@ -52,11 +51,9 @@ class MatterOccupancySensor(MatterBinarySensor):
@callback
def _update_from_device(self) -> None:
"""Update from device."""
occupancy = self._device_type_instance.get_cluster(
clusters.OccupancySensing
).occupancy
cluster = self._device_type_instance.get_cluster(clusters.OccupancySensing)
# The first bit = if occupied
self._attr_is_on = occupancy & 1 == 1
self._attr_is_on = cluster.occupancy & 1 == 1 if cluster else None
@dataclass