Unexpected behaviour of toggle button for a script containing a delay

I understand that either an “execute” or a toggle button will be displayed on the Lovelace GUI depending on whether the called script contains a delay or pause action.

And I have such a script which really simply turns on and off a light with a 10 seconds delay in between.

I can use the presented toggle button to run the script and it runs fine, but the toggle does not remain in the on position while the script is running. And while I run the script I see that it’s state remains as On for the appropriate 10 seconds or so.

This doesn’t seem to be the correct behaviour. Am I missing something?

Has anyone else noticed this behaviour?

Same problem here. It used to work but some time ago (months) it broke. Did not register when exactly it broke.

It does work with a reload:

  1. Turn script on with toggle, turns on
  2. Toggle moves to off position after a few seconds automitcally
  3. Reload page
  4. Toggle shows to be on again.

Same works in reverse. If I turn the toggle off, the script turns off but the toggle automatically returns to the on position after a few seconds. Reloading the page show the toggle in the correct (off) position again.

GUI bug?

I guess so… good to hear I’m not the only one!

Also, another thing I’ve noticed: if you create an “entity button” within the lovelace interface to toggle a script, the state of the script (on or off) isn’t reflected in the button’s state, even after a refresh.

So I’m expecting the entity button to go yellow when the button is pushed (and while the script is running) but the colour doesn’t change. Do you find the same?

Have you opened an issue on github?

No I haven’t.
I’ll look into doing that!