2 function in automation drops sync

I have an Input.boolean toggle button. In an automation I have this input boolean toggle 2 light sources. This thing works, but will drop sync after a few toggles. Then the toggle button shows ON but light sources are OFF.

How can I make a button call the OFF state when toggle is OFF, and ON state when it’s ON. When I test this I can only call ONE function with ONE button. I don’t want to have 2 buttons to make this work. (one button for OFF, and one button for ON)

Welcome to the community, johla83!

I suspect your automation mode. Please post your code using the code tag function (cog icon —> pre-formatted code).

Make a template switch and ditch the input_boolean (Harder). Or make a light group via the UI (Easier). Both will net you a single entity that turns on/off 2 entities. Neither will get out of sync.