Rebase from upstream

This commit is contained in:
sibowler
2022-07-13 20:35:42 +10:00
parent 54dbc3a359
commit 364569bad8
10 changed files with 235 additions and 18 deletions

View File

@@ -52,6 +52,8 @@ class LocaltuyaBinarySensor(LocalTuyaEntity, BinarySensorEntity):
return self._config.get(CONF_DEVICE_CLASS)
def status_updated(self):
super().status_updated()
"""Device status was updated."""
state = str(self.dps(self._dp_id)).lower()
if state == self._config[CONF_STATE_ON].lower():
@@ -63,6 +65,11 @@ class LocaltuyaBinarySensor(LocalTuyaEntity, BinarySensorEntity):
"State for entity %s did not match state patterns", self.entity_id
)
# No need to restore state for a sensor
async def restore_state_when_connected(self):
"""Do nothing for a sensor"""
return
async_setup_entry = partial(
async_setup_entry, DOMAIN, LocaltuyaBinarySensor, flow_schema