Skip to content

Commit

Permalink
test fire_last_message_received
Browse files Browse the repository at this point in the history
  • Loading branch information
grimmpp committed May 13, 2024
1 parent 53f993f commit 1814c85
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions custom_components/eltako/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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.
#
Expand Down

0 comments on commit 1814c85

Please sign in to comment.