But you want to prevent false detections, which can have multiple causes.
So be sure the button was pressed, and be sure you will not detect multiple presses when there was only a single long press.
Using pinMode (INPUT_PULLUP) should not make difference between a long press and short press I guess ?
I'm sorry, but i don't understand that.
Do you want to assume (instead of measuring it) where you will start, and so also assume all next controls based on that first assumption ?
To me, knowing each and every keypress that has occurred since you started looking, doesn't tell you anything about which light will be turned on or off, and in case it'll be on, at which brightness level it will be.
You are correct, that's a bit of a "flaw" in my solution... Measuring the input switches doesn't guarantee that the state is kept in sync with the real state (for example a power failure or something, will not update the state).
I have 2 things to say about that :
- I'm OK with it, as we have a "all lights out" button. That's a functionality built-in the impulse relais I use. So when I press this button, I will "reset" the state of all lights. That button is pressed quite often here at home (when leaving the house etc.). So after this button press, I know all lights are out for sure and can update state accordingly.
Using this technique I try to minimize the chance of having a different state's in my software compared to the real situation.
2)I monitor the output of my impuls relais, that way I know the exactly the state of the lights. I'm just a bit "reluctant" about this, as this is working on the 240V part of the circuit and connecting it to the arduino, while the other solution is just low voltage and no real risks...
I found this as possible solution for number 2 (with galvanic separation) : GitHub - edvler/ON_OFF_Detection_230V_24V_arduino: Detect if a power source is powerd on or off. It dosen't matter what power source it is. It could be a 230V AC or a 12V DC or a 24V DC. You only need a suitable signal light!!
But it's a lot of work to implement.. Wiring all those signal lights, photoresistors etc... I don't think I want all that stuff in my switchboard.
The dimmer part is new, and adds another dimension to all of this.
Yes, but not all lights are dimmable.. It's difficult to program the dimming function.. And as told before, currently a nice-to-have but not mandatory 
This is how it works (snippet from the manual)
Short-time control commands switch on/off, permanent control varies the brightness to the maximum level. An interruption of control changes the direction of dimming. The setting of the brightness level is stored after switching off. In case of a power failure the switching position and the brightness level are stored. If applicable the dimmer will be switched on at the stored brightness level after the supply voltage is recovered.