I setup a switch to trigger this automation. I’ve been trying some ai yaml editors and even hired someone on fiver, but can’t seem to get this to work. When the switch is on - it turns on the light and the first effect, but doesn’t change. Maybe random isn’t possible and I should try a list of effects instead?
Yaml code:
alias: Cloud Animation
description: >-
Turns on a light with a random effect every 2 minutes while the switch is on.
Turns off light when switch turns off.
triggers:
- entity_id: input_boolean.cloud_ceiling
to: “on”
trigger: state
actions: - repeat:
while:
- condition: state
entity_id: input_boolean.cloud_ceiling
state: “on”
for:
hours: 0
minutes: 0
seconds: 1
sequence:
- action: light.turn_on
metadata: {}
data:
effect: >-
{{ [‘music-separation’, ‘music- piano keys’, ‘music- hopping’,
‘music -fountatain’, ‘music - rythem’] | random }}
target:
entity_id: light.cloud_ceiling
enabled: true
- delay: “00:02:00” - target:
entity_id: light.cloud_ceiling
action: light.turn_off
data: {}
enabled: true
mode: restart
4 posts - 2 participants