278 files

This commit is contained in:
Home Assistant Version Control
2026-09-13 20:38:58 +00:00
parent d7a0a08372
commit 1b4f5f68c6
278 changed files with 36892 additions and 7150 deletions
@@ -129,6 +129,9 @@ CONF_PANEL_TITLE = "panel_title"
# installs so the panel can announce the new look with a "back to icons" button.
CONF_ROW_ACTION_STYLE = "row_action_style"
CONF_ROW_ACTION_NOTICE = "row_action_notice_pending"
# #170 round 2: show the reference numbers (#8, #8.3) in front of object and
# task names in every list, not only on the detail pages.
CONF_REF_NUMBERS_IN_LISTS = "ref_numbers_in_lists"
ROW_ACTION_STYLES: tuple[str, ...] = ("buttons_compact", "buttons", "icons")
DEFAULT_ROW_ACTION_STYLE = "buttons_compact"
# #146: household defaults for the "low" thresholds that discovery and the
@@ -137,6 +140,8 @@ DEFAULT_ROW_ACTION_STYLE = "buttons_compact"
# floor for batteries without their own Battery Notes threshold.
CONF_DEFAULT_CONSUMABLE_THRESHOLD = "default_consumable_threshold"
CONF_BATTERY_LOW_PERCENT = "battery_low_percent"
# D#162 follow-up: per-type typical lifetime overrides {canonical type: months}
CONF_BATTERY_LIFETIME_MONTHS = "battery_lifetime_months"
DEFAULT_CONSUMABLE_THRESHOLD = 10
DEFAULT_BATTERY_LOW_PERCENT = 20
THRESHOLD_PERCENT_RANGE: tuple[int, int] = (1, 90)
@@ -286,6 +291,37 @@ CONF_NOTIFY_EVENT_ONLY = "notify_event_only"
CONF_NOTIFY_EXTRA_DATA = "notify_extra_data"
MAX_NOTIFY_EXTRA_DATA_LENGTH = 2000
NOTIFICATION_TITLE_STYLES = ("default", "object_name", "task_name")
# #173 follow-up: completion notifications — off, only completions no person
# made on the spot (sensor recovery, shopping-list sync, an automation's
# service call), or every completion.
CONF_NOTIFY_COMPLETED = "notify_completed"
NOTIFY_COMPLETED_MODES = ("off", "automatic", "all")
# Completion sources (``complete_maintenance(source=…)``): where a completion
# came from. The "automatic" ones had no person acting on the spot.
COMPLETION_SOURCES = (
"panel",
"qr",
"nfc",
"button",
"todo",
"voice",
"notification_action",
"shopping_list",
"service",
"auto_recovery",
)
COMPLETION_SOURCES_AUTOMATIC = frozenset({"shopping_list", "service", "auto_recovery"})
# The canned history note an UNATTENDED surface attaches (nobody was asked
# for one) — provenance, never the note a task demands. One table, so the
# wording lives once; tests/test_completion_sources.py keeps it complete.
COMPLETION_PROVENANCE_NOTES: dict[str, str] = {
"button": "Completed from dashboard button",
"todo": "Completed from the To-do list",
"voice": "Completed by voice",
"notification_action": "Completed from the notification",
"nfc": "Completed via NFC tag",
"shopping_list": "Completed from the shopping list",
}
# --- Config Keys: Notification Actions ---
CONF_ACTION_COMPLETE_ENABLED = "action_complete_enabled"
@@ -529,6 +565,10 @@ CONF_BUDGET_YEARLY = "budget_yearly"
CONF_BUDGET_ALERTS_ENABLED = "budget_alerts_enabled"
CONF_BUDGET_ALERT_THRESHOLD = "budget_alert_threshold"
CONF_BUDGET_CURRENCY = "budget_currency"
# Decimal places for every displayed amount — KPIs, budgets, costs in lists and
# reports, budget alerts, buy-task notes. 0 = whole numbers (the default).
CONF_CURRENCY_DECIMALS = "currency_decimals"
DEFAULT_CURRENCY_DECIMALS = 0
BUDGET_CURRENCIES: dict[str, str] = {
"EUR": "€",
@@ -642,6 +682,14 @@ class MaintenanceStatus(StrEnum):
PAUSED = "paused"
# The statuses a reminder can be about — the same set the coordinator, the
# notification manager, the to-do list and the aggregate counters used to
# spell out by hand (DRY review 2026-09-12).
NOTIFIABLE_STATUSES: frozenset[str] = frozenset(
{MaintenanceStatus.DUE_SOON, MaintenanceStatus.OVERDUE, MaintenanceStatus.TRIGGERED}
)
class MaintenanceTypeEnum(StrEnum):
"""Type/category of maintenance."""
@@ -775,6 +823,7 @@ MAX_LABEL_LENGTH = 40 # single label/tag
MAX_GROUP_TASK_REFS = 200
MAX_ID_LENGTH = 64 # entry_id, task_id, group_id (uuid hex = 32)
MAX_DATE_LENGTH = 20 # ISO 8601 date strings (e.g. 2026-04-21)
MAX_TIMESTAMP_LENGTH = 64 # ISO 8601 timestamps with offset (history entries)
MAX_ENTITY_ID_LENGTH = 255 # HA entity_id max
# "No usable reading" state pair — 13 call sites hand-typed the tuple before
@@ -798,6 +847,10 @@ MAX_SCHEDULE_TIME_LENGTH = 5 # "HH:MM"
# already had MAX_PARTS_PER_OBJECT (50); tasks and documents were unbounded.
MAX_TASKS_PER_OBJECT = 200 # mirrors MAX_GROUP_TASK_REFS; ~10x any real device
MAX_DOCS_PER_OBJECT = 100 # manuals + invoices + photos — 100 is very generous
# Vacation exempt list: task ids that keep their schedule during a vacation.
# One cap for the WS schema, the sanitiser and the settings import (DRY
# review 2026-09-13) — 2000 covers ten fully-loaded objects.
MAX_VACATION_EXEMPT_TASKS = 2000
# --- Trigger Entity Availability ---
STARTUP_GRACE_PERIOD_SECONDS = 300 # 5 minutes