|
47 | 47 | SwitchType, |
48 | 48 | ThermoLoc, |
49 | 49 | ) |
50 | | -from plugwise.util import ( |
51 | | - check_heater_central, |
52 | | - format_measure, |
53 | | - power_data_local_format, |
54 | | - version_to_model, |
55 | | -) |
| 50 | +from plugwise.util import format_measure, power_data_local_format, version_to_model |
56 | 51 |
|
57 | 52 | # This way of importing aiohttp is because of patch/mocking in testing (aiohttp timeouts) |
58 | 53 | from defusedxml import ElementTree as etree |
@@ -203,47 +198,11 @@ def _appliance_info_finder(self, appliance: etree, appl: Munch) -> Munch: |
203 | 198 | """Collect device info (Smile/Stretch, Thermostats, OpenTherm/On-Off): firmware, model and vendor name.""" |
204 | 199 | # Collect thermostat device info |
205 | 200 | if appl.pwclass in THERMOSTAT_CLASSES: |
206 | | - locator = "./logs/point_log[type='thermostat']/thermostat" |
207 | | - mod_type = "thermostat" |
208 | | - module_data = self._get_module_data(appliance, locator, mod_type) |
209 | | - appl.vendor_name = module_data["vendor_name"] |
210 | | - appl.model = module_data["vendor_model"] |
211 | | - appl.hardware = module_data["hardware_version"] |
212 | | - appl.firmware = module_data["firmware_version"] |
213 | | - appl.zigbee_mac = module_data["zigbee_mac_address"] |
214 | | - return appl |
| 201 | + return self._appl_thermostat_info(appliance, appl) |
215 | 202 |
|
216 | 203 | # Collect heater_central device info |
217 | 204 | if appl.pwclass == "heater_central": |
218 | | - # Remove heater_central when no active device present |
219 | | - if not self._opentherm_device and not self._on_off_device: |
220 | | - return None |
221 | | - |
222 | | - # Find the valid heater_central |
223 | | - self._heater_id = check_heater_central(self._appliances) |
224 | | - |
225 | | - # Info for On-Off device |
226 | | - if self._on_off_device: |
227 | | - appl.name = "OnOff" # pragma: no cover |
228 | | - appl.vendor_name = None # pragma: no cover |
229 | | - appl.model = "Unknown" # pragma: no cover |
230 | | - return appl # pragma: no cover |
231 | | - |
232 | | - # Info for OpenTherm device |
233 | | - appl.name = "OpenTherm" |
234 | | - locator1 = "./logs/point_log[type='flame_state']/boiler_state" |
235 | | - locator2 = "./services/boiler_state" |
236 | | - mod_type = "boiler_state" |
237 | | - module_data = self._get_module_data(appliance, locator1, mod_type) |
238 | | - if not module_data["contents"]: |
239 | | - module_data = self._get_module_data(appliance, locator2, mod_type) |
240 | | - appl.vendor_name = module_data["vendor_name"] |
241 | | - appl.hardware = module_data["hardware_version"] |
242 | | - appl.model = module_data["vendor_model"] |
243 | | - if appl.model is None: |
244 | | - appl.model = "Generic heater" |
245 | | - |
246 | | - return appl |
| 205 | + return self._appl_heater_central_info(self._appliances, appliance, appl) |
247 | 206 |
|
248 | 207 | # Collect info from Stretches |
249 | 208 | appl = self._energy_device_info_finder(appliance, appl) |
|
0 commit comments