Skip to content

Commit

Permalink
Add get_all function for every platform to make typing more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
cereal2nd committed Dec 12, 2024
1 parent f1e5b3f commit 3607e46
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion velbusaio/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,36 @@ async def send(self, msg: Message) -> None:
)
)

def get_all(
def get_all_sensor(
self,
) -> list[ButtonCounter | Temperature | LightSensor | SensorNumber]:
return self._get_all("sensor")

def get_all_switch(self) -> list[Relay]:
return self._get_all("switch")

def get_all_binary_sensor(self) -> list[Button]:
return self._get_all("binary_sensor")

def get_all_button(self) -> list[Button | ButtonCounter]:
return self._get_all("button")

def get_all_climate(self) -> list[Temperature]:
return self._get_all("climate")

def get_all_cover(self) -> list[Blind]:
return self._get_all("cover")

def get_all_select(self) -> list[SelectedProgram]:
return self._get_all("select")

def get_all_light(self) -> list[Dimmer]:
return self._get_all("light")

def get_all_led(self) -> list[Button]:
return self._get_all("led")

def _get_all(
self, class_name: str
) -> list[
Blind
Expand Down

0 comments on commit 3607e46

Please sign in to comment.