From bd5cbecc5f98f0afea2266e131863189e951ac42 Mon Sep 17 00:00:00 2001 From: Sanjoy Ghosh Date: Fri, 19 Apr 2024 01:39:17 +0530 Subject: [PATCH] water sensor bug fix to use deviceType (#70) --- src/dirigera/hub/hub.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dirigera/hub/hub.py b/src/dirigera/hub/hub.py index 9dd52b5..630de58 100644 --- a/src/dirigera/hub/hub.py +++ b/src/dirigera/hub/hub.py @@ -348,7 +348,7 @@ def get_water_sensors(self) -> List[WaterSensor]: Fetches all water sensors registered in the Hub """ devices = self.get("/devices") - water_sensors = list(filter(lambda x: x["type"] == "waterSensor", devices)) + water_sensors = list(filter(lambda x: x["deviceType"] == "waterSensor", devices)) return [dict_to_water_sensor(water_sensor, self) for water_sensor in water_sensors] def get_water_sensor_by_id(self, id_: str) -> WaterSensor: @@ -357,7 +357,7 @@ def get_water_sensor_by_id(self, id_: str) -> WaterSensor: if that water sensors does not exist or is a device of another type raises ValueError """ water_sensor = self._get_device_data_by_id(id_) - if water_sensor["type"] != "waterSensor": + if water_sensor["deviceType"] != "waterSensor": raise ValueError("Device is not a WaterSensor") return dict_to_water_sensor(water_sensor, self)