From 1814c855255f3f8d8977f94d46a4f64f7e7003c1 Mon Sep 17 00:00:00 2001 From: Philipp Grimm Date: Mon, 13 May 2024 15:02:45 +0200 Subject: [PATCH] test fire_last_message_received --- custom_components/eltako/gateway.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/custom_components/eltako/gateway.py b/custom_components/eltako/gateway.py index b3f09eb3..3da2cbf6 100644 --- a/custom_components/eltako/gateway.py +++ b/custom_components/eltako/gateway.py @@ -93,8 +93,9 @@ def set_connection_state_changed_handler(self, handler): def _fire_connection_state_changed_event(self): LOGGER.info("Fire message connection state changed") - event_id = config_helpers.get_bus_event_type(self.base_id, SIGNAL_GATEWAY_CONNECTION_STATUS) - dispatcher_send(self.hass, event_id, self._bus.is_active()) + # event_id = config_helpers.get_bus_event_type(self.base_id, SIGNAL_GATEWAY_CONNECTION_STATUS) + # dispatcher_send(self.hass, event_id, self._bus.is_active()) + self.process_connection_status_signal() def set_last_message_received_handler(self, handler): @@ -127,7 +128,7 @@ def process_messages(self, data): self._fire_received_message_count_event() self._fire_last_message_received_event() - def process_connection_status_signal(self, data): + def process_connection_status_signal(self, data=None): LOGGER.info(f"CHANGE CONNECTION STATUS: {self._bus.is_active()}") if self._connection_state_handler: asyncio.ensure_future( @@ -226,8 +227,8 @@ async def async_setup(self): event_id = config_helpers.get_bus_event_type(self.base_id, SIGNAL_RECEIVE_MESSAGE) async_dispatcher_connect(self.hass, event_id, self.process_messages) - event_id = config_helpers.get_bus_event_type(self.base_id, SIGNAL_GATEWAY_CONNECTION_STATUS) - async_dispatcher_connect(self.hass, event_id, self.process_connection_status_signal) + # event_id = config_helpers.get_bus_event_type(self.base_id, SIGNAL_GATEWAY_CONNECTION_STATUS) + # async_dispatcher_connect(self.hass, event_id, self.process_connection_status_signal) # Register home assistant service for sending arbitrary telegrams. #