Skip to content

Commit

Permalink
Remove which from find_switch_for_lights
Browse files Browse the repository at this point in the history
  • Loading branch information
basnijholt committed Jul 21, 2023
1 parent b281c43 commit e31c590
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions custom_components/adaptive_lighting/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,22 +295,9 @@ class NoSwitchFoundError(ValueError):
def find_switch_for_lights(
hass: HomeAssistant,
lights: list[str],
which: Literal["brightness", "color", "both"] | None = None,
) -> AdaptiveSwitch:
"""Find the switch that controls the lights in 'lights'."""
switches = _get_switches_with_lights(hass, lights)
if which is None:
pass
elif which == "both":
switches = [
s
for s in switches
if s.adapt_color_switch.is_on and s.adapt_brightness_switch.is_on
]
elif which == "color":
switches = [s for s in switches if s.adapt_color_switch.is_on]
elif which == "brightness":
switches = [s for s in switches if s.adapt_brightness_switch.is_on]

if len(switches) == 1:
return switches[0]
Expand Down

0 comments on commit e31c590

Please sign in to comment.