Add base class to gardena bluetooth entities (#96775)

Add helper base class for gardena entities
This commit is contained in:
Joakim Plate 2023-07-17 21:12:41 +02:00 committed by GitHub
parent 36cb3f7278
commit d80b7d0145
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 32 deletions

View file

@ -51,10 +51,7 @@ class GardenaBluetoothValveSwitch(GardenaBluetoothEntity, SwitchEntity):
self._attr_is_on = None
def _handle_coordinator_update(self) -> None:
if data := self.coordinator.data.get(Valve.state.uuid):
self._attr_is_on = Valve.state.decode(data)
else:
self._attr_is_on = None
self._attr_is_on = self.coordinator.get_cached(Valve.state)
super()._handle_coordinator_update()
async def async_turn_on(self, **kwargs: Any) -> None: