Check if heat area exists when setting up valve opening and battery sensors in moehlenhoff alpha2 (#105437)

Check whether the referenced heat area exists

when setting up valve opening and battery sensors
This commit is contained in:
Jan Schneider 2023-12-10 23:59:54 +01:00 committed by Franck Nijhof
parent 84c713894b
commit a0e9772f52
No known key found for this signature in database
GPG key ID: D62583BA8AB11CA3
2 changed files with 2 additions and 1 deletions

View file

@ -27,6 +27,7 @@ async def async_setup_entry(
Alpha2IODeviceBatterySensor(coordinator, io_device_id)
for io_device_id, io_device in coordinator.data["io_devices"].items()
if io_device["_HEATAREA_ID"]
and io_device["_HEATAREA_ID"] in coordinator.data["heat_areas"]
)

View file

@ -25,7 +25,7 @@ async def async_setup_entry(
Alpha2HeatControlValveOpeningSensor(coordinator, heat_control_id)
for heat_control_id, heat_control in coordinator.data["heat_controls"].items()
if heat_control["INUSE"]
and heat_control["_HEATAREA_ID"]
and heat_control["_HEATAREA_ID"] in coordinator.data["heat_areas"]
and heat_control.get("ACTOR_PERCENT") is not None
)