The battery in my smoke detector at home is mains wired, with a battery and an energy cell, it gives out its annoying beep, to say that the battery needs replacing when the battery is affected by the temperature drop i.e. at night time, when the central heating has gone off. If you turn it off at the consumer unit it still beeps. If you take the battery out it still beeps due the little cell inside it. If you dont have a replacement battery you have to detach the detector from its base and put the detector in the freezer. that's the only place where you cant hear it so you can go back to bed.
I would never have a detector with a battery fitted in a cold roof space. Below a thatched roof ok and in a roof where the insulation is at rafter level, but not practical on the cold side of the insulation. I'm a patient man but going into the loft at midnight to sort out the smoke detector, before I'm allowed back to bed, is a step too far.