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 ebf2453 commit 89a281c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions custom_components/eltako/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
from homeassistant.helpers.dispatcher import async_dispatcher_connect, dispatcher_send, dispatcher_connect
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers.device_registry import DeviceRegistry, DeviceInfo
from homeassistant.config_entries import ConfigEntry
Expand Down Expand Up @@ -120,6 +120,9 @@ def _fire_received_message_count_event(self):
self._received_message_count_handler( self._received_message_count )
)

def process_messages(self):
LOGGER.info("GATEWAY: HANDLE MESSAGES")


def _init_bus(self):
self._received_message_count = 0
Expand All @@ -129,7 +132,7 @@ def _init_bus(self):
else:
self._bus = ESP3SerialCommunicator(filename=self.serial_path, callback=self._callback_receive_message_from_serial_bus, esp2_translation_enabled=True)

# self._bus.set_status_changed_handler(self._fire_connection_state_changed_event)
self._bus.set_status_changed_handler(self._fire_connection_state_changed_event)


def _register_device(self) -> None:
Expand All @@ -143,6 +146,11 @@ def _register_device(self) -> None:
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

def validate_sender_id(self, sender_id: AddressExpression, device_name: str = "") -> bool:
Expand Down

0 comments on commit 89a281c

Please sign in to comment.