mirror of
https://github.com/GeorgeSG/lovelace-time-picker-card.git
synced 2026-11-03 11:48:45 +00:00
Guard against a hass without formatEntityName
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
547b34e85a
commit
64b83101dd
@@ -12,6 +12,12 @@ function atLeastVersion(hass: HomeAssistant, major: number, minor: number): bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
function supportsEntityNames(hass: HomeAssistant): boolean {
|
function supportsEntityNames(hass: HomeAssistant): boolean {
|
||||||
|
// A hass can report a recent version without carrying the helper (a test
|
||||||
|
// harness, or a hass that has not finished initialising), and calling it
|
||||||
|
// then throws - so the version gate alone is not enough.
|
||||||
|
if (!hass || typeof (hass as { formatEntityName?: unknown }).formatEntityName !== 'function') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return atLeastVersion(hass, 2026, 4);
|
return atLeastVersion(hass, 2026, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user