a couple more questions. that may help @code-in-progress get all the info he needs…
does the physical button have an on-off state of it’s own? (ie, if the light turns on via the dashboard, do you need to turn the phyical light’s state to “on”)? or is that physical button just a press button with no state?
what’s the entity name of that button? i don’t see it in all of the code above.
if it’s a physical toggle button with no state, i’m not clear on why the automation isn’t just triggering off the physical button event and calling toggle.
if it does have state, then perhaps a blueprint like this?