Not turning lights on based on schedule
This commit is contained in:
parent
966f9aa005
commit
e05f5e204b
1 changed files with 6 additions and 13 deletions
|
@ -185,28 +185,21 @@ def set_light_scene(target_scene: str) -> bool:
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
target_scene (string): Name of the scene to activate.
|
target_scene (string): Name of the scene to activate.
|
||||||
|
|
||||||
Returns:
|
|
||||||
bool: True, if lights are on after calling this function.
|
|
||||||
"""
|
"""
|
||||||
# Are lights on at the moment?
|
|
||||||
light_state = get_light_state()
|
|
||||||
if not light_state:
|
|
||||||
# Lights are off, not doing anything
|
|
||||||
return False
|
|
||||||
|
|
||||||
# Is valid scene?
|
# Is valid scene?
|
||||||
if target_scene is None:
|
if target_scene is None:
|
||||||
return True # Light still on
|
return
|
||||||
|
|
||||||
|
# Are lights on at the moment? Only based on people count for simplicity
|
||||||
|
if peopleCount <= 0:
|
||||||
|
# Lights are probably off, not doing anything
|
||||||
|
return
|
||||||
|
|
||||||
# Set lights to scene
|
# Set lights to scene
|
||||||
hue.set_group_scene(hue_conf['light_group'], target_scene)
|
hue.set_group_scene(hue_conf['light_group'], target_scene)
|
||||||
logging.debug(
|
logging.debug(
|
||||||
f'Light scene set to {target_scene}')
|
f'Light scene set to {target_scene}')
|
||||||
|
|
||||||
# Lights should be on now
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def set_light_state(target_light_state: bool) -> bool:
|
def set_light_state(target_light_state: bool) -> bool:
|
||||||
"""Sets the lights to the given state.
|
"""Sets the lights to the given state.
|
||||||
|
|
Loading…
Reference in a new issue