FIG. 22 illustrates another embodiment of a two-stage integrated dimming LED driver and battery backup system. If there is a desire to know when AC mains 2205 power has been lost, indications of such an event can be confused with switching of a switch 2250 (e.g., a light switch) arranged between the AC mains 2205 and the rectification 2202. To overcome the unknown source of power loss where a switch 2250 is implemented, the energy storage management system 2210 can monitor power between the AC mains 2205 and the switch 2250, for instance via a power sensor 2252. The power sensor 2252 may be coupled to or part of the master controller 2090, or may reside near leads between the AC mains 2205 and the switch 2250. The power sensor 2252 can include a large input impedance so that only a small current is drawn from the AC mains 2205. Alternatively, the power sensor 2252 can use non-contact methods (e.g., inductive or capacitive) to monitor power on the line to the switch 2250. In this way, the power sensor 2252 can tell the master controller 2090 whether AC mains 2205 power has been lost regardless of the state of the switch 2250. The master controller 2090 can be arranged in a voltage regulator circuit 2207 or a voltage to current converter 2216.
FIG. 23 illustrates another embodiment of a single-stage integrated dimming LED driver and battery backup system. This is a single-stage variation of FIG. 22, where the energy storage management system 2310 includes a current controller 2311 to generate a regulated current I2.