Automation to flash the lights

I’m trying to setup an automation to alert me when the water sensor gets wet. So far, I have the sensor registered and I can create an automation that says to turn on the lights when the sensor becomes moist for 5 seconds.

First, I tried to setup to “flash” the lights but that didn’t work so I just set it to turn on the lights.

I then created an automation to turn off the lights if the sensor becomes dry.

So far, that works. But, I’m assuming I’m doing this all wrong and it could be combined into one action and also should be able to flash the lights while the sensor is wet.

Also, while I can go into the device for the light and change the color, during the automation setup, I don’t have color as an option to flash. I’m guessing that parameter is not exposed to the automation process. I’m also guessing that if I setup some other type of “custom” entity that has the living room light already red, that I could use that entity to flash.

So please let me know where I’m wrong and what I’m missing. Is there a way to have an automation run while the trigger is still the same? Basically loop until?

Thanks!

If you show the automation it will be easier for people to tell you where you are wrong.

2 Likes

Let me guess, you’re using Device as an action instead of Perform Action, right?

Device actions are quite limited when compared to perform action calls.
All possible Device actions for a light:

type: turn_on
device_id: c6aa2d4414274e86f99490641a7cad8b
entity_id: 2ff5e4cc37a1a0e34df4bc2eced02f51
domain: light
flash: long
brightness_pct: 17

vs all possible Perform Action actions for the same light:

action: light.turn_on
metadata: {}
data:
  transition: 29
  brightness_pct: 17
  effect: blink
  color_name: blue
  color_temp: 180
  brightness: 63
  flash: long
  color_temp_kelvin: 2828
target:
  entity_id: light.kitchen_strip

Yes, you can use a repeat_while/ repeat_until to do that (docs here). Just make sure you add a suitable delay in between each loop, otherwise you’ll flood your system with constant light.turn_on commands.

@fleskefjes Appreciate the advice. I’m guessing you don’t want screen shots so could you point me to the instructions for capturing the correct data to paste in here? Thanks!!

Good guess! Read point #11 here How to help us help you - or How to ask a good question

Yes I believe I am. All of the tutorials I’ve found only showed those types of automation :frowning: Thanks for the other link. I’ll have to do a lot of reading and making mistakes along the way.

Is there a way to trace the automation after it’s created? I’m thinking like single-step debug mode when writing code.

Bad tutorials. Read this - you’ll be thankful later Why and how to avoid device_ids in automations and scripts

It’s not quite single-step debug mode, but it’s close. Click the 3 dots in your automation and check the traces. Here, this doc will bring you up to speed on how to debug Troubleshooting automations - Home Assistant