From e109763e8fdb90165d949874043c90cbe28cd29d Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Mon, 23 Feb 2026 01:36:33 +0100 Subject: [PATCH] Speedup is_hass_supervisor check --- music_assistant/helpers/util.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/music_assistant/helpers/util.py b/music_assistant/helpers/util.py index 3e849f68..6797f2ab 100644 --- a/music_assistant/helpers/util.py +++ b/music_assistant/helpers/util.py @@ -515,7 +515,12 @@ async def get_package_version(pkg_name: str) -> str | None: async def is_hass_supervisor() -> bool: """Return if we're running inside the HA Supervisor (e.g. HAOS).""" + # Fast path: check for HA supervisor token environment variable + # This is always set when running inside the HA supervisor + if not os.environ.get("SUPERVISOR_TOKEN"): + return False + # Token exists, verify the supervisor is actually reachable def _check() -> bool: try: urllib.request.urlopen("http://supervisor/core", timeout=1) -- 2.34.1