Hello,
I have to create a script with a repeat.
In the repeat 4 things are done.
However, one of these is longer than the others and slows down the “sequential” times of the script.
I thought I’d do something equivalent to this
repeat: 20
Action1
Action2
Action3
if repeatCount%2=0 then do Action4
i.e. perform Action4 once yes and once no (module 2 but I could think of using module 3 or 4 depending on the purpose)
Is there a similar function on HA? Or how can I simulate it?
my current script is
- repeat:
count: '20'
sequence:
- data: {}
entity_id: switch.sonoff_XXXXXXXXXX
service: switch.toggle
- entity_id: switch.sonoff_YYYYYYYYY
service: switch.toggle
- device_id: XYZXYZXYZ
domain: switch
entity_id: switch.test_mss210r_main_channel
type: toggle
- service: notify.alexa_media_echo_dot
data:
message: MESSAGE TO SPEAK
title: Title of message
data:
type: announce
method: spoken
target: media_player.alexa
Can anyone help me to add condition to action 4, or use more complex counter, or… thell me best way!
Thanx