MAINT-10 review: warn when HA did not answer and TZ is UTC; test the 3 s budget
HA can take minutes to start (2026-10-05, 502 from the proxy). Then TZ holds, which the Supervisor sets from HA's zone, so the hour stays right; only a TZ of UTC there now logs a WARNING asking for a restart. A test pins the 3 s budget on the zone request (a mutant without it survived). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
0b6b34f563
commit
1d28daf8a0
@@ -7267,6 +7267,10 @@ async def ha_time_zone(session, token: str) -> tuple:
|
||||
return None, f"{type(err).__name__}: {text}" if text else type(err).__name__
|
||||
|
||||
|
||||
_UTC_NAMES = {"UTC", "ETC/UTC", "GMT", "ETC/GMT", "UCT", "ETC/UCT",
|
||||
"UNIVERSAL", "ETC/UNIVERSAL", "ZULU", "ETC/ZULU"}
|
||||
|
||||
|
||||
async def maint_site_tz(session, token: str):
|
||||
"""MAINT-10: the zone the maintenance start hour is read in, logged once."""
|
||||
zone, why = await ha_time_zone(session, token)
|
||||
@@ -7274,6 +7278,12 @@ async def maint_site_tz(session, token: str):
|
||||
if source == "ha":
|
||||
_LOG.info("Maintenance start hour is local time in %s, from Home "
|
||||
"Assistant.", name)
|
||||
elif source == "tz" and name.strip().upper() in _UTC_NAMES:
|
||||
# The Supervisor sets TZ to its copy of HA's zone, or to UTC if it has
|
||||
# none: HA did not answer here, and UTC may not be the site's clock.
|
||||
_LOG.warning("Maintenance start hour uses UTC, because Home Assistant "
|
||||
"did not answer. Restart the add-on when it is up.")
|
||||
_LOG.debug("maintenance time zone: %s", why)
|
||||
elif source == "tz":
|
||||
_LOG.info("Maintenance start hour is local time in %s, from the "
|
||||
"add-on's time zone. Home Assistant gave none: %s.", name, why)
|
||||
|
||||
Reference in New Issue
Block a user