File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff 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 )
Original file line number Diff line number Diff 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 ,
You can’t perform that action at this time.
0 commit comments