A method of handling power failures in a mains powered first gateway (12'; 34) of a home wireless alarm system, the system comprising the mains powered first gateway (12, 34), at least one second gateway and a plurality of wireless peripheral nodes, said mains powered first gateway (12'; 34) and the at least one second gateway communicating with and controlling at least one of the plurality of wireless peripheral nodes and communicating with a remote central monitoring station, said mains powered first gateway (12'; 34) comprising a plurality of electronic units including a control unit, the method comprising the steps: a) continuously storing energy supplied from a mains source in an energy storing device of the mains powered first gateway (12'; 34), b) continuously monitoring changes in a power supply voltage level Vin from a DC power source, c) filtering the power supply voltage level in a first low pass filter, d) detecting a drop of filtered power supply voltage level below a predetermined threshold value, wherein said detecting is made in a power fail detector comprising a second low pass filter connected to a power supply at power supply voltage level Vin to provide said threshold value, and wherein the second low pass filter has a second time constant T2 that is substantially higher than a first time constant T1 of the first low pass filter, e) generating a power fail signal after detecting said drop of power supply voltage level while obtaining energy from said energy storing device, f) transmitting said power fail signal to the control unit of the mains powered first gateway (12'; 34), said control unit communicating a power loss information signal to the central monitoring station, and g) reducing power consumption by turning off selected electronic units in the mains powered first gateway (12'; 34), so as to prolong operating time of said mains powered first gateway (12';34) during a time period sufficient to allow a communications unit of the mains powered device to send the power loss information signal to the central monitoring station. a) continuously storing energy supplied from a mains source in an energy storing device of the mains powered first gateway (12'; 34), b) continuously monitoring changes in a power supply voltage level Vin from a DC power source, c) filtering the power supply voltage level in a first low pass filter, d) detecting a drop of filtered power supply voltage level below a predetermined threshold value, wherein said detecting is made in a power fail detector comprising a second low pass filter connected to a power supply at power supply voltage level Vin to provide said threshold value, and wherein the second low pass filter has a second time constant T2 that is substantially higher than a first time constant T1 of the first low pass filter, e) generating a power fail signal after detecting said drop of power supply voltage level while obtaining energy from said energy storing device, f) transmitting said power fail signal to the control unit of the mains powered first gateway (12'; 34), said control unit communicating a power loss information signal to the central monitoring station, and g) reducing power consumption by turning off selected electronic units in the mains powered first gateway (12'; 34), so as to prolong operating time of said mains powered first gateway (12';34) during a time period sufficient to allow a communications unit of the mains powered device to send the power loss information signal to the central monitoring station.