heater
heater
From a secure web page, we can turn the house heater on and off. The command we use most is one that turns the heater on for 20 minutes. There isn't any software that incorporates feedback from the temperature sensors yet, but I may add that someday. This project only gets worked on during one season each year.
The web page writes commands to a data store. A special heater-and-lights service watches for new commands that want the heater to be turned on. I think new commands also emit a message on a pubsubhubbub message exchange so the heater service is told more immediately about the new request.
The heater service decides when to ask for the heater signal to be sent. When the heater should be on, it PUTs a "1" to the right pin URI according to my configuration (line 17). A simple service sends pin requests to an arduino board with the firmata protocol.
That pin drives a little relay (through an optoisolator) that connects the same wires that the standard wall thermostat connects. The two controllers are in series, so the wall thermostat still works normally. I tried to build a sensor that would tell me if the wall thermostat was turning on the heater (so I could plot all our heater usage, for example), but I didn't do a good job with that circuit. It's really noisy. I'd rather just obsolete the wall thermostat completely.
Here's the computer side with the opto.
Here's the heater side with the relay.
The relay is powered by this old computer power supply, which is also powering the wifi router whose own supply broke.
I used to think the heater was going to be the most sensitive and critical output in my home automation system, since a malfunction could leave the heater on continuously and possibly start a fire. The software is full of checks and traps that try to shut off the heater if anything is going wrong. In fact, the garage door turned out to be much worse when it came to handling failures, since even a momentary mistake leaves the garage door completely open.