I’ve started using some small scripts, mainly to have a timed light that activates through motion detection.
I have one script that shows in the UI with a switch next to it. All other scripts have an “ACTIVATE” link next to them.
Why is that?
This is the script (called timer_off.yaml - you might recognize it from the examples page…):
alias: 'turn off lamp after set time'
sequence:
- delay:
seconds: 30
- service: light.turn_off
data:
entity_id: light.hifi_rack
Yes thanks, that does make a lot of sense as a standard (and this was slowly but surely driving me crazy; always nice to find the answer in a search). Can’t help wondering though, is there any way to modify this?
@Schneider Well, sort of. What you could do is make a new script, referring to the script with the delay.
In my scripts (below), the “Shut Down Media Center” has a delay, since I’m doing a proper shutdown on a few Raspberry Pi’s, and then cutting the power to a Z-wave switch after they shut down.
BUT! The script “We’re Going to Sleep” activates the “Shutdown Media Center” as part of it. So there are delays in the sequence, but technically not in the “We’re going to sleep” script, and it shows an “activate” instead of a switch.
So my best bet is refer to your “switch” script from within another script, that doesn’t have delays (probably not an elegant way, but it works).