I’ve mentioned before that we run a rather venerable HVAC controller at the church which drives our heating system.
Last weekend, I was bored enough to start digging in to the network protocol it speaks, but before I spent hours slaving over Wireshark, I took a last look around to make sure I hadn’t missed an “official” programmable interface.
Somewhat to my surprise, I had!
Leaving aside a bit of sniggering about how ActiveX hasn’t been “The Way of the Future” since I was half my current age, let’s try firing it up from a sensible programming language (Python)…
import win32com.client def get_px(block_name, field_name): """Constructs the COM object for reading and writing a block Block names can be viewed in MAXMon; most of the field names are also visible there if you open (double click) the block""" px = win32com.client.Dispatch("icommx.pointx") px.ServerAddress = "localhost" px.DeviceAddress = "6:1" # connection number, device number px.PointAddress = "%s~%s" % (block_name, field_name) return px def get_temps(): for tzone in ["Outside Air", "Boiler Flow", "Utility Space", "Church Space", "Hall Space", "HWS Cylinder"]: px = get_px(tzone, "OUTPUT") print(tzone, px.Value) get_temps()
There are various hoops to jump through to generate the necessary Python COM bindings, which you can Google for. Needless to say, all this COM stuff requires us to be on Windows. Saving this as icp.py, let’s give it a try:
C:\Users\dtn>python icomm-python\icp.py Outside Air 27.03 Boiler Flow 24.23 Utility Space 20.67 Church Space 21.32 Hall Space 23.91 HWS Cylinder 54.75
Result! (Hot day in Oxford … the boiler is not running, yet the hot water is toasty thanks to our solar panels.) You can also, somewhat scarily, assign to the “Value” field for blocks which are inputs such as override buttons or temperature set points.
The API is a bit limited because there’s no way to enumerate the available blocks – you just have to know (using one of the companion apps like MaxMon) what they are. More disappointingly, I couldn’t find a way to write the schedule on the seven-day timer blocks. However, a bit of thought made me realise this doesn’t matter too much: I can still write to a boolean flag connected to the “override” pin on those blocks, and write an override value into each one – number of minutes until heating next goes on/off.
Long story short, we can finally wire our church heating directly into the bookings calendar and stop having to program it by hand! Of course, we will need a permanently stationed Windows box, but we’re going to need one anyway for some other projects. Exciting times…