diff --git a/homeassistant/components/history/websocket_api.py b/homeassistant/components/history/websocket_api.py index 27e490dd8d4..462d8464229 100644 --- a/homeassistant/components/history/websocket_api.py +++ b/homeassistant/components/history/websocket_api.py @@ -331,11 +331,14 @@ async def _async_events_consumer( no_attributes: bool, ) -> None: """Stream events from the queue.""" + subscriptions_setup_complete_timestamp = ( + subscriptions_setup_complete_time.timestamp() + ) while True: events: list[Event] = [await stream_queue.get()] # If the event is older than the last db # event we already sent it so we skip it. - if events[0].time_fired <= subscriptions_setup_complete_time: + if events[0].time_fired_timestamp <= subscriptions_setup_complete_timestamp: continue # We sleep for the EVENT_COALESCE_TIME so # we can group events together to minimize diff --git a/homeassistant/components/logbook/websocket_api.py b/homeassistant/components/logbook/websocket_api.py index b7555d91241..cac58971cde 100644 --- a/homeassistant/components/logbook/websocket_api.py +++ b/homeassistant/components/logbook/websocket_api.py @@ -222,11 +222,14 @@ async def _async_events_consumer( event_processor: EventProcessor, ) -> None: """Stream events from the queue.""" + subscriptions_setup_complete_timestamp = ( + subscriptions_setup_complete_time.timestamp() + ) while True: events: list[Event] = [await stream_queue.get()] # If the event is older than the last db # event we already sent it so we skip it. - if events[0].time_fired <= subscriptions_setup_complete_time: + if events[0].time_fired_timestamp <= subscriptions_setup_complete_timestamp: continue # We sleep for the EVENT_COALESCE_TIME so # we can group events together to minimize