Hi all.
I’m new to this and blown away by the knowledge of this community, and the support of the more experienced! I’m hoping you can help me set something up.
Scenario
I have a motion sensor on our landing. If it detects motion during the day I want it to turn on the lights in 3 bedrooms (easy enough). But… I want it to leave out one bedroom if our baby is in bed. I have set up a boolean that switches based on a Hue Tap in his room - if we turn on his nightlight it sets the state to On. Any other button sets it to off.
Methodology
I’ve considered the following:
- Write 2 scripts - one that turns on all rooms, one that omits his room. Use the boolean in an automation to determine which script to run. I think I could do this myself, but it feels clunky…
- Write 1 script that includes an {%if} statement to decide whether to turn on his lights or not. I’m not sure how to begin to put this in.
Here’s what I’ve got so far
bedroom_lights_daytime:
sequence:
- service: hue.hue_activate_scene
data:
group_name: child_1_room
scene_name: Daytime
- service: hue.hue_activate_scene
data:
group_name: child_2_room
scene_name: Daytime
- service: hue.hue_activate_scene
data:
group_name: child_3_room
scene_name: Daytime
- delay:
hours: 0
minutes: 3
seconds: 0
milliseconds: 0
- device_id: randomstuff
domain: light
entity_id: light.child_1_pendant
type: brightness_decrease
- device_id: randomstuff
domain: light
entity_id: light.child_2_pendant
type: brightness_decrease
- device_id: randomstuff
domain: light
entity_id: light.child_3_pendant
type: brightness_decrease
- delay:
hours: 0
minutes: 0
seconds: 30
milliseconds: 0
- service: light.turn_off
target:
area_id:
- child_1_room
- child_2_room
- child_3_room
data:
transition: 5
mode: restart
I guess what I’m looking to do is this:
scene_name: Daytime
{% if is_state('input_boolean.is_child_3_in_bed', 'off') %}
- service: hue.hue_activate_scene
data:
group_name: child_3_room
scene_name: Daytime
{% endif %}
- delay:
But I don’t know how to actually code it to make it work. Any assistance would be greatly appreciated!