Control ceiling lights - Home automation

I’m making a home automation system where I can among other things control ceiling lights.

I use 2.4GHz traceiver modules for communication between node and ethernet gateway Arduinos and it’s working perfectly.
I have ceiling light nodes that control the 230VAC lights through relays - also working fine.
I wanted to still be able to use normal light switch and also control the lights remotely.

I figured I turn the normal lightswitches into temporary-push buttons by adding a small spring to make them always return to ON-position.
When I want to switch the light, I cut the power temporarily by pressing the switch. On startup arduino reads last state from eeprom (light was on or off) and sets it into the opposite state.

This way I’m able to control lights via phone and the normal switches simultaneously.
Only problem with this is the delay that arduino boot up causes.
To solve this delay I’d like to keep arduino awake during the <0.5s power-out - it would just be monitoring the voltage. When it realizes there was a short power-out, lights should be switched.

I think it would require too big and expensive capacitors to do this.

Only other choice would be batteries then, right?
I don’t know much about batteries, what kind of circuit and batteries should I use?
Any tips or other solutions to get rid of the delay?
What would be best way to sense the 230VAC with Arduino?


You do not need the boot loader at all if you have a second arduino to act as the programmer, e.g via SPI, Or if you have an AVR programmer board