I am tired of my LiFX bulbs turning on repeatedly during the night due to power outages. Since most of them are connected to a zwave switch or outlet, I have a couple options to turn them off automatically once power, and control, is restored. One thing I needed was a way to detect a power outage. I could use a “canary device” method but this was a good excuse to add yet another sensor
Disclaimer: Nothing original here, just my implementation…
I purchased a Monoprice 15270 door sensor as I saw it being used to create a power outage sensor. At first I thought it allowed you to connect a voltage to its input so I figured it would be the simplest to implement but when I received it and did further research I found that the reed relay simply shorts to ground a digital input pulled up to about 3V.
If you are going to use a 5V source, such as a USB charger, to indicate presence of power, you cannot do a direct connection to the sensor. The one that several referenced being sold on Amazon appears to use a transistor to pull the input down to ground. While that is definitely the cheapest and most logical solution, I did not have one at hand that fit the application. My next thought was to use an optoisolator so the 5V would essentially power the LED inside the optoisolator and the transistor based output would pull the digital input to ground. Alas I did not have an appropriate one either so I settled on a bulkier reed relay I had. The relay takes 5V and has 2 NO contacts. All I had to do was wire the 5V to its coil and connect one of the NO contacts to the two ends of the reed relay (no need to remove it as it is NO as well).
First step was to remove the PCB to do some of the soldering. I removed the screw terminal as it was in the way of the USB cable coming in the sensor. To get the USB cable in you just have to puncture the plastic case where there is an indentation meant to be punctured for this purpose.
Back of PCB. Notice the nice big antenna…
The reed relay is that glass tube at the bottom. It is a normally open contact that closes if there is a magnet close enough to it. I will not remove it as it will not interfere for my purposes.
This is the reed relay I had.
Soldering done… and yes, I do NOT like the joints but I could not mess too much with it as the jacket of the wire would retract if heated too much so I had to be quick. The connections are not pretty but solid enough for the purpose. I used some heat-shrink tubing for the end of the USB cable as it was shielded and I did not want the shielding to short anything, plus there were two data cables that needed to be kept from shorting on anything as well. The blue cable tie is to prevent the USB cable from being yanked out.
The picture above is my second attempt as the initial cable I used had terrible wire jackets that would retract immediately. Maybe it was my fault as the soldering station was set to 350C… anyhow another cable I tried did much better.
The reed relay is stuck to the PCB via a double sided foamy tape. I do not believe there is any chance of shorts or wires becoming disconnected especially considering that this is something you connect and leave alone.
I used @RBoy 's DTH but I think I will revert to the one that runs locally (default window/door sensor - yet to be tested) to eliminate at least one dependency on the cloud. My entire networking setup from the optical terminal (1Gbps symmetrical fiber service) to all of my networking gear is powered by a UPS so I should have enough time to set a “Power Out” variable in webCore, so that when things come back online, it can reset stuff to what it needs to be.