From 93d776b3a70a4304f95fd47bb08577b7b4e70e5e Mon Sep 17 00:00:00 2001 From: Philipp Grimm Date: Mon, 13 May 2024 12:08:07 +0200 Subject: [PATCH] test fire_last_message_received --- custom_components/eltako/gateway.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/custom_components/eltako/gateway.py b/custom_components/eltako/gateway.py index 5af13221..3ad0594a 100644 --- a/custom_components/eltako/gateway.py +++ b/custom_components/eltako/gateway.py @@ -20,7 +20,7 @@ from homeassistant.core import HomeAssistant from homeassistant.const import CONF_MAC -from homeassistant.helpers.dispatcher import async_dispatcher_connect, dispatcher_send, dispatcher_connect +from homeassistant.helpers.dispatcher import async_dispatcher_connect, dispatcher_send from homeassistant.helpers import device_registry as dr from homeassistant.helpers.device_registry import DeviceRegistry, DeviceInfo from homeassistant.config_entries import ConfigEntry @@ -145,10 +145,6 @@ def _register_device(self) -> None: name= self.dev_name, model=self.model, ) - - # Register callbacks. - event_id = config_helpers.get_bus_event_type(self.gateway.base_id, SIGNAL_RECEIVE_MESSAGE) - dispatcher_connect(self.hass, event_id, self.process_messages) ### address validation functions @@ -214,6 +210,9 @@ async def async_setup(self): self.hass, event_id, self._callback_send_message_to_serial_bus ) + event_id = config_helpers.get_bus_event_type(self.gateway.base_id, SIGNAL_RECEIVE_MESSAGE) + async_dispatcher_connect(self.hass, event_id, self.process_messages) + # Register home assistant service for sending arbitrary telegrams. # # The service will be registered for each gateway, as the user