I am always so close. I have an automation using the chose statement and I want a different action depending on whether a switch is on or off. The automation works fine when I remove the “for:” criteria. But I only want the automation to trigger when the switch is on for 30 minutes . Thanks in advance
I am getting this error:
Invalid config for [automation]: [to] is an invalid option for [automation]. Check: automation->condition->0->conditions->0->to.
Commenting it out works
entity_id: switch.spiral
state: 'on'
# for:
# minutes: 30
I also tried but no luck :
to: "on"
for: "00:30:00"
alias: kidinbed
trigger:
- platform: state
entity_id: switch.spiral
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: switch.spiral
state: 'on'
for:
minutes: 1
sequence:
- service: input_boolean.turn_on
entity_id: input_boolean.kidsleepmode
- service: switch.turn_on
entity_id: switch.adaptive_lighting_sleep_mode_kid_adaptive
- service: tts.google_say
data_template:
entity_id: media_player.dinning_room_speaker
message: kid is now in Bed
- service: homeassistant.turn_on
entity_id: light.notificationlights
data:
brightness: 30
rgb_color:
- 0
- 0
- 255
- delay: 00:00:15
- service: homeassistant.turn_off
entity_id: light.notificationlights
- conditions:
- condition: state
entity_id: switch.spiral
state: 'off'
- condition: state
entity_id: input_boolean.kidsleepmode
state: 'on'
sequence:
- service: input_boolean.turn_off
entity_id: input_boolean.kidsleepmode
- service: tts.google_say
data_template:
entity_id: media_player.dinning_room_speaker
message: kid is Up
- service: homeassistant.turn_on
entity_id: light.notificationlights
data:
brightness: 255
rgb_color:
- 255
- 0
- 0
- service: xiaomi_aqara.play_ringtone
data:
gw_mac: 7811DCFD69DF
ringtone_id: 10001
ringtone_vol: 100
- delay: 00:00:58
- service: homeassistant.turn_off
entity_id: light.notificationlights
- delay: 00:02:00
- service: switch.turn_off
entity_id: switch.adaptive_lighting_sleep_mode_kid_adapt
mode: restart