mirror of
https://github.com/home-assistant/core.git
synced 2025-08-15 10:31:39 +02:00
delete the start time state injector
This commit is contained in:
@@ -611,9 +611,7 @@ def _sorted_states_to_dict(
|
||||
axis correctly.
|
||||
"""
|
||||
field_map = _FIELD_MAP
|
||||
state_class: Callable[
|
||||
[Row, dict[str, dict[str, Any]], datetime | None], State | dict[str, Any]
|
||||
]
|
||||
state_class: Callable[[Row, dict[str, dict[str, Any]]], State | dict[str, Any]]
|
||||
if compressed_state_format:
|
||||
state_class = row_to_compressed_state
|
||||
attr_time = COMPRESSED_STATE_LAST_UPDATED
|
||||
@@ -657,7 +655,7 @@ def _sorted_states_to_dict(
|
||||
or split_entity_id(entity_id)[0] in NEED_ATTRIBUTE_DOMAINS
|
||||
):
|
||||
ent_results.extend(
|
||||
state_class(db_state, attr_cache, None, entity_id=entity_id) # type: ignore[call-arg]
|
||||
state_class(db_state, attr_cache, entity_id=entity_id) # type: ignore[call-arg]
|
||||
for db_state in group
|
||||
)
|
||||
continue
|
||||
@@ -671,7 +669,7 @@ def _sorted_states_to_dict(
|
||||
continue
|
||||
prev_state = first_state.state
|
||||
ent_results.append(
|
||||
state_class(first_state, attr_cache, None, entity_id=entity_id) # type: ignore[call-arg]
|
||||
state_class(first_state, attr_cache, entity_id=entity_id) # type: ignore[call-arg]
|
||||
)
|
||||
|
||||
state_idx = field_map["state"]
|
||||
|
@@ -51,7 +51,6 @@ class LazyState(State):
|
||||
self,
|
||||
row: Row,
|
||||
attr_cache: dict[str, dict[str, Any]],
|
||||
start_time: datetime | None,
|
||||
entity_id: str | None = None,
|
||||
) -> None:
|
||||
"""Init the lazy state."""
|
||||
@@ -59,9 +58,7 @@ class LazyState(State):
|
||||
self.entity_id = entity_id or self._row.entity_id
|
||||
self.state = self._row.state or ""
|
||||
self._attributes: dict[str, Any] | None = None
|
||||
self._last_updated_ts: float | None = self._row.last_updated_ts or (
|
||||
dt_util.utc_to_timestamp(start_time) if start_time else None
|
||||
)
|
||||
self._last_updated_ts: float | None = self._row.last_updated_ts
|
||||
self._last_changed_ts: float | None = (
|
||||
getattr(self._row, "last_changed_ts", None) or self._last_updated_ts
|
||||
)
|
||||
@@ -138,7 +135,6 @@ class LazyState(State):
|
||||
def row_to_compressed_state(
|
||||
row: Row,
|
||||
attr_cache: dict[str, dict[str, Any]],
|
||||
start_time: datetime | None,
|
||||
entity_id: str | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""Convert a database row to a compressed state schema 31 and later."""
|
||||
@@ -146,9 +142,6 @@ def row_to_compressed_state(
|
||||
COMPRESSED_STATE_STATE: row.state,
|
||||
COMPRESSED_STATE_ATTRIBUTES: decode_attributes_from_row(row, attr_cache),
|
||||
}
|
||||
if start_time:
|
||||
comp_state[COMPRESSED_STATE_LAST_UPDATED] = dt_util.utc_to_timestamp(start_time)
|
||||
else:
|
||||
row_last_updated_ts: float = row.last_updated_ts
|
||||
comp_state[COMPRESSED_STATE_LAST_UPDATED] = row_last_updated_ts
|
||||
if row_last_updated_ts != (
|
||||
|
Reference in New Issue
Block a user