Automation not triggering on update

I have an issue with my automations for my hue dimmer switch. No matter what I do I can’t get the automation to trigger if the state is only updated, not changed.
Here is my code for the first button:
- alias: hue_dimmer_switch_1_click
- entity_id: sensor.hue_dimmer_switch
platform: state
to: ‘1_click’
- service: light.turn_on
entity_id: light.hall

And the sensor is the sensor.

I’ve checked both the Hue REST API and the state of the sensor in home assistant and they all get updated properly but for some reason, the automation is only triggered if the previous state is NOT ‘1_click’.
Anyone got a clue what could be wrong?

Does the state of sensor.hue_dimmer_switch return change to anything other than ‘1_click’ after ‘1_click’ is performed?

Not sure if I understand you completely but as long as the previous state is not the state I’m “moving” to everything works as intended. I.e. if the last press was ‘2_click’ and I then press ‘1_click’ the automation is triggered correctly.

Right, but if you click ‘1_click’, then click ‘1_click’ again, home assistant doesn’t see that because the state of your sensor doesn’t change…

But the sensor says it has been updated, i.e. latest update timestamp changes.
Shouldn’t that be enough? And if not, how do I fix it?

Turn on debugging in logger and see if the event is being seen. If it is, then you should be good. If not, then you need to come up with another solution.