Set a new template for light

Sorry for the late response.

Here is the code.
I toggled the switch several times, but only 2 events have been locked

1 Like

do you have any idea?

Did you connect the switch entity where the “button” was connected in the above flow? It should work as is.