Many hard-wire smoke detectors have backup batteries and replacing the battery will typically resolve the issue. Alternatively, the sensor may be dirty, so cleaning the device will stop it from beeping. If the issue is still unresolved, the smoke detector is likely malfunctioning and should be replaced.