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 <noreply@anthropic.com>
This commit is contained in:
parent
f5b7c53f18
commit
3235e6293a
1 changed files with 42 additions and 0 deletions
|
|
@ -112,6 +112,38 @@ _SENSOR_CLASSES = {"temperature", "humidity"}
|
||||||
# Binary sensor device_classes we display
|
# Binary sensor device_classes we display
|
||||||
_BINARY_SENSOR_CLASSES = {"door", "window", "motion", "occupancy"}
|
_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
|
# 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"):
|
if state in ("unavailable", "unknown"):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
friendly = _friendly_name(entity)
|
||||||
|
|
||||||
if domain == "light":
|
if domain == "light":
|
||||||
lights.append(_parse_light(entity))
|
lights.append(_parse_light(entity))
|
||||||
|
|
||||||
elif domain == "switch":
|
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))
|
switches.append(_parse_switch(entity))
|
||||||
|
|
||||||
elif domain == "cover":
|
elif domain == "cover":
|
||||||
|
|
@ -190,6 +229,9 @@ async def fetch_ha_data(url: str, token: str) -> Dict[str, Any]:
|
||||||
elif domain == "sensor":
|
elif domain == "sensor":
|
||||||
device_class = attrs.get("device_class", "")
|
device_class = attrs.get("device_class", "")
|
||||||
if device_class in _SENSOR_CLASSES:
|
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))
|
sensors.append(_parse_sensor(entity))
|
||||||
|
|
||||||
elif domain == "binary_sensor":
|
elif domain == "binary_sensor":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue