Further filter technical switches (child locks, LED indicators, permit join)

Removes child lock toggles, motion sensor LED indicators, and
Zigbee2MQTT permit join from the smart-home dashboard view.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sam 2026-03-02 19:40:25 +01:00
parent 3235e6293a
commit 0d68933b85

View file

@ -136,6 +136,14 @@ _SWITCH_EXCLUDE_EXACT = {
"Moneyboy", "Moneyboy",
} }
# Switches whose friendly_name contains these substrings are technical settings
_SWITCH_EXCLUDE_SUBSTRINGS = (
"Child lock",
"Led indication",
"Indicator",
"Permit join",
)
# Sensor friendly_names containing these substrings are hardware, not room sensors # Sensor friendly_names containing these substrings are hardware, not room sensors
_SENSOR_EXCLUDE_SUBSTRINGS = ( _SENSOR_EXCLUDE_SUBSTRINGS = (
"System: CPU", "System: CPU",
@ -216,11 +224,13 @@ async def fetch_ha_data(url: str, token: str) -> Dict[str, Any]:
lights.append(_parse_light(entity)) lights.append(_parse_light(entity))
elif domain == "switch": elif domain == "switch":
# Skip Unraid infrastructure switches # Skip Unraid infrastructure switches + technical settings
if friendly in _SWITCH_EXCLUDE_EXACT: if friendly in _SWITCH_EXCLUDE_EXACT:
continue continue
if any(friendly.startswith(p) for p in _SWITCH_EXCLUDE_PREFIXES): if any(friendly.startswith(p) for p in _SWITCH_EXCLUDE_PREFIXES):
continue continue
if any(sub in friendly for sub in _SWITCH_EXCLUDE_SUBSTRINGS):
continue
switches.append(_parse_switch(entity)) switches.append(_parse_switch(entity))
elif domain == "cover": elif domain == "cover":