Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

water sensor bug fix to use deviceType #70

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading