Coverage for custom_components/appliance_autonotify/const.py: 100%
169 statements
« prev ^ index » next coverage.py v7.17.3, created at 2026-11-28 12:19 +0000
« prev ^ index » next coverage.py v7.17.3, created at 2026-11-28 12:19 +0000
1"""Constants for Appliance Auto Notify"""
3from typing import Any, Final
5DOMAIN: Final[str] = "appliance_autonotify"
6SUPERNOTIFY_DOMAIN: Final[str] = "supernotify"
8CONF_START_TITLE: Final[str] = "start_title"
9CONF_START_MESSAGE: Final[str] = "start_message"
10CONF_END_TITLE: Final[str] = "end_title"
11CONF_END_MESSAGE: Final[str] = "end_message"
12# notify entities, used only without Supernotify
13CONF_TARGETS: Final[str] = "targets"
14# as the `target` and `custom_target` of supernotify.notify
15CONF_TARGET: Final[str] = "target"
16CONF_CUSTOM_TARGET: Final[str] = "custom_target"
17CONF_DELIVERIES: Final[str] = "deliveries"
18# whether progress is told with ordinary notifications, the Live Activity is kept up to date regardless
19CONF_NOTIFY_PROGRESS: Final[str] = "notify_progress"
20# whether the start and the end are told with ordinary notifications, the Live Activity is opened and closed regardless
21CONF_NOTIFY_START: Final[str] = "notify_start"
22CONF_NOTIFY_END: Final[str] = "notify_end"
23# whether the end of a phase, such as an oven getting up to heat, is told with an ordinary notification
24CONF_NOTIFY_PHASE: Final[str] = "notify_phase"
25# whether a Live Activity counts down the time left, where the appliance reports when it will finish, which on an
26# iPhone's Lock Screen takes the place of the message, so that what's shown goes in the title instead
27CONF_LIVE_TIMER: Final[str] = "live_timer"
28# what a Live Activity shows of what the appliance is doing, each where the appliance reports it: its program, the
29# phase of the cycle it's in, such as a pre-rinse or a robot vacuum returning to its dock, and its state where that
30# says more than that it's running, such as paused or waiting for something to be done
31CONF_LIVE_SHOW: Final[str] = "live_show"
32LIVE_SHOW_PROGRAM: Final[str] = "program"
33LIVE_SHOW_PHASE: Final[str] = "phase"
34LIVE_SHOW_STATE: Final[str] = "state"
35LIVE_SHOWS: Final[tuple[str, ...]] = (LIVE_SHOW_PROGRAM, LIVE_SHOW_PHASE, LIVE_SHOW_STATE)
36LIVE_DEFAULTS: Final[dict[str, Any]] = {CONF_LIVE_TIMER: True, CONF_LIVE_SHOW: list(LIVE_SHOWS)}
37# the choices these took over from, the title and what was shown in place of the time left
38CONF_LIVE_TITLE: Final[str] = "live_title"
39CONF_LIVE_DETAIL: Final[str] = "live_detail"
40# the longest title with all that's shown in it, past which the program and then the phase are left out, the
41# state being the least often there and the most worth knowing when it is
42LIVE_TITLE_ROOM: Final[int] = 40
43# the switch the title choice took over from, off being the name only
44CONF_PROGRAM_IN_TITLE: Final[str] = "program_in_title"
45# path of the dashboard opened by a tap on a notification, the app is opened where it was last if there's none
46CONF_DASHBOARD: Final[str] = "dashboard"
47# whether a dashboard named for the appliance has been looked for, which is done once, as it's first set up, so
48# whatever is chosen after is left alone
49CONF_DASHBOARD_FOUND: Final[str] = "dashboard_found"
50LOVELACE_DOMAIN: Final[str] = "lovelace"
51# the dashboard Home Assistant starts with has no path of its own in the list of them
52DEFAULT_DASHBOARD: Final[str] = "lovelace"
53DEFAULT_DASHBOARD_TITLE: Final[str] = "Overview"
54# the one entry that isn't an appliance, holding whether appliances found are set up without asking
55TYPE_DISCOVERY: Final[str] = "discovery"
56CONF_AUTO_DISCOVER: Final[str] = "auto_discover"
57# an appliance with no integration of its own, known only by the power it draws
58TYPE_POWER: Final[str] = "power"
59CONF_POWER_ENTITY: Final[str] = "power_entity"
60# a robot vacuum, of any make, whose cleaning is a cycle
61TYPE_VACUUM: Final[str] = "vacuum"
62CONF_THRESHOLD: Final[str] = "threshold"
63CONF_GRACE_PERIOD: Final[str] = "grace_period"
64CONF_MIN_DURATION: Final[str] = "min_duration"
65# the smart plug the appliance is on, offered as a button to switch off once it has finished
66CONF_SWITCH_ENTITY: Final[str] = "switch_entity"
67# whether that button is offered, for a plug chosen but better left on
68CONF_SWITCH_OFF_BUTTON: Final[str] = "switch_off_button"
69# watts above which the appliance is running
70DEFAULT_THRESHOLD: Final[float] = 1
71# seconds at or below the threshold before the cycle is over, so short drop outs are ignored
72DEFAULT_GRACE_PERIOD: Final[float] = 60
73# seconds above the threshold before it counts as a cycle, so a door opened or a button pressed isn't one
74DEFAULT_MIN_DURATION: Final[float] = 0
76# English only for the MVP
77DISCOVERY_TITLE: Final[str] = "Automatic discovery"
78NAME_PLACEHOLDER: Final[str] = "{name}"
79# the program under way, as Home Assistant shows it, and nothing at all for an appliance that reports none
80PROGRAM_PLACEHOLDER: Final[str] = "{program}"
81# the time of day the cycle began, as it runs and once it's over
82START_TIME_PLACEHOLDER: Final[str] = "{start_time}"
83# what the cycle came to, as it ends, and nothing at all where that isn't known
84DURATION_PLACEHOLDER: Final[str] = "{duration}"
85ENERGY_PLACEHOLDER: Final[str] = "{energy}"
86COST_PLACEHOLDER: Final[str] = "{cost}"
87DEFAULT_TITLE: Final[str] = "{name}"
88# the texts of notifications, by the language of Home Assistant as for the buttons, English for any other, worded
89# so as not to depend on whether the appliance's name is masculine or feminine
90TEXT_START: Final[str] = "start"
91TEXT_END: Final[str] = "end"
92TEXT_PROGRESS: Final[str] = "progress"
93TEXT_PREHEAT: Final[str] = "preheat"
94TEXT_FAST_PREHEAT: Final[str] = "fast_preheat"
95TEXT_PREHEATING: Final[str] = "preheating"
96TEXT_PREHEATED: Final[str] = "preheated"
97# the appliance unavailable for longer than chosen, since when, and back, after how long
98TEXT_OFFLINE: Final[str] = "offline"
99TEXT_ONLINE: Final[str] = "online"
100NOTIFICATION_TEXTS: Final[dict[str, dict[str, str]]] = {
101 "en": {
102 TEXT_START: "{name} started",
103 TEXT_END: "{name} is finished",
104 TEXT_PROGRESS: "{progress}% complete",
105 TEXT_PREHEAT: "Pre-heating",
106 TEXT_FAST_PREHEAT: "Fast pre-heat",
107 TEXT_PREHEATING: "{phase}, {current} of {target}{unit}",
108 TEXT_PREHEATED: "{name} is pre-heated",
109 TEXT_OFFLINE: "{name} is offline since {since}",
110 TEXT_ONLINE: "{name} is back online after {duration}",
111 },
112 "it": {
113 TEXT_START: "{name}: ciclo avviato",
114 TEXT_END: "{name}: ciclo terminato",
115 TEXT_PROGRESS: "{progress}% completato",
116 TEXT_PREHEAT: "Preriscaldamento",
117 TEXT_FAST_PREHEAT: "Preriscaldamento rapido",
118 TEXT_PREHEATING: "{phase}, {current} di {target}{unit}",
119 TEXT_PREHEATED: "{name}: preriscaldamento completato",
120 TEXT_OFFLINE: "{name}: offline dalle {since}",
121 TEXT_ONLINE: "{name}: di nuovo online dopo {duration}",
122 },
123 "de": {
124 TEXT_START: "{name} gestartet",
125 TEXT_END: "{name} ist fertig",
126 TEXT_PROGRESS: "{progress} % erledigt",
127 TEXT_PREHEAT: "Vorheizen",
128 TEXT_FAST_PREHEAT: "Schnellaufheizen",
129 TEXT_PREHEATING: "{phase}, {current} von {target}{unit}",
130 TEXT_PREHEATED: "{name} ist vorgeheizt",
131 TEXT_OFFLINE: "{name} ist seit {since} offline",
132 TEXT_ONLINE: "{name} ist nach {duration} wieder online",
133 },
134 "nl": {
135 TEXT_START: "{name} gestart",
136 TEXT_END: "{name} is klaar",
137 TEXT_PROGRESS: "{progress}% voltooid",
138 TEXT_PREHEAT: "Voorverwarmen",
139 TEXT_FAST_PREHEAT: "Snel voorverwarmen",
140 TEXT_PREHEATING: "{phase}, {current} van {target}{unit}",
141 TEXT_PREHEATED: "{name} is voorverwarmd",
142 TEXT_OFFLINE: "{name} is offline sinds {since}",
143 TEXT_ONLINE: "{name} is na {duration} weer online",
144 },
145 "es": {
146 TEXT_START: "{name}: ciclo iniciado",
147 TEXT_END: "{name}: ciclo terminado",
148 TEXT_PROGRESS: "{progress} % completado",
149 TEXT_PREHEAT: "Precalentando",
150 TEXT_FAST_PREHEAT: "Precalentamiento rápido",
151 TEXT_PREHEATING: "{phase}, {current} de {target}{unit}",
152 TEXT_PREHEATED: "{name}: precalentamiento completado",
153 TEXT_OFFLINE: "{name}: sin conexión desde las {since}",
154 TEXT_ONLINE: "{name}: conexión restablecida tras {duration}",
155 },
156 "fr": {
157 TEXT_START: "{name} : cycle démarré",
158 TEXT_END: "{name} : cycle terminé",
159 TEXT_PROGRESS: "{progress} % terminé",
160 TEXT_PREHEAT: "Préchauffage",
161 TEXT_FAST_PREHEAT: "Préchauffage rapide",
162 TEXT_PREHEATING: "{phase}, {current} sur {target}{unit}",
163 TEXT_PREHEATED: "{name} : préchauffage terminé",
164 TEXT_OFFLINE: "{name} : hors ligne depuis {since}",
165 TEXT_ONLINE: "{name} : de nouveau en ligne après {duration}",
166 },
167 "pl": {
168 TEXT_START: "{name}: cykl rozpoczęty",
169 TEXT_END: "{name}: cykl zakończony",
170 TEXT_PROGRESS: "Ukończono {progress}%",
171 TEXT_PREHEAT: "Nagrzewanie",
172 TEXT_FAST_PREHEAT: "Szybkie nagrzewanie",
173 TEXT_PREHEATING: "{phase}, {current} z {target}{unit}",
174 TEXT_PREHEATED: "{name}: nagrzewanie zakończone",
175 TEXT_OFFLINE: "{name}: offline od {since}",
176 TEXT_ONLINE: "{name}: znów online po {duration}",
177 },
178 "zh": {
179 TEXT_START: "{name} 已启动",
180 TEXT_END: "{name} 已完成",
181 TEXT_PROGRESS: "已完成 {progress}%",
182 TEXT_PREHEAT: "预热中",
183 TEXT_FAST_PREHEAT: "快速预热",
184 TEXT_PREHEATING: "{phase},{current}/{target}{unit}",
185 TEXT_PREHEATED: "{name} 已预热",
186 TEXT_OFFLINE: "{name} 自 {since} 起离线",
187 TEXT_ONLINE: "{name} 离线 {duration} 后已恢复在线",
188 },
189 "hi": {
190 TEXT_START: "{name} शुरू हो गया",
191 TEXT_END: "{name} पूरा हो गया",
192 TEXT_PROGRESS: "{progress}% पूरा",
193 TEXT_PREHEAT: "प्रीहीटिंग",
194 TEXT_FAST_PREHEAT: "तेज़ प्रीहीट",
195 TEXT_PREHEATING: "{phase}, {target}{unit} में से {current}",
196 TEXT_PREHEATED: "{name} प्रीहीट हो गया",
197 TEXT_OFFLINE: "{name} {since} से ऑफ़लाइन है",
198 TEXT_ONLINE: "{name} {duration} बाद फिर से ऑनलाइन है",
199 },
200}
202# minutes an appliance must be unavailable, as when its integration can't reach it, before it's told of as offline,
203# and then again as it's back, none unless chosen, since one switched off at the wall is offline too
204CONF_OFFLINE_AFTER: Final[str] = "offline_after"
205# minutes after which the end is told again, for as long as nobody says the appliance has been seen to
206CONF_REMINDER: Final[str] = "reminder"
207# how many times it's told again
208CONF_REMINDER_REPEATS: Final[str] = "reminder_repeats"
209DEFAULT_REMINDER_REPEATS: Final[int] = 3
210# minutes for Remind Later, when no reminder is set
211DEFAULT_SNOOZE: Final[int] = 30
212# buttons on the end notification, each followed by the entry id of the appliance
213ACTION_FINISHED: Final[str] = "APPLIANCE_FINISHED_"
214ACTION_REMIND: Final[str] = "APPLIANCE_REMIND_"
215ACTION_SWITCH_OFF: Final[str] = "APPLIANCE_SWITCH_OFF_"
216# by the language of Home Assistant, English for any other
217ACTION_TITLES: Final[dict[str, dict[str, str]]] = {
218 "en": {ACTION_FINISHED: "Finished", ACTION_REMIND: "Remind Later", ACTION_SWITCH_OFF: "Switch Off"},
219 "it": {ACTION_FINISHED: "Finito", ACTION_REMIND: "Ricordamelo dopo", ACTION_SWITCH_OFF: "Spegni presa"},
220 "de": {ACTION_FINISHED: "Erledigt", ACTION_REMIND: "Später erinnern", ACTION_SWITCH_OFF: "Steckdose aus"},
221 "nl": {ACTION_FINISHED: "Klaar", ACTION_REMIND: "Later herinneren", ACTION_SWITCH_OFF: "Stekker uit"},
222 "es": {ACTION_FINISHED: "Terminado", ACTION_REMIND: "Recordar más tarde", ACTION_SWITCH_OFF: "Apagar enchufe"},
223 "fr": {ACTION_FINISHED: "Terminé", ACTION_REMIND: "Me rappeler plus tard", ACTION_SWITCH_OFF: "Éteindre la prise"},
224 "pl": {ACTION_FINISHED: "Gotowe", ACTION_REMIND: "Przypomnij później", ACTION_SWITCH_OFF: "Wyłącz gniazdko"},
225 "zh": {ACTION_FINISHED: "已完成", ACTION_REMIND: "稍后提醒", ACTION_SWITCH_OFF: "关闭插座"},
226 "hi": {ACTION_FINISHED: "पूरा हुआ", ACTION_REMIND: "बाद में याद दिलाएं", ACTION_SWITCH_OFF: "प्लग बंद करें"},
227}
228MOBILE_ACTION_EVENT: Final[str] = "mobile_app_notification_action"
229# action buttons Android shows on a notification, any after those being left out
230ANDROID_BUTTONS: Final[int] = 3
232# whether maintenance is tracked for the appliance, unset until it's been asked for or turned down, so it's offered
233# once, on the first end notification, rather than left for someone to go looking for
234CONF_MAINTENANCE: Final[str] = "maintenance"
235# the cycles between each item of maintenance, by item, as `maintenance_drum_clean`, 0 leaving the item out
236CONF_MAINTENANCE_PREFIX: Final[str] = "maintenance_"
237# the items each type of appliance starts with, and how many cycles apart, generous since vendors are keen to sell
238# cleaning tablets and spares, all to be changed or taken out in its settings
239MAINTENANCE_ITEMS: Final[dict[str, dict[str, int]]] = {
240 "washer": {"drum_clean": 30, "filter": 50},
241 "washer_dryer": {"drum_clean": 30, "filter": 50, "lint_filter": 20},
242 "dishwasher": {"filter": 30, "machine_clean": 60},
243 "dryer": {"condenser": 30},
244}
245# an entity of the appliance's own that says how much life a part has left, as a robot vacuum's brushes and filters,
246# which is the item instead of a count of cycles, due once it's this low
247LIFESPAN_KEY: Final[str] = "lifespan"
248LIFESPAN_DUE: Final[float] = 10
249# the button the same integration has to reset that part, by the translation key, as Ecovacs has it
250LIFESPAN_RESET_PREFIX: Final[str] = "reset_"
251# days that later is, for one item or all of an appliance's, after which it's due again
252MAINTENANCE_SNOOZE_DAYS: Final[int] = 30
253# buttons on the notification of an item due, followed by the entry id and the item, and on the first end
254# notification of an appliance whose maintenance isn't tracked, followed by the entry id
255ACTION_MAINTAINED: Final[str] = "APPLIANCE_MAINTAINED_"
256ACTION_MAINTENANCE_LATER: Final[str] = "APPLIANCE_MAINTENANCE_LATER_"
257ACTION_TRACK_MAINTENANCE: Final[str] = "APPLIANCE_TRACK_MAINTENANCE_"
258MAINTENANCE_ACTION_TITLES: Final[dict[str, dict[str, str]]] = {
259 "en": {ACTION_MAINTAINED: "Done", ACTION_MAINTENANCE_LATER: "In a Month", ACTION_TRACK_MAINTENANCE: "Track Maintenance"},
260 "it": {ACTION_MAINTAINED: "Fatto", ACTION_MAINTENANCE_LATER: "Tra un mese", ACTION_TRACK_MAINTENANCE: "Segui manutenzione"},
261 "de": {
262 ACTION_MAINTAINED: "Erledigt",
263 ACTION_MAINTENANCE_LATER: "In einem Monat",
264 ACTION_TRACK_MAINTENANCE: "Wartung verfolgen",
265 },
266 "nl": {
267 ACTION_MAINTAINED: "Gedaan",
268 ACTION_MAINTENANCE_LATER: "Over een maand",
269 ACTION_TRACK_MAINTENANCE: "Onderhoud bijhouden",
270 },
271 "es": {ACTION_MAINTAINED: "Hecho", ACTION_MAINTENANCE_LATER: "En un mes", ACTION_TRACK_MAINTENANCE: "Seguir mantenimiento"},
272 "fr": {ACTION_MAINTAINED: "Fait", ACTION_MAINTENANCE_LATER: "Dans un mois", ACTION_TRACK_MAINTENANCE: "Suivre l'entretien"},
273 "pl": {
274 ACTION_MAINTAINED: "Zrobione",
275 ACTION_MAINTENANCE_LATER: "Za miesiąc",
276 ACTION_TRACK_MAINTENANCE: "Śledź konserwację",
277 },
278 "zh": {ACTION_MAINTAINED: "已完成", ACTION_MAINTENANCE_LATER: "一个月后", ACTION_TRACK_MAINTENANCE: "跟踪维护"},
279 "hi": {ACTION_MAINTAINED: "हो गया", ACTION_MAINTENANCE_LATER: "एक महीने में", ACTION_TRACK_MAINTENANCE: "रखरखाव ट्रैक करें"},
280}
281# the name of each item, and what its notification says, by the language of Home Assistant as for the buttons
282MAINTENANCE_NAMES: Final[dict[str, dict[str, str]]] = {
283 "en": {
284 "drum_clean": "Drum clean",
285 "filter": "Filter clean",
286 "lint_filter": "Lint filter clean",
287 "machine_clean": "Machine clean",
288 "condenser": "Condenser clean",
289 },
290 "it": {
291 "drum_clean": "Pulizia del cestello",
292 "filter": "Pulizia del filtro",
293 "lint_filter": "Pulizia del filtro lanugine",
294 "machine_clean": "Pulizia della macchina",
295 "condenser": "Pulizia del condensatore",
296 },
297 "de": {
298 "drum_clean": "Trommelreinigung",
299 "filter": "Filterreinigung",
300 "lint_filter": "Flusensiebreinigung",
301 "machine_clean": "Maschinenreinigung",
302 "condenser": "Kondensatorreinigung",
303 },
304 "nl": {
305 "drum_clean": "Trommel reinigen",
306 "filter": "Filter reinigen",
307 "lint_filter": "Pluizenfilter reinigen",
308 "machine_clean": "Machine reinigen",
309 "condenser": "Condensor reinigen",
310 },
311 "es": {
312 "drum_clean": "Limpieza del tambor",
313 "filter": "Limpieza del filtro",
314 "lint_filter": "Limpieza del filtro de pelusa",
315 "machine_clean": "Limpieza de la máquina",
316 "condenser": "Limpieza del condensador",
317 },
318 "fr": {
319 "drum_clean": "Nettoyage du tambour",
320 "filter": "Nettoyage du filtre",
321 "lint_filter": "Nettoyage du filtre à peluches",
322 "machine_clean": "Nettoyage de la machine",
323 "condenser": "Nettoyage du condenseur",
324 },
325 "pl": {
326 "drum_clean": "Czyszczenie bębna",
327 "filter": "Czyszczenie filtra",
328 "lint_filter": "Czyszczenie filtra kłaczków",
329 "machine_clean": "Czyszczenie urządzenia",
330 "condenser": "Czyszczenie skraplacza",
331 },
332 "zh": {
333 "drum_clean": "滚筒清洁",
334 "filter": "过滤器清洁",
335 "lint_filter": "绒毛过滤器清洁",
336 "machine_clean": "机器清洁",
337 "condenser": "冷凝器清洁",
338 },
339 "hi": {
340 "drum_clean": "ड्रम की सफ़ाई",
341 "filter": "फ़िल्टर की सफ़ाई",
342 "lint_filter": "लिंट फ़िल्टर की सफ़ाई",
343 "machine_clean": "मशीन की सफ़ाई",
344 "condenser": "कंडेंसर की सफ़ाई",
345 },
346}
347MAINTENANCE_MESSAGES: Final[dict[str, dict[str, str]]] = {
348 "en": {
349 "cycle": "{item}, 1 cycle since the last one",
350 "cycles": "{item}, {cycles} cycles since the last one",
351 "lifespan": "{item} at {value}%",
352 },
353 "it": {
354 "cycle": "{item}, 1 ciclo dall'ultima",
355 "cycles": "{item}, {cycles} cicli dall'ultima",
356 "lifespan": "{item} al {value}%",
357 },
358 "de": {
359 "cycle": "{item}, 1 Zyklus seit dem letzten Mal",
360 "cycles": "{item}, {cycles} Zyklen seit dem letzten Mal",
361 "lifespan": "{item} bei {value}%",
362 },
363 "nl": {
364 "cycle": "{item}, 1 cyclus sinds de vorige keer",
365 "cycles": "{item}, {cycles} cycli sinds de vorige keer",
366 "lifespan": "{item} op {value}%",
367 },
368 "es": {
369 "cycle": "{item}, 1 ciclo desde la última vez",
370 "cycles": "{item}, {cycles} ciclos desde la última vez",
371 "lifespan": "{item} al {value}%",
372 },
373 "fr": {
374 "cycle": "{item}, 1 cycle depuis la dernière fois",
375 "cycles": "{item}, {cycles} cycles depuis la dernière fois",
376 "lifespan": "{item} à {value} %",
377 },
378 "pl": {
379 "cycle": "{item}, 1 cykl od ostatniego razu",
380 "cycles": "{item}, liczba cykli od ostatniego razu: {cycles}",
381 "lifespan": "{item}: {value}%",
382 },
383 "zh": {
384 "cycle": "{item},距上次已 1 个周期",
385 "cycles": "{item},距上次已 {cycles} 个周期",
386 "lifespan": "{item} 剩余 {value}%",
387 },
388 "hi": {
389 "cycle": "{item}, पिछली बार से 1 चक्र",
390 "cycles": "{item}, पिछली बार से {cycles} चक्र",
391 "lifespan": "{item} {value}% पर",
392 },
393}
395# the text of the Android status bar chip, which shows it in full only up to about 7 characters
396PROGRESS_CHIP: Final[str] = "{progress}%"
397# a robot vacuum that has stopped where it is, stuck or lifted, and won't go on by itself, by the language of Home
398# Assistant as for the buttons, English for any other
399STUCK_MESSAGES: Final[dict[str, str]] = {
400 "en": "{name} needs help",
401 "it": "{name} ha bisogno di aiuto",
402 "de": "{name} braucht Hilfe",
403 "nl": "{name} heeft hulp nodig",
404 "es": "{name} necesita ayuda",
405 "fr": "{name} a besoin d'aide",
406 "pl": "{name} potrzebuje pomocy",
407 "zh": "{name} 需要帮助",
408 "hi": "{name} को मदद चाहिए",
409}
410# the title of a Live Activity with a timer, which iOS shows on the Lock Screen in place of the message
411LIVE_TITLE: Final[str] = "{title} · {phase}"
412# how long a cycle ran, in hours and minutes, by the language of Home Assistant as for the buttons, English for any
413# other
414DURATION_HOURS_MINUTES: Final[str] = "hours_minutes"
415DURATION_HOURS: Final[str] = "hours"
416DURATION_MINUTES: Final[str] = "minutes"
417DURATION_FORMATS: Final[dict[str, dict[str, str]]] = {
418 "en": {DURATION_HOURS_MINUTES: "{hours} h {minutes} min", DURATION_HOURS: "{hours} h", DURATION_MINUTES: "{minutes} min"},
419 "it": {DURATION_HOURS_MINUTES: "{hours} h {minutes} min", DURATION_HOURS: "{hours} h", DURATION_MINUTES: "{minutes} min"},
420 "de": {
421 DURATION_HOURS_MINUTES: "{hours} Std. {minutes} Min.",
422 DURATION_HOURS: "{hours} Std.",
423 DURATION_MINUTES: "{minutes} Min.",
424 },
425 "nl": {DURATION_HOURS_MINUTES: "{hours} u {minutes} min", DURATION_HOURS: "{hours} u", DURATION_MINUTES: "{minutes} min"},
426 "es": {DURATION_HOURS_MINUTES: "{hours} h {minutes} min", DURATION_HOURS: "{hours} h", DURATION_MINUTES: "{minutes} min"},
427 "fr": {DURATION_HOURS_MINUTES: "{hours} h {minutes} min", DURATION_HOURS: "{hours} h", DURATION_MINUTES: "{minutes} min"},
428 "pl": {
429 DURATION_HOURS_MINUTES: "{hours} godz. {minutes} min",
430 DURATION_HOURS: "{hours} godz.",
431 DURATION_MINUTES: "{minutes} min",
432 },
433 "zh": {
434 DURATION_HOURS_MINUTES: "{hours}小时{minutes}分钟",
435 DURATION_HOURS: "{hours}小时",
436 DURATION_MINUTES: "{minutes}分钟",
437 },
438 "hi": {
439 DURATION_HOURS_MINUTES: "{hours} घंटे {minutes} मिनट",
440 DURATION_HOURS: "{hours} घंटे",
441 DURATION_MINUTES: "{minutes} मिनट",
442 },
443}
444# between each of the things shown, in the title or the message
445LIVE_SEPARATOR: Final[str] = " · "
446# what an oven up to heat is doing, and how hot it is
447OVEN_MESSAGE: Final[str] = "{program}, {current}{unit}"
448SUPERNOTIFY_PRESENT: Final[str] = "Supernotify is installed, so mobile apps will show a Live Activity for each cycle."
449SUPERNOTIFY_MISSING: Final[str] = (
450 "**Supernotify is not installed.** Only a plain start and end notification can be sent, to every phone with the "
451 "Home Assistant app, with no Live Activity. Install Supernotify from Marketplace for the full experience."
452)
453# an appliance of an integration not yet tried on a real appliance, as it's offered to be added
454BETA_NOTICE: Final[str] = (
455 "\n\n**Support for {integration} is new**, written from the integration's source but not yet tried with a real "
456 "appliance, so notifications may come at the wrong time or not at all. Once its first cycle is over you'll be "
457 "asked how it went."
458)
459BETA_FOUND: Final[str] = " (new, offered to be added)"
461# activities of a robot vacuum, as Home Assistant has them for every make
462VACUUM_CLEANING: Final[str] = "cleaning"
463VACUUM_PAUSED: Final[str] = "paused"
464VACUUM_RETURNING: Final[str] = "returning"
465# back where it started, or stopped by itself, the cleaning being over
466VACUUM_DONE: Final[tuple[str, ...]] = ("docked", "idle")
467VACUUM_ERROR: Final[str] = "error"
468# how long a robot vacuum stays on its dock, having said it was on its way back, before its cleaning is over
469VACUUM_SETTLE: Final[int] = 600
470# how long one stays on its dock having gone straight there from cleaning, as one does part way through to wash its
471# mop or fill its tank, which can take over ten minutes, before its cleaning is over
472VACUUM_MIDWAY_SETTLE: Final[int] = 30 * 60
473VACUUM_MIDWAY_KIND: Final[str] = "midway"
474# seconds after setting off within which being back is taken for an integration that reports a vacuum docked as it
475# leaves, as Ecovacs does each time one sets off again after washing its mop, and keeps to that while it cleans
476VACUUM_BLIP: Final[float] = 5
477VACUUM_BLIP_KIND: Final[str] = "blip"
478# how long such a report is left before the cleaning is taken to be over, with nothing else heard from the vacuum
479VACUUM_BLIP_SETTLE: Final[int] = 3 * 3600
480# how long one stays on its dock once its own progress has reached the end of the cleaning, as Roborock reports it,
481# before its cleaning is over, there being no more to set off again for
482VACUUM_COMPLETE_SETTLE: Final[int] = 30
483VACUUM_COMPLETE_KIND: Final[str] = "complete"
484# seconds either side of setting off within which a running sensor of the vacuum's coming on is taken for its cleaning,
485# as Roborock's Cleaning is, which stays on through a recharge part way through and goes off only once it's over, where
486# its mop drying, also a running sensor, only comes on after
487VACUUM_JOB_LEAD: Final[float] = 60
488# how long one stays on its dock with that still on, recharging to carry on, before its cleaning is over regardless
489VACUUM_HELD_SETTLE: Final[int] = 6 * 3600
490VACUUM_HELD_KIND: Final[str] = "held"
491# translation keys of the enum sensor that says what a vacuum is doing, as Roborock's Status does, sweeping or
492# relocating, which the Live Activity says as it goes as an appliance's stage
493VACUUM_STATUS_KEYS: Final[tuple[str, ...]] = ("status",)
494# translation keys of the select of how a vacuum cleans, as Roborock's Cleaning mode is, vacuuming or mopping or both,
495# which is its program
496VACUUM_PROGRAM_KEYS: Final[tuple[str, ...]] = ("cleaning_mode",)
497# translation keys of a vacuum's progress, as Roborock's Cleaning progress is, which it leaves at 100 from the cleaning
498# before till a moment after setting off
499VACUUM_PROGRESS_KEYS: Final[tuple[str, ...]] = ("clean_percent",)
500# what each entity made use of does, by its translation key as Home Connect has it: the state of the cycle, how far
501# along it is, when it will finish, and the program
502CYCLE_KEY: Final[str] = "operation_state"
503PROGRESS_KEY: Final[str] = "program_progress"
504FINISH_TIME_KEY: Final[str] = "program_finish_time"
505# selects, unlike the others, of the program under way, and of the one chosen, which is all an oven reports
506PROGRAM_KEYS: Final[tuple[str, ...]] = ("active_program", "selected_program")
507# how long is left, as a duration, for an integration that reports no finish time
508REMAINING_TIME_KEY: Final[str] = "remaining_time"
509# how long the cycle takes in all, as a duration, from which its progress is worked out where it reports none
510TOTAL_TIME_KEY: Final[str] = "total_time"
511# or how long it has been going, which with the time left is the same
512ELAPSED_TIME_KEY: Final[str] = "elapsed_time"
513# seconds between updates of progress worked out from the time, there being no change of the appliance's to go by
514PROGRESS_TICK: Final[float] = 60
515# what the appliance is doing within its cycle, such as drying then cooling, which Home Connect doesn't report
516STAGE_KEY: Final[str] = "stage"
517# the same entities as other integrations name them, whichever integration they come from, since it's what an
518# entity does that matters, and which entities an appliance has together
519ROLE_KEYS: Final[dict[str, str]] = {
520 # Samsung washers, dryers and dishwashers, through SmartThings
521 **{f"{kind}_machine_state": CYCLE_KEY for kind in ("washer", "dryer", "dishwasher")},
522 **{f"{kind}_job_state": STAGE_KEY for kind in ("washer", "dryer", "dishwasher")},
523 "completion_time": FINISH_TIME_KEY,
524 # and through LocalThings, on the local network
525 "machine_state": CYCLE_KEY,
526 "progress": STAGE_KEY,
527 "progress_percentage": PROGRESS_KEY,
528 "finish_time": FINISH_TIME_KEY,
529}
530# beginnings of translation keys of an entity named per model
531ROLE_KEY_PREFIXES: Final[dict[str, str]] = {"washer_cycle_table": "selected_program", "dryer_cycle_table": "selected_program"}
532# the type of appliance from the beginning of the translation key of any of its entities, for an integration that
533# names its entities for the type of appliance
534KEY_TYPE_PREFIXES: Final[dict[str, str]] = {"dishwasher_": "dishwasher", "washer_": "washer", "dryer_": "dryer"}
535# an oven warming up has no progress of its own, only how hot it is and how hot it's to be
536TARGET_TEMPERATURE_KEY: Final[str] = "setpoint_temperature"
537CAVITY_TEMPERATURE_KEY: Final[str] = "oven_current_cavity_temperature"
538PREHEAT_FINISHED_KEYS: Final[tuple[str, ...]] = ("preheat_finished", "regular_preheat_finished")
539FAST_PREHEAT_KEY: Final[str] = "fast_pre_heat"
540# domains, by translation key, of each entity of an appliance that's made use of, a program being a select where it
541# can be chosen, and only a sensor where it can't
542ENTITY_DOMAINS: Final[dict[str, tuple[str, ...]]] = {
543 PROGRESS_KEY: ("sensor",),
544 STAGE_KEY: ("sensor",),
545 FINISH_TIME_KEY: ("sensor",),
546 REMAINING_TIME_KEY: ("sensor",),
547 TOTAL_TIME_KEY: ("sensor",),
548 ELAPSED_TIME_KEY: ("sensor",),
549 **dict.fromkeys(PROGRAM_KEYS, ("select", "sensor")),
550 TARGET_TEMPERATURE_KEY: ("number",),
551 CAVITY_TEMPERATURE_KEY: ("sensor",),
552 **dict.fromkeys(PREHEAT_FINISHED_KEYS, ("sensor",)),
553 FAST_PREHEAT_KEY: ("switch",),
554}
555# degrees between Live Activity updates of an oven up to heat, whose temperature never stops wandering
556TEMPERATURE_STEP: Final[float] = 5
557# seconds before an oven saying it's up to heat is believed, since one switched off says so too, just before it's off
558PREHEAT_SETTLE: Final[float] = 3
559# an event sensor is `off` until whatever it tells of has happened
560STATES_EVENT_ON: Final[tuple[str, ...]] = ("present", "confirmed", "on")
562# the states of a cycle, with the words different integrations use for the same thing
563STATES_RUN: Final[tuple[str, ...]] = ("run", "active")
564# a cycle already under way, so not a new start when `run` follows
565STATES_ACTIVE: Final[tuple[str, ...]] = (*STATES_RUN, "pause", "actionrequired")
566# the cycle is over, an oven switched off goes straight from `run` to `inactive` without ever being `finished`
567STATES_FINISHED: Final[tuple[str, ...]] = ("finished", "inactive", "stop")
568# over too unless `run` soon follows, an oven being `ready` for a moment as it starts or has its settings changed
569STATES_SETTLING: Final[tuple[str, ...]] = ("ready", "idle")
570# stages that mean the cycle is over, though the cycle state may stay running a long while after, as a dryer's does
571# while it tumbles its load now and then so it won't crease
572STAGES_FINISHED: Final[tuple[str, ...]] = ("finished", "finish", "wrinkle_prevent", "wrinkle_care", "anti_crease")
573# stages that say nothing of what it's doing
574STAGES_NONE: Final[tuple[str, ...]] = ("none", "idle", "not_running")
575# seconds an appliance is left to settle before the cycle is over
576CYCLE_SETTLE: Final[float] = 10
577# seconds after the cycle starts before it's told of, since an integration may report its program and stage a moment
578# after the state of its cycle, as LocalThings does
579START_SETTLE: Final[float] = 3
580# seconds a Live Activity is left to open before anything more is sent to it, and then only the latest. Until the
581# phone has given Home Assistant the new activity's own token, each update is sent as another start, which leaves a
582# second activity that nothing ends, or is dropped once iOS has had too many starts
583LIVE_SETTLE: Final[float] = 30
584# seconds a quiet Live Activity update waits, and at most, sending only the latest, so what an appliance passes
585# through in moments, as a robot vacuum transitioning between rooms, isn't sent at all
586LIVE_HOLD: Final[float] = 5
587LIVE_HOLD_MAX: Final[float] = 30
588# where a cycle under way is kept through a restart of Home Assistant, one store for each appliance
589CYCLE_STORE: Final[str] = f"{DOMAIN}.cycle.{{entry_id}}"
590CYCLE_STORE_VERSION: Final[int] = 1
591# seconds a change waits to be saved, so a few close together are written once
592CYCLE_SAVE_DELAY: Final[float] = 1
593# hours after which a cycle kept is too old to carry on from, as when Home Assistant has been off since
594CYCLE_KEPT_HOURS: Final[float] = 24
595# the cycle is over without finishing, so the Live Activity goes without an end notification
596STATES_ABANDONED: Final[tuple[str, ...]] = ("error", "aborting")
598# percentage points between Live Activity updates, since mobile platforms throttle frequent ones
599PROGRESS_STEP: Final[int] = 5
600# percentage points between ordinary notifications of progress, where those are asked for
601PROGRESS_NOTIFY_STEP: Final[int] = 10
602# from here on the end is in sight and the bar is being watched, so it's kept closer to the appliance
603PROGRESS_FINAL: Final[int] = 90
604PROGRESS_FINAL_STEP: Final[int] = 2
605# seconds the finish can move before the Live Activity's countdown is put right, more than the minute a remaining
606# time rounds to, so an appliance counting down only has its countdown sent again when it changes its mind
607FINISH_MOVED: Final[float] = 120
609MOBILE_PUSH_TRANSPORT: Final[str] = "mobile_push"
610# Android notification channel of its own, made with sound on the first notification, since a Live Update in the
611# app's default channel arrives without a sound
612ANDROID_CHANNEL: Final[str] = "Appliances"
613# platform of the notify entities used when there's no Supernotify and none have been chosen
614MOBILE_APP_PLATFORM: Final[str] = "mobile_app"
616DEFAULT_ICON: Final[str] = "mdi:progress-clock"
617TYPE_OVEN: Final[str] = "oven"
618# the type of a Home Connect appliance, by how its programs are named
619APPLIANCE_TYPES: Final[dict[str, str]] = {
620 "dishcare_dishwasher_program_": "dishwasher",
621 "laundry_care_washer_program_": "washer",
622 "laundry_care_washer_dryer_program_": "washer_dryer",
623 "laundry_care_dryer_program_": "dryer",
624 "cooking_oven_program_": TYPE_OVEN,
625 "cooking_hob_program_": "hob",
626 "cooking_common_program_hood_": "hood",
627 "consumer_products_coffee_maker_program_": "coffee_maker",
628 "consumer_products_cleaning_robot_program_": "cleaning_robot",
629 "heating_ventilation_air_conditioning_air_conditioner_program_": "air_conditioner",
630}
631TYPE_ICONS: Final[dict[str, str]] = {
632 "dishwasher": "mdi:dishwasher",
633 "washer": "mdi:washing-machine",
634 "washer_dryer": "mdi:washing-machine",
635 "dryer": "mdi:tumble-dryer",
636 TYPE_OVEN: "mdi:stove",
637 "hob": "mdi:pot-steam",
638 "hood": "mdi:fan",
639 "coffee_maker": "mdi:coffee-maker",
640 "cleaning_robot": "mdi:robot-vacuum",
641 "air_conditioner": "mdi:air-conditioner",
642 # types known only from the name
643 "microwave": "mdi:microwave",
644 "kettle": "mdi:kettle",
645}
646# the types whose phases are worth a notification unless it's turned off, an oven up to heat being waited
647# for where a dishwasher starting to rinse isn't
648PHASES_NOTIFIED: Final[tuple[str, ...]] = (TYPE_OVEN,)
649# a power monitor is offered as an appliance when its name says it's one of these, appliances that run in cycles
650# worth being told of, where a kettle or a coffee maker is done in a minute or two
651CYCLE_TYPES: Final[tuple[str, ...]] = ("dishwasher", "washer", "washer_dryer", "dryer", TYPE_OVEN)
652# platforms whose power sensors are estimated or worked out from others, so never the appliance's own measurement,
653# such as the standby draw Powercalc adds to a smart plug's device
654DERIVED_POWER_PLATFORMS: Final[tuple[str, ...]] = (
655 "powercalc",
656 "template",
657 "integration",
658 "utility_meter",
659 "group",
660 "min_max",
661 "statistics",
662 "derivative",
663 "filter",
664)