Esphome how to create a switch that has different things that occur based on number of presses. 4th press turns back off

Hello all,
I have a paladone Mario light I am trying to make smart. I would like to use the gpio of esp8266 to do the “electrical” button presses. I have verified 3.3 volts exist at the physical button.

By looking at the switch component in esphome, I feel I could do it if it were simple on and off.

But how do I handle the below with esphome or home assistant (which is how the Mario light works by default with no smarts)

Press 1- on
Press 2- pulsing lights
Press 3- sound reactive lights
Press 4- off

Essentially I am just trying to keep this original functionality in place using the esp8266.

Any guidance or examples would be amazing.

I think I understand how to do the physical wiring. I just don’t understand how to get something working on thenprogramming/ software side.

I have no background in any of this. Just enjoy home assistant and I feel like I don’t get to enjoy some of my trinkets enough.

Thank you all for any guidance!!

1 Like