Oh i read infomations change in 0.113. It’s have advanced for coding (Included 4 mode for Automation & Action, and Somes changes in Automation, to fix code can run on 0.113. We need to fix:
In Automation (Change method to Call Script in action)
#(For 0.113 or later)
action:
- service: script.turn_on
entity_id:
- script.flash_gateway1
- script.xiaomi_alarm1
Describe: In 0.112 or previous Version, we call script directly, like below (DONT DO BELOW CODE FOR 0.113 OR LATER)
Action:
- service: script.xiaomi_alarm1
- service: script.flash_gateway1
This mean, after run script.xiaomi_alarm1 done, it will do continue flash_gateway1.
But Script script.xiaomi_alarm1 is a infinity loops. It’s cant be done, and cant continue script flash_gateway1.
In new config we need to call it thourgh on service script turn on
. It’s will run 2 scripts same time (not wait script 1 done (end) and will do script 2).
I don’t known 4 new mode for script and automation, but i try per mode one by one. And Parallel is work. And option max
for Parralel to do maxium loops. I using 90 for sound and 1000 for light. I think it right for me. (depend on you)
In Script (Using Parallel mode)
xiaomi_alarm1:
sequence:
- data:
gw_mac: ####
ringtone_id: 13
ringtone_vol: 50
service: xiaomi_aqara.play_ringtone
- delay:
seconds: 6
- service: script.xiaomi_alarm2
mode: parallel
max: 90
xiaomi_alarm2:
sequence:
- data:
gw_mac: ####
ringtone_id: 13
ringtone_vol: 75
service: xiaomi_aqara.play_ringtone
- delay:
seconds: 6
- service: script.xiaomi_alarm1
mode: parallel
max: 90
flash_gateway1:
alias: Flash Gateway On Red
sequence:
- data:
brightness: 255
color_name: red
entity_id: light.gateway_light_####
service: light.turn_on
- delay:
milliseconds: 600
- data:
entity_id: light.gateway_light_####
service: light.turn_off
- service: script.flash_gateway2
mode: parallel
max: 1000
flash_gateway2:
alias: Flash Gateway On Blue
sequence:
- data:
brightness: 255
color_name: blue
entity_id: light.gateway_light_####
service: light.turn_on
- delay:
milliseconds: 600
- data:
entity_id: light.gateway_light_####
service: light.turn_off
- service: script.flash_gateway1
mode: parallel
max: 1000
And now, it’s work. Thank you very much, @123