Okay, so got some Hue bulbs which every few minutes become unresponsive for between a few seconds and a minute…that’s another problem to sort out and one I’ll be dealing with later.
In the meantime, I have some automation’s that turn these on and off - HOWEVER if they’re unavailable when this runs then they don’t get set, argh!! So trying to overcome that and went down a repeat route in scripts:
As a newbie here is there a better way to achieve this, problems I can see is if someone turns the bulb off physically this script will keep going - to that was considering adding…
…into my while statement (which would effectively I think stop after 5 minutes given the delay in the sequence block.
I guess my question to collective - first time outside of setting something up via YAML as opposed to letting the UI guide me would you suggest I’m on the right road or any other suggestions for a better solution (other than sorting the bulbs out!). Thanks all
Done a bit of ‘tuning’ and switch to the until statement (documentation states “Therefore the sequence will always run at least once” which led me to think the while might not trigger at all when everything is fine); again open to suggestions as to the best way to achieve the desired result:
Please see the most recent version of the docs for the repeat action. That doesn’t look like a properly formatted script. E.g., (assuming that is in your scripts.yaml file) I think it should be:
turn_off_front_room_light:
alias: Turn off front room light
sequence:
repeat:
sequence:
- device_id: 93ac92c00f62404c9b49463acfa5d897
domain: light
entity_id: light.front_room
type: turn_off
- delay: 10
until:
- condition: state
entity_id: light.front_room
state: 'off'
But it might be better to use the “while loop” version so it only delays when it needs to:
Hi @pnbruckner - AWESOME, thanks. It would have probably taken me another week to have got to that point and appreciate the validation I was moving in the right direction!
(I had snipped only a segment of the yaml from scripts regarding you comment about incorrectly formatted - note to self, take the lot next time)