Skip to content

Commit

Permalink
Update hub.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjoyg authored Apr 3, 2024
1 parent f934924 commit 3ce4de3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/dirigera/hub/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def get_air_purifier_by_id(self, id_: str) -> AirPurifier:
if air_purifier_device["deviceType"] != "airPurifier":
raise ValueError("Device is not an Air Purifier")
return dict_to_air_purifier(air_purifier_device, self)

def get_lights(self) -> List[Light]:
"""
Fetches all lights registered in the Hub
Expand Down Expand Up @@ -203,7 +203,7 @@ def get_environment_sensor_by_id(self, id_: str) -> EnvironmentSensor:
if environment_sensor["deviceType"] != "environmentSensor":
raise ValueError("Device is not an EnvironmentSensor")
return dict_to_environment_sensor(environment_sensor, self)

def get_motion_sensors(self) -> List[MotionSensor]:
"""
Fetches all motion sensors registered in the Hub
Expand All @@ -217,7 +217,7 @@ def get_motion_sensor_by_id(self, id_: str) -> MotionSensor:
if motion_sensor["deviceType"] != "motionSensor":
raise ValueError("Device is not an MotionSensor")
return dict_to_motion_sensor(motion_sensor, self)

def get_open_close_sensors(self) -> List[OpenCloseSensor]:
"""
Fetches all open/close sensors registered in the Hub
Expand All @@ -231,7 +231,7 @@ def get_open_close_by_id(self, id_: str) -> OpenCloseSensor:
if open_close_sensor["deviceType"] != "openCloseSensor":
raise ValueError("Device is not an OpenCloseSensor")
return dict_to_open_close_sensor(open_close_sensor, self)

def get_blinds(self) -> List[Blind]:
"""
Fetches all blinds registered in the Hub
Expand All @@ -249,13 +249,13 @@ def get_blind_by_name(self, blind_name: str) -> Blind:
if len(blinds) == 0:
raise AssertionError(f"No blind found with name {blind_name}")
return blinds[0]

def get_blinds_by_id(self, id_: str) -> Blind:
blind_sensor = self._get_device_data_by_id(id_)
if blind_sensor["deviceType"] != "blinds":
raise ValueError("Device is not a Blind")
return dict_to_blind(blind_sensor, self)

def get_controllers(self) -> List[Controller]:
"""
Fetches all controllers registered in the Hub
Expand Down

0 comments on commit 3ce4de3

Please sign in to comment.