From 3235e6293a6d74916a0e929d48d80b5ed6fdf244 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 2 Mar 2026 19:36:37 +0100 Subject: [PATCH] Filter out Unraid infrastructure entities from HA smart-home view Exclude Docker container power switches, system service switches, VM switches, and hardware monitoring sensors (disk/CPU/GPU temps) from the dashboard. Only show actual smart-home entities. Co-Authored-By: Claude Opus 4.6 --- server/services/ha_service.py | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/server/services/ha_service.py b/server/services/ha_service.py index 06e9f74..2cc402d 100644 --- a/server/services/ha_service.py +++ b/server/services/ha_service.py @@ -112,6 +112,38 @@ _SENSOR_CLASSES = {"temperature", "humidity"} # Binary sensor device_classes we display _BINARY_SENSOR_CLASSES = {"door", "window", "motion", "occupancy"} +# --------------------------------------------------------------------------- +# Filters — exclude Unraid infrastructure entities from the smart-home view. +# Unraid integration exposes Docker containers, system services, VMs, +# disk temps, CPU/GPU temps etc. as HA entities. They clutter the dashboard. +# --------------------------------------------------------------------------- + +# Switches whose friendly_name starts with these are hidden +_SWITCH_EXCLUDE_PREFIXES = ( + "Daddelolymp Docker:", + "Daddelolymp Service:", + "Daddelolymp VM:", + "Daddelolymp Array:", + "Moneyboy Docker:", + "Moneyboy Service:", + "Moneyboy VM:", + "Moneyboy Array:", +) + +# Also exclude exact switch names that are server-level, not smart-home +_SWITCH_EXCLUDE_EXACT = { + "Daddelolymp", + "Moneyboy", +} + +# Sensor friendly_names containing these substrings are hardware, not room sensors +_SENSOR_EXCLUDE_SUBSTRINGS = ( + "System: CPU", + "System: Motherboard", + "Disk:", + "GPU:", +) + # --------------------------------------------------------------------------- # Fetch all entity states @@ -178,10 +210,17 @@ async def fetch_ha_data(url: str, token: str) -> Dict[str, Any]: if state in ("unavailable", "unknown"): continue + friendly = _friendly_name(entity) + if domain == "light": lights.append(_parse_light(entity)) elif domain == "switch": + # Skip Unraid infrastructure switches + if friendly in _SWITCH_EXCLUDE_EXACT: + continue + if any(friendly.startswith(p) for p in _SWITCH_EXCLUDE_PREFIXES): + continue switches.append(_parse_switch(entity)) elif domain == "cover": @@ -190,6 +229,9 @@ async def fetch_ha_data(url: str, token: str) -> Dict[str, Any]: elif domain == "sensor": device_class = attrs.get("device_class", "") if device_class in _SENSOR_CLASSES: + # Skip hardware monitoring sensors (disk/CPU/GPU temps) + if any(sub in friendly for sub in _SENSOR_EXCLUDE_SUBSTRINGS): + continue sensors.append(_parse_sensor(entity)) elif domain == "binary_sensor":