This is code for an ESP8266 controlling a light push-button with 2 lamps. The button cycles through 4 different states of the two lamps:
- both off
- 1 on
- both on
- 2 on
- both off (again)
The number of switches for the button is calculated from the current state.
This code might not be useful for anyone. If you have any questions, feel free to contact me.