@@ -518,7 +518,6 @@ def appliance_data(self, dev_id):
518518 """
519519 data = {}
520520 search = self ._appliances
521-
522521 if self ._smile_legacy and self .smile_type != "stretch" :
523522 search = self ._domain_objects
524523
@@ -531,6 +530,7 @@ def appliance_data(self, dev_id):
531530 ** DEVICE_MEASUREMENTS ,
532531 ** HEATER_CENTRAL_MEASUREMENTS ,
533532 }.items ()
533+
534534 for measurement , attrs in measurements :
535535
536536 p_locator = (
@@ -565,21 +565,9 @@ def appliance_data(self, dev_id):
565565 if appliance .find (i_locator ) is not None :
566566 name = f"{ measurement } _interval"
567567 measure = appliance .find (i_locator ).text
568-
569568 data [name ] = format_measure (measure , ENERGY_WATT_HOUR )
570569
571- # Adam & Stretches: find relay switch lock state
572- actuator = "actuator_functionalities"
573- func_type = "relay_functionality"
574- if self .smile_type == "stretch" and self .smile_version [1 ].major == 2 :
575- actuator = "actuators"
576- func_type = "relay"
577- appl_class = appliance .find ("type" ).text
578- if appl_class not in ["central_heating_pump" , "valve_actuator" ]:
579- locator = f".//{ actuator } /{ func_type } /lock"
580- if appliance .find (locator ) is not None :
581- measure = appliance .find (locator ).text
582- data ["lock" ] = format_measure (measure , None )
570+ data .update (self .get_lock_state (appliance ))
583571
584572 # Fix for Adam + Anna: heating_state also present under Anna, remove
585573 if "temperature" in data :
@@ -927,3 +915,20 @@ def object_value(self, obj_type, obj_id, measurement):
927915 return val
928916
929917 return None
918+
919+ def get_lock_state (self , xml ):
920+ """Adam & Stretches: find relay switch lock state."""
921+ data = {}
922+ actuator = "actuator_functionalities"
923+ func_type = "relay_functionality"
924+ if self .smile_type == "stretch" and self .smile_version [1 ].major == 2 :
925+ actuator = "actuators"
926+ func_type = "relay"
927+ appl_class = xml .find ("type" ).text
928+ if appl_class not in ["central_heating_pump" , "valve_actuator" ]:
929+ locator = f".//{ actuator } /{ func_type } /lock"
930+ if xml .find (locator ) is not None :
931+ measure = xml .find (locator ).text
932+ data ["lock" ] = format_measure (measure , None )
933+
934+ return data
0 commit comments