diff --git a/custom_components/myhome/gateway.py b/custom_components/myhome/gateway.py index 821a20d..e836cb1 100644 --- a/custom_components/myhome/gateway.py +++ b/custom_components/myhome/gateway.py @@ -164,7 +164,14 @@ async def listening_loop(self): self.hass.data[DOMAIN][self.mac][CONF_PLATFORMS][SENSOR][message.entity][CONF_ENTITIES][_entity], MyHOMEEntity, ): - self.hass.data[DOMAIN][self.mac][CONF_PLATFORMS][SENSOR][message.entity][CONF_ENTITIES][_entity].handle_event(message) + try: + self.hass.data[DOMAIN][self.mac][CONF_PLATFORMS][SENSOR][message.entity][CONF_ENTITIES][_entity].handle_event(message) + except: + LOGGER.error( + "%s Error handling event `%s`", + self.log_id, + message, + ) else: continue elif ( @@ -257,7 +264,7 @@ async def listening_loop(self): ) if not is_event: if isinstance(message, OWNLightingEvent) and message.brightness_preset: - if isinstance( + if message.entity in self.hass.data[DOMAIN][self.mac][CONF_PLATFORMS][LIGHT] and isinstance( self.hass.data[DOMAIN][self.mac][CONF_PLATFORMS][LIGHT][message.entity][CONF_ENTITIES][LIGHT], MyHOMEEntity, ): @@ -280,7 +287,14 @@ async def listening_loop(self): EnableCommandButtonEntity, ) ): - self.hass.data[DOMAIN][self.mac][CONF_PLATFORMS][_platform][message.entity][CONF_ENTITIES][_entity].handle_event(message) + try: + self.hass.data[DOMAIN][self.mac][CONF_PLATFORMS][_platform][message.entity][CONF_ENTITIES][_entity].handle_event(message) + except: + LOGGER.error( + "%s Error handling event `%s`", + self.log_id, + message, + ) else: LOGGER.debug(