|
24 | 24 | LIMITS, |
25 | 25 | LOCATIONS, |
26 | 26 | LOGGER, |
| 27 | + MODULE_LOCATOR, |
27 | 28 | NONE, |
28 | 29 | OFF, |
29 | 30 | P1_MEASUREMENTS, |
@@ -299,6 +300,7 @@ def _all_appliances(self) -> None: |
299 | 300 | if appl.pwclass in THERMOSTAT_CLASSES and appl.location is None: |
300 | 301 | continue |
301 | 302 |
|
| 303 | + appl.available = None |
302 | 304 | appl.dev_id = appliance.attrib["id"] |
303 | 305 | appl.name = appliance.find("name").text |
304 | 306 | appl.model = None |
@@ -356,9 +358,8 @@ def _p1_smartmeter_info_finder(self, appl: Munch) -> None: |
356 | 358 | """Collect P1 DSMR SmartMeter info.""" |
357 | 359 | loc_id = next(iter(self.loc_data.keys())) |
358 | 360 | location = self._domain_objects.find(f'./location[@id="{loc_id}"]') |
359 | | - locator = "./logs/point_log/electricity_point_meter" |
360 | | - mod_type = "electricity_point_meter" |
361 | | - module_data = self._get_module_data(location, locator, mod_type) |
| 361 | + locator = MODULE_LOCATOR |
| 362 | + module_data = self._get_module_data(location, locator) |
362 | 363 | if not module_data["contents"]: |
363 | 364 | LOGGER.error("No module data found for SmartMeter") # pragma: no cover |
364 | 365 | return None # pragma: no cover |
@@ -396,13 +397,13 @@ def _appliance_info_finder(self, appl: Munch, appliance: etree) -> Munch: |
396 | 397 | return appl |
397 | 398 | case _ as s if s.endswith("_plug"): |
398 | 399 | # Collect info from plug-types (Plug, Aqara Smart Plug) |
399 | | - locator = "./logs/interval_log/electricity_interval_meter" |
400 | | - mod_type = "electricity_interval_meter" |
401 | | - module_data = self._get_module_data(appliance, locator, mod_type) |
| 400 | + locator = MODULE_LOCATOR |
| 401 | + module_data = self._get_module_data(appliance, locator) |
402 | 402 | # A plug without module-data is orphaned/ no present |
403 | 403 | if not module_data["contents"]: |
404 | 404 | return Munch() |
405 | 405 |
|
| 406 | + appl.available = module_data["reachable"] |
406 | 407 | appl.firmware = module_data["firmware_version"] |
407 | 408 | appl.hardware = module_data["hardware_version"] |
408 | 409 | appl.model_id = module_data["vendor_model"] |
@@ -515,9 +516,6 @@ def _get_measurement_data(self, dev_id: str) -> DeviceData: |
515 | 516 | if appliance.find("type").text in ACTUATOR_CLASSES: |
516 | 517 | self._get_actuator_functionalities(appliance, device, data) |
517 | 518 |
|
518 | | - # Collect availability-status for wireless connected devices to Adam |
519 | | - self._wireless_availability(appliance, data) |
520 | | - |
521 | 519 | if dev_id == self.gateway_id and self.smile(ADAM): |
522 | 520 | self._get_regulation_mode(appliance, data) |
523 | 521 | self._get_gateway_mode(appliance, data) |
@@ -710,29 +708,6 @@ def _get_actuator_functionalities( |
710 | 708 | act_item = cast(ActuatorType, item) |
711 | 709 | data[act_item] = temp_dict |
712 | 710 |
|
713 | | - def _wireless_availability(self, appliance: etree, data: DeviceData) -> None: |
714 | | - """Helper-function for _get_measurement_data(). |
715 | | -
|
716 | | - Collect the availability-status for wireless connected devices. |
717 | | - """ |
718 | | - if self.smile(ADAM): |
719 | | - # Try collecting for a Plug |
720 | | - locator = "./logs/interval_log/electricity_interval_meter" |
721 | | - mod_type = "electricity_interval_meter" |
722 | | - module_data = self._get_module_data(appliance, locator, mod_type) |
723 | | - if not module_data["contents"]: |
724 | | - # Try collecting for a wireless thermostat |
725 | | - locator = "./logs/point_log[type='thermostat']/thermostat" |
726 | | - mod_type = "thermostat" |
727 | | - module_data = self._get_module_data(appliance, locator, mod_type) |
728 | | - if not module_data["contents"]: |
729 | | - LOGGER.error("No module data found for Plug or wireless thermostat") # pragma: no cover |
730 | | - return None # pragma: no cover |
731 | | - |
732 | | - if module_data["reachable"] is not None: |
733 | | - data["available"] = module_data["reachable"] |
734 | | - self._count += 1 |
735 | | - |
736 | 711 | def _get_regulation_mode(self, appliance: etree, data: DeviceData) -> None: |
737 | 712 | """Helper-function for _get_measurement_data(). |
738 | 713 |
|
|
0 commit comments