Are the light bulbs 12V, or 120 / 240VAC?
Could use a ghurd controller LVD, in reverse.
When the backwards LVD triggered because of a low battery, a grid powered battery charger would charge the battery.
It would be opposite of a UPS.
"i mean that,the primary power supplier of bulbs will be batteries and then the voltage of the battery drops,the circuit disconnect power from batteries and connect power from grid."
Disconnecting 120/240VAC devices from the inverter, then connecting to the grid, or the other way, will cause problems.
It would be possible if the devices were Only regular incandescent light bulbs, but anything else could be blown up.
The inverter and grid will not be in phase. The change will make voltage and current spikes. Motors, transformers, CFLs, possibly the inverter, will all be ruined.
G-