Filter room management maintenance actions
Some checks failed
quality / test (3.11) (push) Has been cancelled
quality / test (3.13) (push) Has been cancelled

This commit is contained in:
2026-07-26 23:18:19 +02:00
parent 1788f9d963
commit 81b2327e84
5 changed files with 48 additions and 3 deletions

View File

@@ -604,6 +604,8 @@ def room_management_overview(request: Request) -> RoomManagementOverview:
actuator = entities.get(entity_id)
if actuator is None:
continue
if not _is_management_actuator(actuator):
continue
room = _entity_room(actuator)
if room not in rooms:
rooms[room] = RoomManagementGroup(room=room, actuator_count=0)
@@ -1151,6 +1153,41 @@ def _entity_room(entity: HaEntitySummary) -> str:
return room or "Ohne Raum"
def _is_management_actuator(entity: HaEntitySummary) -> bool:
if entity.domain not in {
"climate",
"cover",
"fan",
"humidifier",
"input_boolean",
"light",
"lock",
"number",
"scene",
"siren",
"switch",
"valve",
}:
return False
text = " ".join(
str(value).lower().replace("_", " ")
for value in [entity.entity_id, entity.friendly_name, entity.device_name]
if value
)
noisy_tokens = {
"battery replaced",
"identify",
"ping",
"reboot",
"reload",
"restart",
"wake on lan",
}
if any(token in text for token in noisy_tokens):
return False
return True
def _room_from_text(value: str) -> str | None:
normalized = value.replace("_", " ").replace("-", " ").strip()
if not normalized:

View File

@@ -117,7 +117,7 @@ async def lifespan(app: FastAPI) -> AsyncIterator[None]:
app = FastAPI(
title="SillyHome Next API",
description="Lokales Smart-Home-Intelligenzsystem für Home Assistant.",
version="1.7.7",
version="1.7.8",
lifespan=lifespan,
)
app.state.settings = load_settings()