Fix duplicate events in live history (#113896)

This commit is contained in:
J. Nick Koston 2024-03-20 09:14:17 -10:00 committed by GitHub
parent dfbfdf781e
commit e74791083e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,7 +5,7 @@ from __future__ import annotations
import asyncio import asyncio
from collections.abc import Callable, Iterable, MutableMapping from collections.abc import Callable, Iterable, MutableMapping
from dataclasses import dataclass from dataclasses import dataclass
from datetime import datetime as dt from datetime import datetime as dt, timedelta
import logging import logging
from typing import Any, cast from typing import Any, cast
@ -564,7 +564,10 @@ async def ws_stream(
hass, hass,
connection, connection,
msg_id, msg_id,
last_event_time or start_time, # Add one microsecond so we are outside the window of
# the last event we got from the database since otherwise
# we could fetch the same event twice
(last_event_time or start_time) + timedelta(microseconds=1),
subscriptions_setup_complete_time, subscriptions_setup_complete_time,
entity_ids, entity_ids,
False, # We don't want the start time state again False, # We don't want the start time state again