Shelly Button1 or "How to get a MQTT switch with more than two states?"

I’ve done pretty much exactly as you have on a similar button. The only thing I can suggest on the IF statements, is that you could use a SWITCH/CASE format instead (last example at this link)?