Detect a state that didn’t change

Hello, is there any way to detect an event of a device where the state didn’t change?

I have a switch that can be turned on and off but I would like to have a trigger if it is set to on, even if it already is on. Is that possible in some way?

I want to use a Nexa wall transmitter as a volume control for media players. I was thinking to have ”on”-presses as turning up volume and ”off”-presses to turn down volume. But I cannot detect the ”on”-press if it is already on.

Maybe

You could use a state trigger without from or to - then it’ll trigger if any attribute changes too

You could then to a template condition that checks that {{ trigger.from_state.state == trigger.to_state.state }} and other condition checks to rule out any other attribute changes that could have caused the trigger.

This seemed to work at first. The automation was triggered when the switch was turned on even if it was on already. Then when I started to work with the data template it stopped working and now it only triggers if the state really changes from on to off or the other way around. Is it supposed to be triggered even though the state doesn’t change? What could be wrong then? Otherwise I was thinking of setting the switch to an ”idle”-state after it was triggered to detect all state changes.

If the trigger has no to: or from: then it’ll update when anything changes, but something has to change.