Skip to content

Commit 6d662ec

Browse files
committed
Update zigbee reachable status
1 parent cf4def7 commit 6d662ec

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

plugwise/data.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,8 @@ def _get_entity_data(self, entity_id: str) -> GwEntityData:
199199
self._check_availability(
200200
entity, "heater_central", data, "no OpenTherm communication"
201201
)
202-
203-
if "module_id" ind entity:
204-
locator = "module/protocolszig_bee_node"
205-
202+
# Zigbee node availability
203+
self._get_zigbee_availability(data, entity)
206204

207205
# Switching groups data
208206
self._entity_switching_group(entity, data)

plugwise/helper.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,14 @@ def _get_measurement_data(self, entity_id: str) -> GwEntityData:
395395

396396
return data
397397

398+
def _get_zigbee_availability(self, data: GwEntityData, entity: GwEntityData) -> GwEntityData:
399+
# Check zigbee device availabilty
400+
if "module_id" in entity:
401+
module_id = entity["module_id"]
402+
locator = f'./module[@id="{module_id}"]/protocols/zig_bee_node'
403+
if (module := self._domain_objects.find(locator)) is not None:
404+
data["available"] = module.find("reachable").text == "true"
405+
398406
def _collect_group_sensors(
399407
self,
400408
data: GwEntityData,

0 commit comments

Comments
 (0)