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 be5a745 commit 0125823
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions custom_components/eltako/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,10 @@ def set_last_message_received_handler(self, handler):

def _fire_last_message_received_event(self):
if self._last_message_received_handler:
# self.hass.async_create_task(
# self._last_message_received_handler( datetime.utcnow().replace(tzinfo=pytz.utc) )
# )
# self.hass.async_add_executor_job(
# self._last_message_received_handler( datetime.utcnow().replace(tzinfo=pytz.utc) )
# )
asyncio.ensure_future(
self._last_message_received_handler( datetime.utcnow().replace(tzinfo=pytz.utc) ),
loop= self._loop
)
LOGGER.info("LAST RECEIVED MESSAGE")


def set_received_message_count_handler(self, handler):
Expand All @@ -122,12 +115,10 @@ def set_received_message_count_handler(self, handler):
def _fire_received_message_count_event(self):
self._received_message_count += 1
if self._received_message_count_handler:
# self.hass.async_create_task(
# self._received_message_count_handler( self._received_message_count )
# )
# self.hass.async_add_executor_job(
# self._received_message_count_handler( self._received_message_count )
# )
asyncio.ensure_future(
self._received_message_count_handler( self._received_message_count ),
loop= self._loop
)
LOGGER.info("RECEIVED MESSAGE COUNT EVENT")

def process_messages(self, data):
Expand All @@ -137,9 +128,9 @@ def process_messages(self, data):

def process_connection_status_signal(self, data):
if self._connection_state_handler:
# self.hass.async_create_task(
self.hass.async_add_executor_job(
self._connection_state_handler( self._bus.is_active() )
asyncio.ensure_future(
self._connection_state_handler( self._bus.is_active() ),
loop= self._loop
)


Expand Down

0 comments on commit 0125823

Please sign in to comment.