Hi,
I would like to flash several lights in case of flooding.
I created the first automation that invokes a script.
This procedure works, but I have 2 problems.
The first is that in addition to some lights identified as “device” I also have some sonoff switches identified as “entity”.
The second is that I would like to flash several lights simultaneously throughout the house (where possible by changing the color to signal a problem).
As long as I flashed only one device, I had no problems.
When I tried to flash multiple object together, the script no longer worked well. For sure the problem is in the script: I m not very practical.
Also, I take this opportunity to ask if you can recommend me a good guide to learn the scripting language from scratch: Indentation and command grouping are still unknown to me in yaml.
Someone told me that they are also some nice plugin to edit online in homeassistant script yaml.
- id: 'XXXXXXXXXXXXX'
alias: flooding
description: blinks some lights in case of flooding
trigger:
- device_id: XXXXXXXXXXX
domain: binary_sensor
entity_id: binary_sensor.shelly_shwt_1_XXXXXXXX_flood
platform: device
type: turned_on
condition: []
action:
- data: {}
entity_id: script.lightloop
service: script.turn_on
mode: single
--------------------
lightloop:
alias: LightLoop
mode: single
sequence:
- repeat:
count: 20
sequence:
- device_id: XXXXXXXXXXXXXX
domain: light
entity_id: light.cucina_ambient_msl120b_main_channel
type: toggle <- Ok so far, it doesn't work well below
- service: switch.turn_on
data:
entity_id: switch.sonoff_YYYYYYYY
- service: switch.turn_off
data:
entity_id: switch.sonoff_YYYYYYYYY
I know also that I can create many scripts and run them simultaneously? What is best way?