Code requirements mandate that smoke alarms must be hard-wired directly into the home’s electrical system and provided with a backup battery to keep the unit functioning during a power failure. Alarms are required to beep or otherwise indicate when the backup battery’s power is low. Smoke alarms powered by batteries alone are allowed if the home was built before building codes required hard-wired units. Many areas now require these battery-powered smoke alarms to be equipped with a nonremovable battery that's able to power the smoke alarm for at least 10 years. When the batteries fail in these units, the entire alarm is replaced rather than just the battery.