Skip to content

Commit 73b2e32

Browse files
committed
Implement similar guarding
1 parent affa950 commit 73b2e32

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

plugwise/helper.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -716,16 +716,18 @@ def _wireless_availability(self, appliance: etree, data: DeviceData) -> None:
716716
Collect the availability-status for wireless connected devices.
717717
"""
718718
if self.smile(ADAM):
719-
# Collect for Plugs
719+
# Try collecting for a Plug
720720
locator = "./logs/interval_log/electricity_interval_meter"
721721
mod_type = "electricity_interval_meter"
722722
module_data = self._get_module_data(appliance, locator, mod_type)
723-
724-
if module_data["reachable"] is None:
725-
# Collect for wireless thermostats
723+
if not module_data["contents"]:
724+
# Try collecting for a wireless thermostat
726725
locator = "./logs/point_log[type='thermostat']/thermostat"
727726
mod_type = "thermostat"
728727
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
729731

730732
if module_data["reachable"] is not None:
731733
data["available"] = module_data["reachable"]

0 commit comments

Comments
 (0)