|
41 | 41 | ActuatorData, |
42 | 42 | ActuatorDataType, |
43 | 43 | ActuatorType, |
44 | | - ApplianceType, |
45 | 44 | BinarySensorType, |
46 | 45 | DeviceData, |
47 | 46 | GatewayData, |
@@ -294,22 +293,7 @@ def _all_appliances(self) -> None: |
294 | 293 | if appl.pwclass in THERMOSTAT_CLASSES and appl.location is None: |
295 | 294 | continue |
296 | 295 |
|
297 | | - self.gw_devices[appl.dev_id] = {"dev_class": appl.pwclass} |
298 | | - self._count += 1 |
299 | | - for key, value in { |
300 | | - "firmware": appl.firmware, |
301 | | - "hardware": appl.hardware, |
302 | | - "location": appl.location, |
303 | | - "mac_address": appl.mac, |
304 | | - "model": appl.model, |
305 | | - "name": appl.name, |
306 | | - "zigbee_mac_address": appl.zigbee_mac, |
307 | | - "vendor": appl.vendor_name, |
308 | | - }.items(): |
309 | | - if value is not None or key == "location": |
310 | | - appl_key = cast(ApplianceType, key) |
311 | | - self.gw_devices[appl.dev_id][appl_key] = value |
312 | | - self._count += 1 |
| 296 | + self._create_gw_devices(appl) |
313 | 297 |
|
314 | 298 | # For P1 collect the connected SmartMeter info |
315 | 299 | if self.smile_type == "power": |
@@ -356,23 +340,7 @@ def _p1_smartmeter_info_finder(self, appl: Munch) -> None: |
356 | 340 | location = self._domain_objects.find(f'./location[@id="{loc_id}"]') |
357 | 341 | appl = self._energy_device_info_finder(appl, location) |
358 | 342 |
|
359 | | - self.gw_devices[appl.dev_id] = {"dev_class": appl.pwclass} |
360 | | - self._count += 1 |
361 | | - |
362 | | - for key, value in { |
363 | | - "firmware": appl.firmware, |
364 | | - "hardware": appl.hardware, |
365 | | - "location": appl.location, |
366 | | - "mac_address": appl.mac, |
367 | | - "model": appl.model, |
368 | | - "name": appl.name, |
369 | | - "zigbee_mac_address": appl.zigbee_mac, |
370 | | - "vendor": appl.vendor_name, |
371 | | - }.items(): |
372 | | - if value is not None or key == "location": |
373 | | - p1_key = cast(ApplianceType, key) |
374 | | - self.gw_devices[appl.dev_id][p1_key] = value |
375 | | - self._count += 1 |
| 343 | + self._create_gw_devices(appl) |
376 | 344 |
|
377 | 345 | def _appliance_info_finder(self, appl: Munch, appliance: etree) -> Munch: |
378 | 346 | """Collect device info (Smile/Stretch, Thermostats, OpenTherm/On-Off): firmware, model and vendor name.""" |
|
0 commit comments