Recently I mentioned monitoring the house with wireless sensors dotted around the place. It uses node-red to average the temperatures, and come up with a synthetic value that gets reported back to the home control system, Domoticz.
Next stage is to control the heating.
The heating system in my house is a very old design, and there’s simply a plug for the heating pump, and a plug for the boiler. When the heating is commanded to turn on by the control device (so old it’s not even a thermostat) downstairs, it really just connects these two plugs to a mains supply. The boiler and pump then turns on, and warmth ensues.
My chosen method of automation is simply to keep the heating ‘on’ all the time, and have some sort of device plugged in to the plugs in order to turn them on and off remotely. I want this to be completely retrofittable, so we can remove or change it at a later date without massive amounts of rewiring.
My initial thought was just to use a couple of LightwaveRF appliance modules, but I had a USB controlled dual relay floating around that I long planned to control the TV with, but never quite managed to get around to. Additionally, and conveniently, up the loft there’s a laptop that I use for transcoding the satellite feed to IPTV (with TVHeadend), so it was a simple case of hooking the USB board up to that laptop and getting some software on to it.
Also, to make it a bit safer, and along with the retrofitting feature, I opted to put the relay board into a little dual gang enclosure, and wire in some 13A sockets that I had in the garage.
The end result is a little deamon called mqtt-usb-relay that sits and listens for MQTT messages and then act upon them to turn the USB connected relays on and off. It subscribes to the /raw/`hostname -f`/usb-relay/#, topic, and simply takes the last component of the topic as the relay number to control, and the message as the state to turn the relay to.
Now, doing this ‘correctly’ would involve parsing the JSON output of the 3rd party mqtt.js script for Domoticz, but I decided to keep things simple and to use the On and Off Actions built into Domoticz to trigger simple mosquitto_pub events.
To do this, just create the dummy switch in Domoticz, and in the On/Off Action field, stick in commands similar to this.
script://///usr/bin/mosquitto_pub -h mqtt.vpn.glasgownet.com -t /raw/wmlp1000.vpn.glasgownet.com/usb-relay/1 -m 1
Job done. The heating can now be controlled from Domoticz. It’s not extensive control over zones or power levels of the boiler (although I have an idea for that), but it can certainly command the ‘MORE HEAT’ desire, and maybe one day I’ll install wireless TRVs on the radiators.
Recent Comments