189 files

This commit is contained in:
Home Assistant Version Control
2026-09-08 18:05:32 +00:00
parent 79fefc0a7c
commit 303886f212
189 changed files with 21402 additions and 3514 deletions
@@ -210,7 +210,17 @@ def _entry_name(data: Mapping[str, Any]) -> str:
def _task_entity_id(hass: HomeAssistant, data: Mapping[str, Any]) -> str | None:
"""Resolve the task's sensor entity so the entry lands on its timeline."""
"""Resolve the task's sensor entity so the entry lands on its timeline.
Since 2.75 the event carries the sensor's entity_id itself — that keeps
the attribution for entries whose task has since been deleted (the
registry lookup below then finds nothing) and is what HA's logbook
entity filter matches on. Older recorded events fall back to the
lookup by the object name + task id.
"""
carried = data.get("entity_id")
if isinstance(carried, str) and carried.startswith("sensor."):
return carried
obj = data.get("object_name")
task_id = data.get("task_id")
if not obj or not task_id:
@@ -220,8 +230,16 @@ def _task_entity_id(hass: HomeAssistant, data: Mapping[str, Any]) -> str | None:
def _detail_suffix(data: Mapping[str, Any]) -> str:
"""Language-neutral completion details: cost, duration, notes."""
"""Language-neutral completion details: readings, cost, duration, notes."""
parts: list[str] = []
# Recorded readings (#83 scalar / #161 phase 2 slots) — the value IS the
# point of a meter task, so it leads the line.
if (reading := data.get("reading_value")) is not None:
parts.append(str(reading))
for snap in data.get("reading_values") or []:
if isinstance(snap, Mapping) and snap.get("value") is not None:
unit = f" {snap['unit']}" if snap.get("unit") else ""
parts.append(f"{snap.get('name', '')} {snap['value']}{unit}".strip())
if (cost := data.get("cost")) is not None:
parts.append(str(cost))
if (duration := data.get("duration")) is not None: