Fix jumpy Verisure Wallplug state (#49880)

This commit is contained in:
Franck Nijhof 2021-04-29 23:31:34 +02:00 committed by GitHub
parent c68b259bd3
commit b2c1da54aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -89,9 +89,11 @@ class VerisureSmartplug(CoordinatorEntity, SwitchEntity):
self.coordinator.verisure.set_smartplug_state(self.serial_number, True)
self._state = True
self._change_timestamp = monotonic()
self.schedule_update_ha_state()
def turn_off(self, **kwargs) -> None:
"""Set smartplug status off."""
self.coordinator.verisure.set_smartplug_state(self.serial_number, False)
self._state = False
self._change_timestamp = monotonic()
self.schedule_update_ha_state()