Hi,
I’m pretty new to Scripting in HASS.
I think I have a problem with my script. I try to automate a power switch ON when my phone drop down 55% battery and power switch OFF when above 95%
Yes.
The power switch is in my desk and all my desk is in an other switch who power on when my computer is awake.
Somes times, I power my desk and my phone is above this 55% and automation not start.
I think was @123 is saying is that a script will never execute on its own… it has no triggers.
You can call that script from an automation, or move the script code wholy into an automation and do it that way.
It’s possible that you have misunderstood the meaning of mode: restart. All of the modes are explained here:
The mode you selected (restart) means that if you run the script and then try to run it again while the script is still running, it will stop the running script and run it again from the beginning.
There’s almost no chance of that happening for your script because it executes in less than a second.
From the documentation:
mode string (optional, default: single)
Controls what happens when script is invoked while it is still running from one or more previous invocations. See Script Modes.
restart Start a new run after first stopping previous run.