Add check for if payload is set on state message

This commit is contained in:
Luke Bonaccorsi 2023-10-05 16:27:29 +01:00
parent abb8285e2f
commit ae189ce422
1 changed files with 3 additions and 2 deletions

View File

@ -736,8 +736,9 @@ class TuyaDevice:
await self.update_entity_state_cb() await self.update_entity_state_cb()
async def async_update_state(self, state_message, _=None): async def async_update_state(self, state_message, _=None):
_LOGGER.info("Received updated state {}: {}".format(self, self._dps)) if state_message.payload and state_message.payload["dps"]:
self._dps.update(state_message.payload["dps"]) self._dps.update(state_message.payload["dps"])
_LOGGER.info("Received updated state {}: {}".format(self, self._dps))
@property @property
def state(self): def state(self):