Skip to content

Commit

Permalink
water sensor bug fix to use deviceType
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjoyg authored Apr 18, 2024
1 parent 662431f commit ed81ca6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dirigera/hub/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)

Expand Down

0 comments on commit ed81ca6

Please sign in to comment.