On_state and on_click in one binary_sensor


I’m trying to get into Esphome with a dimmer, this one. (QS-WiFi-D01-TRIAC 150W Dimmer)
Since I have rocker switches I need to use on_state to identify the state change and toggle the light. So far so good.

Then I decided I would like to use on_click to put the dimmer into a dimming mode in which the light goes dim and bright in a loop. When the desired level is reached do another on_click and it should retain that level of brightness.

My problem so far is this: when I do on_click there is ofcourse always an on_state. How can I do an on_click without doing an on_state in esphome? Is this possible?

The example code I used can be found here.
But in that case a momentary switch is used and the binary_sensor is used with on_click and on_press which ofcourse can be used seperate.

If anyone has an idea I would be grateful to hear it.
Thank you!