393 files

This commit is contained in:
Home Assistant Version Control
2026-09-27 17:16:54 +00:00
parent b05b7a897e
commit 39d97ac2db
404 changed files with 54006 additions and 11034 deletions
@@ -19,7 +19,6 @@ from homeassistant.components.logbook.const import (
LOGBOOK_ENTRY_NAME,
)
from homeassistant.core import Event, HomeAssistant, callback
from homeassistant.helpers import entity_registry as er
from .const import (
DOMAIN,
@@ -28,10 +27,9 @@ from .const import (
EVENT_TASK_SKIPPED,
EVENT_TRIGGER_ACTIVATED,
EVENT_TRIGGER_DEACTIVATED,
slugify_object_name,
task_unique_id,
)
from .helpers.i18n import normalize_language
from .helpers.aggregate import task_sensor_entity_id
from .helpers.i18n import format_text, normalize_language
if TYPE_CHECKING:
from collections.abc import Callable
@@ -197,10 +195,8 @@ _STRINGS: dict[str, dict[str, str]] = {
def _t(hass: HomeAssistant, key: str, **kwargs: str) -> str:
lang = normalize_language(hass)
table = _STRINGS.get(lang, _STRINGS["en"])
text = table.get(key, _STRINGS["en"][key])
return text.format(**kwargs) if kwargs else text
"""Logbook line in the HA language (the shared i18n.format_text)."""
return format_text(_STRINGS, normalize_language(hass), key, **kwargs)
def _entry_name(data: Mapping[str, Any]) -> str:
@@ -225,8 +221,9 @@ def _task_entity_id(hass: HomeAssistant, data: Mapping[str, Any]) -> str | None:
task_id = data.get("task_id")
if not obj or not task_id:
return None
unique_id = task_unique_id(slugify_object_name(obj), task_id)
return er.async_get(hass).async_get_entity_id("sensor", DOMAIN, unique_id)
# The event carries the object's name, not its stored data — the same
# slug rule applies (the shared lookup, DRY audit 2026-09-26 B).
return task_sensor_entity_id(hass, {"name": obj}, str(task_id))
def _detail_suffix(data: Mapping[str, Any]) -> str: