integrate heating rule fix and quality workflow
Some checks failed
Quality / test (push) Has been cancelled

This commit is contained in:
2026-06-10 21:59:38 +02:00
parent 29ec53cc5e
commit 1cb2630cec
6 changed files with 130 additions and 7 deletions

View File

@@ -6,10 +6,26 @@ from app.ha.models import HaEntitySummary
from app.rules.recommender import Rule
HEATING_SENSOR_DEVICE_CLASSES = frozenset({"temperature", "humidity"})
HEATING_BINARY_SENSOR_DEVICE_CLASSES = frozenset({"occupancy", "presence"})
class HeatingRule(Rule):
def matches(self, entities: Sequence[HaEntitySummary]) -> bool:
domains = {item.domain for item in entities}
return "climate" in domains or "sensor" in domains
for entity in entities:
if entity.domain == "climate":
return True
if (
entity.domain == "sensor"
and entity.device_class in HEATING_SENSOR_DEVICE_CLASSES
):
return True
if (
entity.domain == "binary_sensor"
and entity.device_class in HEATING_BINARY_SENSOR_DEVICE_CLASSES
):
return True
return False
def recommendation(self, entities: Sequence[HaEntitySummary]) -> str:
return "Prüfe Heizungsregelung: Aktiviere energiesparenden Modus bei Abwesenheit."
return "Prüfe Heizungsregelung: Aktiviere energiesparenden Modus bei Abwesenheit."