@@ -42,20 +42,6 @@ def smile(self, name: str) -> bool:
4242 """Helper-function checking the smile-name."""
4343 return self .smile_name == name
4444
45- def _appl_thermostat_info (self , appl : Munch , xml_1 : etree , xml_2 : etree = None ) -> Munch :
46- """Helper-function for _appliance_info_finder()."""
47- locator = "./logs/point_log[type='thermostat']/thermostat"
48- mod_type = "thermostat"
49- xml_2 = return_valid (xml_2 , self ._domain_objects )
50- module_data = self ._get_module_data (xml_1 , locator , mod_type , xml_2 )
51- appl .vendor_name = module_data ["vendor_name" ]
52- appl .model = check_model (module_data ["vendor_model" ], appl .vendor_name )
53- appl .hardware = module_data ["hardware_version" ]
54- appl .firmware = module_data ["firmware_version" ]
55- appl .zigbee_mac = module_data ["zigbee_mac_address" ]
56-
57- return appl
58-
5945 def _appl_heater_central_info (
6046 self ,
6147 appl : Munch ,
@@ -103,6 +89,71 @@ def _appl_heater_central_info(
10389
10490 return appl
10591
92+ def _appl_thermostat_info (self , appl : Munch , xml_1 : etree , xml_2 : etree = None ) -> Munch :
93+ """Helper-function for _appliance_info_finder()."""
94+ locator = "./logs/point_log[type='thermostat']/thermostat"
95+ mod_type = "thermostat"
96+ xml_2 = return_valid (xml_2 , self ._domain_objects )
97+ module_data = self ._get_module_data (xml_1 , locator , mod_type , xml_2 )
98+ appl .vendor_name = module_data ["vendor_name" ]
99+ appl .model = check_model (module_data ["vendor_model" ], appl .vendor_name )
100+ appl .hardware = module_data ["hardware_version" ]
101+ appl .firmware = module_data ["firmware_version" ]
102+ appl .zigbee_mac = module_data ["zigbee_mac_address" ]
103+
104+ return appl
105+
106+ def _device_data_switching_group (
107+ self , device : DeviceData , data : DeviceData
108+ ) -> None :
109+ """Helper-function for _get_device_data().
110+
111+ Determine switching group device data.
112+ """
113+ if device ["dev_class" ] in SWITCH_GROUP_TYPES :
114+ counter = 0
115+ for member in device ["members" ]:
116+ if self .gw_devices [member ]["switches" ].get ("relay" ):
117+ counter += 1
118+ data ["switches" ]["relay" ] = counter != 0
119+ self ._count += 1
120+
121+ def _get_group_switches (self ) -> dict [str , DeviceData ]:
122+ """Helper-function for smile.py: get_all_devices().
123+
124+ Collect switching- or pump-group info.
125+ """
126+ switch_groups : dict [str , DeviceData ] = {}
127+ # P1 and Anna don't have switchgroups
128+ if self .smile_type == "power" or self .smile (ANNA ):
129+ return switch_groups
130+
131+ for group in self ._domain_objects .findall ("./group" ):
132+ members : list [str ] = []
133+ group_id = group .attrib ["id" ]
134+ group_name = group .find ("name" ).text
135+ group_type = group .find ("type" ).text
136+ group_appliances = group .findall ("appliances/appliance" )
137+ for item in group_appliances :
138+ # Check if members are not orphaned - stretch
139+ if item .attrib ["id" ] in self .gw_devices :
140+ members .append (item .attrib ["id" ])
141+
142+ if group_type in SWITCH_GROUP_TYPES and members :
143+ switch_groups .update (
144+ {
145+ group_id : {
146+ "dev_class" : group_type ,
147+ "model" : "Switchgroup" ,
148+ "name" : group_name ,
149+ "members" : members ,
150+ },
151+ },
152+ )
153+ self ._count += 4
154+
155+ return switch_groups
156+
106157 def _get_module_data (
107158 self ,
108159 xml_1 : etree ,
@@ -158,42 +209,6 @@ def _get_zigbee_data(self, module: etree, model_data: ModelData, legacy: bool) -
158209 model_data ["zigbee_mac_address" ] = zb_node .find ("mac_address" ).text
159210 model_data ["reachable" ] = zb_node .find ("reachable" ).text == "true"
160211
161- def _get_group_switches (self ) -> dict [str , DeviceData ]:
162- """Helper-function for smile.py: get_all_devices().
163-
164- Collect switching- or pump-group info.
165- """
166- switch_groups : dict [str , DeviceData ] = {}
167- # P1 and Anna don't have switchgroups
168- if self .smile_type == "power" or self .smile (ANNA ):
169- return switch_groups
170-
171- for group in self ._domain_objects .findall ("./group" ):
172- members : list [str ] = []
173- group_id = group .attrib ["id" ]
174- group_name = group .find ("name" ).text
175- group_type = group .find ("type" ).text
176- group_appliances = group .findall ("appliances/appliance" )
177- for item in group_appliances :
178- # Check if members are not orphaned - stretch
179- if item .attrib ["id" ] in self .gw_devices :
180- members .append (item .attrib ["id" ])
181-
182- if group_type in SWITCH_GROUP_TYPES and members :
183- switch_groups .update (
184- {
185- group_id : {
186- "dev_class" : group_type ,
187- "model" : "Switchgroup" ,
188- "name" : group_name ,
189- "members" : members ,
190- },
191- },
192- )
193- self ._count += 4
194-
195- return switch_groups
196-
197212 def _power_data_energy_diff (
198213 self ,
199214 measurement : str ,
@@ -224,18 +239,3 @@ def _power_data_energy_diff(
224239 direct_data ["sensors" ][net_string ] = tmp_val
225240
226241 return direct_data
227-
228- def _device_data_switching_group (
229- self , device : DeviceData , data : DeviceData
230- ) -> None :
231- """Helper-function for _get_device_data().
232-
233- Determine switching group device data.
234- """
235- if device ["dev_class" ] in SWITCH_GROUP_TYPES :
236- counter = 0
237- for member in device ["members" ]:
238- if self .gw_devices [member ]["switches" ].get ("relay" ):
239- counter += 1
240- data ["switches" ]["relay" ] = counter != 0
241- self ._count += 1
0 commit comments