182 files
This commit is contained in:
@@ -88,9 +88,11 @@ from .const import (
|
||||
from .coordinator import MaintenanceCoordinator
|
||||
from .entity.summary_coordinator import MaintenanceSummaryCoordinator
|
||||
from .frontend import async_register_card
|
||||
from .helpers.aggregate import object_name as aggregate_object_name
|
||||
from .helpers.assist_sentences import async_sync as async_sync_assist_sentences
|
||||
from .helpers.dates import INTERVAL_UNITS
|
||||
from .helpers.documents import DocumentStore
|
||||
from .helpers.global_options import get_global_entry
|
||||
from .helpers.notification_manager import NotificationManager
|
||||
from .helpers.schedule import normalize_task_storage
|
||||
from .helpers.task_fields import (
|
||||
@@ -252,10 +254,7 @@ async def async_maybe_send_weekly_digest(hass: HomeAssistant, *, force: bool = F
|
||||
|
||||
if not force and dt_util.now().weekday() != 0: # Monday only
|
||||
return
|
||||
global_entry = next(
|
||||
(e for e in hass.config_entries.async_entries(DOMAIN) if e.unique_id == GLOBAL_UNIQUE_ID),
|
||||
None,
|
||||
)
|
||||
global_entry = get_global_entry(hass)
|
||||
if global_entry is None:
|
||||
return
|
||||
options = global_entry.options or global_entry.data
|
||||
@@ -290,10 +289,7 @@ async def async_maybe_send_warranty_reminders(hass: HomeAssistant, *, force: boo
|
||||
DEFAULT_WARRANTY_REMINDER_DAYS,
|
||||
)
|
||||
|
||||
global_entry = next(
|
||||
(e for e in hass.config_entries.async_entries(DOMAIN) if e.unique_id == GLOBAL_UNIQUE_ID),
|
||||
None,
|
||||
)
|
||||
global_entry = get_global_entry(hass)
|
||||
if global_entry is None:
|
||||
return
|
||||
options = global_entry.options or global_entry.data
|
||||
@@ -314,7 +310,7 @@ async def async_maybe_send_warranty_reminders(hass: HomeAssistant, *, force: boo
|
||||
except (ValueError, TypeError):
|
||||
continue
|
||||
if delta == days or (force and 0 <= delta <= days):
|
||||
names.append(obj.get("name") or entry.title)
|
||||
names.append(aggregate_object_name(entry))
|
||||
if not names:
|
||||
return
|
||||
nm = hass.data.get(DOMAIN, {}).get(NOTIFICATION_MANAGER_KEY)
|
||||
@@ -336,10 +332,7 @@ async def async_maybe_send_lead_reminders(hass: HomeAssistant) -> None:
|
||||
from .const import CONF_REMINDER_LEAD_DAYS
|
||||
from .models.maintenance_task import MaintenanceTask
|
||||
|
||||
global_entry = next(
|
||||
(e for e in hass.config_entries.async_entries(DOMAIN) if e.unique_id == GLOBAL_UNIQUE_ID),
|
||||
None,
|
||||
)
|
||||
global_entry = get_global_entry(hass)
|
||||
if global_entry is None:
|
||||
return
|
||||
options = global_entry.options or global_entry.data
|
||||
@@ -368,7 +361,7 @@ async def async_maybe_send_lead_reminders(hass: HomeAssistant) -> None:
|
||||
continue
|
||||
# Merged data so last_performed reflects the Store, not stale entry data.
|
||||
merged = coordinator._get_merged_tasks_data()
|
||||
obj_name = obj.get("name") or entry.title
|
||||
obj_name = aggregate_object_name(entry)
|
||||
for task_id, task_data in merged.items():
|
||||
if not task_data.get("enabled", True):
|
||||
continue
|
||||
@@ -678,7 +671,7 @@ async def _async_setup_shared(hass: HomeAssistant) -> bool:
|
||||
coordinator = getattr(rd, "coordinator", None) if rd else None
|
||||
if coordinator is None or not coordinator.data:
|
||||
continue
|
||||
object_name = ce.data.get(CONF_OBJECT, {}).get("name", ce.title)
|
||||
object_name = aggregate_object_name(ce)
|
||||
for task_id, task in coordinator.data.get(CONF_TASKS, {}).items():
|
||||
status = str(task.get("_status", ""))
|
||||
if status == "archived":
|
||||
@@ -1345,7 +1338,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: MaintenanceSupporterConf
|
||||
is_fixable=True,
|
||||
severity=ir.IssueSeverity.WARNING,
|
||||
translation_key="device_link_self" if self_link else "device_link_lost",
|
||||
translation_placeholders={"object": obj_data.get("name") or entry.title},
|
||||
translation_placeholders={"object": aggregate_object_name(entry)},
|
||||
data={"entry_id": entry.entry_id},
|
||||
)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user