Boiler control from MAX! Cube to Drayton Boiler via Raspberry Pi/Vera/Mysensors.
Ah, sql syntax (according to a website I found) uses double single-quote to escape a single quote when used in a table.
Ok after faffing about for ages I ended up just moving your replace quote code into the database file, keeps it out of the way and seems to work ok if I simulate a room with a quote in it and without.
It is happy saving names with a quote in to the DB it is just searching after that needs it doubled. Something else learned.
Cool, thanks. I'll grab it so the version I'm running is in sync.
stephenmhall last edited by stephenmhall
For @simrob problem.
I think the problem is in the database, and my code of course, With the way I developed it over time I think I added features later that cause a problem with a fresh install because It asks for the room names before it creates them. Where my database already had room names populated before I got to that point.
Could you install "DB Browser for SQLite" and have a look at the heating.db file that was created. Under brows data there should be a rooms table like mine.
"4" "Living Room" "1051D6"
"5" "Dining-Extension" "106FD5"
"2" "Bathroom" "1051DA"
"3" "Bedroom 1" "116B63"
"1" "Bedroom 2" "1163A5"
If it is empty possibly just adding one record with the correct name and a random GroupID might be enough to get it past the point where it fails so it can fully populate the table. Also I think you must be using an older version as your line numbers don't quite match what I have. Try downloading the vera Virtual Thermostats branch and see if that helps, not saying it will but that will become the main branch when I sync it up.
I will look at getting in installed again on a blank Pi so I can test and fix this properly. But hopefully putting a line of data in the DB rooms table will get you past the problem.
I have now changed the folder layout on github to make installing easier, also updated some of the files to hopefully stop the error on first run.
I tried on a blank Raspberry and it all seemed to work ok.
Give the README instructions a once over and see how it goes.
After many delays and other items got in the way I finally have almost sully working system. I do have one issue I am struggling with and that is that I can't seem to turn the boiler off once the temperatures have been met.
Also is there any way some of the configuration page could be clarified as there are a number of options I am a little unsure about.
@twisted I have added a text file to explain the variables. As for not turning the heating off, not sure, remember that normally the Max system will gradually close the valves on the radiators as the temp goes over the requested temp, you will normally get a half degree or so higher. if it never shuts off I don't understand that it just sends the same vera command with a 1 or a 0.
twisted last edited by twisted
Just saw the explanation txt appear, thank you so much, it means I can double check what I set was correct.
Funnily I noticed as it just appeared when I was searching the code to work out a couple of bits.
René Verbeek last edited by
Is the Max Boiler Controller from eq-3 not an option to do this more easily? It was introduced by eq-3 for the British market, but is now not available anymore. Google for BC-TS-Sw2-WM to get the manual from eq-3. Maybe we should push eq-3 to reintroduce this product again.
Never seen that before, reading the instructions it looks like it switches the boiler on using a daily timer function like the room heating and and a thermostat temperature, possibly if it switches on if any of the rooms are cold that would work. Not saying mine is better but it monitors the valves and gives you heat on demand when any of the radiators call for it.
I have to say using Vera and the boiler switch attached to that is a great solution, if I could just get past one problem. I wonder if anyone else is experiencing this, but I find the time taken for the valves to respond to the temperature changes is a little slow. Lets say I set the required temperature to 19c most rooms jump to 20/21 before the valves close enough to actually prevent further heating to the room.
My thoughts at the moment are to see if I can somehow directly communicate with the valves or maybe set offsets for each temp on the valves so they read a couple of degrees high.
Anyone have any thoughts?
What I do is only supply heat if valve is open more than 80% or more than 2 valves open 60% so heat shuts off at about 21.9 if you are looking for 22, then the residual heat in the radiator takes temp to about 22.2 before the room starts to slowly cool over the next hour or so down to 21.7 when the valve opens up enough to bring the heat back on.
twisted, unfortunately you can't directly communicate with the valves. AFAIK the way the work is that they initiate communication with the cube every 2(?) minutes and not the other way around. The cube just listens for the data and then sends data back to the valve. This is to conserve battery so the valve doesn't need to be active all the time. I'm sure stephenmhall will correct me if I'm wrong
As far as Cube to valves and valves to cube comms, I think it must be bi-directional as if you change anything on the cube app it happens pretty much instantly. How the cube and valves communicate could be magic for all I know they are on the 868Mhz band but what the protocol is I don't know.
I recently read about a company in Germany called busware.de that makes a Raspberry interface card that has firmware that speaks MAX protocol, I have sent them an email looking to confirm this but not heard anything back yet. If I could cut the Cube out of my system I would be very happy as it is the least reliable part, it seems to factory reset itself every couple of months.
Stuart Middleton last edited by Stuart Middleton
Ah, well, I think the cube tells you it happens instantly but queues the requests up and waits to be contacted by a valve. I think that's what the memory slot parameters are for when you get the cube data. It fills them up with outgoing data ready for when the device makes contact. I'm not 100% sure about this but when researching it a while ago (I was going to go down the 868Mhz radio route before I found your project) I'm sure I read that's how it worked. I'll see if I can find the article.
I'm having a small issue, and I can't see why. I had to reload and now every time I try to load it I get the following before it terminates. This is from fresh install.
Traceback (most recent call last):
File "main.py", line 204, in <module>
File "main.py", line 96, in init
File "main.py", line 111, in doLoop
File "/home/pi/PiHeating/heatinggpio.py", line 173, in buttonCheckHeat
File "/home/pi/PiHeating/max.py", line 56, in checkHeat
File "/home/pi/PiHeating/max.py", line 486, in switchHeat
roomTemps = CreateUIPage().createRooms()
File "/home/pi/PiHeating/webui.py", line 224, in createRooms
actualTemp, roomOpen, roomMode)
UnboundLocalError: local variable 'roomOpen' referenced before assignment
That error suggests you don't have a settings file?
@stephenmhall - I'm getting a lot of issues that seem to plague the MAX system (not your excellent software of course ) where the cube forgets the valves randomly or updating timings don't get sent to the valves. I also hate that the realtime temp isn't reported.
With this said, I was wondering if you (or anyone else) had seen the BlueTooth version of the valves that they sell. And if so, has anyone taken a peek at the messages to see if the temp is reported? I'd rather control the whole thing via BT than go via the dodgy cube!
Maciej Jablonski last edited by Maciej Jablonski
Looks eq-3 at least have plans for eq-3 MAX! compatible boiler/hot water controller, the manual is already there, just cannot see the product anywhere.
Orkspalter last edited by Orkspalter
For anyone looking in having a setup like above, theres a way without extra buying the cube or the ccu2 when using homematic thermostats. Please have a look at https://www.homegear.eu , which eliminates the need of those boxes as it runs on a raspberry pi which most of us already have. You will have to add a CUL or better build yourself a NanoCUL (arduino nano + CC1101 ). Homegear does all the pairing and communication (also scripts) and best of all its converting and outputs all the communication via MQTT, so you can use Node Red.
Damn, just weeks after I changed to a Honeywell system. Talk about bad timing.
FYI, I bought a CC1101 connected it up to an RPI, setup openhab, homegear, the homeatic binding, and within minutes I had all of the devices listed and complete control over them all. Well I can say that is where it has ended, I am struggling to either find pre-written logic or writing my own to control everything. The issue isn't so much writing it as such, but choosing which system should host it. This dilemma exists, as I have everything else in my vera, I am getting into node-red, and now also have openhab/homegear in the loop, I don't want to fracture my set up too much from a control interface point. I like the idea of keeping the WAF where it is, so I will probably still need to have some sort of control via the vera and therefore one of the apps that the other half is still happy with.
I've got a CC1101 on its way from China. I'm hoping it'll be here soon. My plan was to rewrite the excellent Python code from this page to talk to them directly rather than through the cube. Currently, I don't have an off the shelf home system. I'm kind of writing it all myself as I go (maybe a mistake, I know). I'll let you know how I get on when mine arrives.
@Stuart-Middleton Although I mentioned my difficulties, I would suggest that you at least have a look at homegear and openhab (or the openhabian bundle to make it easier) as it does give great access to the devices and opens up very easy use of MQTT.
Thanks. I'll take a look at that first.
@Stuart-Middleton attached is an example of the items that get loaded when connected to openhab2 via homegear and the homematic binding.
That pretty much covers all the settings. When my radio arrives I'll hopefully be able to get it working quickly and I may come to you for help with setting it up with openhab so I can at least see a working system before I start playing with the code. Thanks
For a beginner, what shall I read (links) to understand what it means to do this. I have MAX cube and 3 actuators and I need a boiler control device. I called eq-3 and they reply they are not selling boiler controller device BC-TS-Sw2-WM (The MAX! boiler controller has been withdrawn from the market due to poor customer uptake. We do not believe there to be any devices available in the sales channel.) Thanks a lot !
They are not selling any more this. (Their answer: The MAX! boiler controller has been withdrawn from the market due to poor customer uptake. We do not believe there to be any devices available in the sales channel.)
It depends on how much of a beginner you are. If you're OK with very basic electronics, happy to install some software on a Raspberry Pi and can connect a mains voltage wire to your boiler without killing yourself, then it's pretty simple.
At a minimum, you'll need a Raspberry Pi PC, a mains relay board controllable from the Pi (very cheap on eBay) and some cable.
Thanks. Of course, I can do these. I have Raspberry Pi B and other required things. What I need to know is a schematic of connections and what software to install (on PC, on Raspberry Pi...)
Again, Thanks a lot !
The software is all written in python and is linked somewhere near the top of this post. There are instructions of how to install and use it included if I remember right.
The wiring is very simple. The boiler on output pin is defined in the software, so just change it to any GPIO pin that you want and connect your relay (3.3v I believe) to the pin and GND. I used a solid state 250v AC relay that accepts 3.3v input. Then just connect the "call for heat" wire on your boiler to the mains side of the relay. This is on your boiler schemaic, but is usually just the two wired to your wall thermostat.
I've got a combi boiler so just set it to be on all the time and let the Pi contol the heating.
Thank you a lot! I will try it and let you now the progress. I need some time to do it...
if you need any help with my software let me know, I have swapped to a Honywell system myself so no longer use it but if I can help I will.
@twisted It's arrived! I've got a CC1101 module! I presume It's just connected to the Pi via SPI? I think there's a wiring diagram on the website. I'll dig out a spare Pi and let you know what happens.
marog last edited by
I use a diagram from homegear to connect it and it is working. No problem with connection.
I believe I used this one: [https://forum.homegear.eu/t/CC1101-no-physical-device-found/921/2]
OK, so I've got my module, connected it to my Pi and installed homegear (used the Rasbian version with homegear and openhad installed). I connected to the Pi, ran homegear -r, families select 0, pairing on and started pairing on a device. However, I don't see anything in the peers list.
So, any ideas or obvious things I'm missing?
twisted last edited by twisted
it should be families select 4 I believe, did you go into the max.conf and uncomment all the lines under ti cc1101 module? you may need to set gpio to 25 (not 23) and don't uncomment the the additional section. Reboot, then you should see 4 max! when "sudo homegear -r", "ls"
OK, so I uncommented the settings in max.conf (I hadn't got to those) and I do get the following
But no pairing when I do 'families select 4' then 'pon' and try to pair. The device just times out and an 'ls' doesn't show any devices.
I may try a cleaner install and start again. I've been following a few posts and translating them into English, but it's still not working. It could, of course, be my hardware.
Is there a log output somewhere that shows the hardware initializing?
Sorry on the road ATM, but will look when i get home. Here is some pics of my wiring I have on my phone in case that is some use.
Quick thought did you factory reset the max! devices before trying to pair? I found mine wouldn't work until they had been reset due to the pairing with the cube.
Thanks. I'm using a different module, but the wiring looks the same. I'll try again later.
I didn't factory reset them. I'll try that.
marog last edited by
You dont need to do reset. IT is enought to unpair with the cube. Try to set log debug in console of homegear with the option 10. Then logs should tell you what is wrong
Stuart Middleton last edited by Stuart Middleton
It looks like I've got the wrong module. I ordered from ebay about 3 months ago and the title said "CC1101 315/433/868/915Mhz Wireless Module SMA Antenna Transceiver fr Arduino New", but the description talks about a default "433 mhz". I'm not sure if it's switchable, but it doesn't seem to work. I've ordered another for the grand price of £1.95, but it'll take a month or so to get here.
demusss last edited by
I've had a Honeywell wireless programmable thermostat for several years and the LCD is now a little temperamental so was looking for something new.
Found the Honeywell evoHome, then saw a link mention the MAX! products and then I found this thread which looks like what I'm after.
Its been 8 months since the last post on here so I was wondering what ever happened to this project? Its just seems to have stopped. Is it complete?
Did the CC1101 work so that the MAX! Cube is not required?
Did @Stuart-Middleton switch over to openhab2 and homegear?
Just wondering do I use @stephenmhall code or go the openhab2/homegear route?
Hey, @demusss. I'm still using the python script talking to the MAX! Cube. It's a little temperamental but works most of the time. I finally got my hardware (CC1101) but, if I remember right, the homegear instructions listed above don't seem to work anymore. There's a missing module? I can't recall now. I'm sure I could sort it out but I just haven't had time.
Ideally, I'd like to talk to the system myself via the CC1101 and write the software myself instead of relying on OpenHAB but time is the limiting factor, unfortunately.
Maybe I'll pick it up again this weekend and try and get the CC1101 comms working.
demusss last edited by
Wow Stu, quick reply.
What you've built is basically what I'm after, but from what I've read the Cube can be temperamental.
I do have RPi somewhere, so to have a play I may get a CC1101,
MAX! Wireless wall mount thermostat - BC-TC-C-WM-4 / 131651
MAX! TRV - BC-RT-TRX-CyN / 142016A0A
I would like to control the system from my mobile so if I'm out late there's no point in the heating being on. There are some HomeMatic apps out there which work with openhab etc, but maybe using your web interface would be easier.
Yeah, the cube is the temperamental bit. It forgets the sensors every few weeks/months.
I have opened up the python web page to the web, secured behind a password, and it's OK to use. I mainly use it to monitor the system and look at the pretty graphs. I think the CC1101 with OpenHAB or custom software is the way to go.
Let me know if you get the Pi and CC1101 installed. I can't recall exactly what was wrong but I think it may be one of the packages that it tries to download no longer exists. It's something I really want to get fully working the way I want it, but to be honest it does a good job anyway.
stephenmhall last edited by stephenmhall
Funnily enough I went from the MAX system to a Honeywell Evo system and Domoticz as I have elderly parents and could not risk the times the max just forgot about all its radiators and either left the heating off or on all day.
Had the Evo for maybe a year now with no problems. The only thing I miss with the evo is notification as to when the heating is actually on. And being able to work on my code as I did enjoy writing it.
If you need any help with the code just ask, although it has been a while since I looked at it
NIce post.. I was looking at adding boiler control to my max eq3 system and this looks fab
angeloS last edited by angeloS
I want to revive an old thread here. Ive been chatting to Stephen via github and plan to extend , perhaps take over?, development of his PiHeating package on github..
- Please review my github issues Ive logged, Id love to know if people agree/disagree
- Are there many MAX! Users out there? if there are then I'll invest time in making the code read-able, and pluggable with HA controllers like HomeAssistant.. If there isnt much interest then I'll trim the code down to my needs (remove vera etc)
- Any other suggestions?? please log a Github issue and I'll look at it..
@twisted : are you twistedsanity on github?
My github repo is here https://github.com/asantaga/PiHeating
This post is deleted!
Well after long sessions of trial and error Ive given up on the Max! +Raspberry pi based on Stephens code. Regardless of how frequently you scan the max!cube it eventually looses its memory after 4-8 weeks.. Usually when Im not at home and thats not acceptable..
Shame as my setup with HomeAssistant was "perfect":-(
zboblamont last edited by zboblamont
@angelos I was looking into the MAX setup initially but reports of the Cube falling over put me off completely, even where some appeared to have ZERO problems. Some seemed to have circumvented the problems by reflashing the Cube (hazy recollection) but cannot remember the details of who where what, as I discarded it when a plug-in card for the Pi3 was released by the parent company (ELV?).
I took it no further as I had set a target to cover all improvements from energy savings, so the budget didn't stretch to it having added insulation and improved Rad Valves, as well as the increased pricing on the market.
If any of that info is potentially any help, pm me and I'll dig out what I found.
w1ldf1re last edited by
I have just installed a Max system, 17 TRV's, 4 Room stats and a cube. I also have a Danfoss wireless stat for controlling the boiler. I was wondering how to get boiler control with the Max because currently the boiler runs all day. I then found your project. It looks a bit advanced for me though. I was thinking of using a Sonoff device just so I could switch the boiler on/off at my leisure for a quick fix. I have never used a RPi before. I see you have now changed to an Evo system was the Max that unreliable?
zboblamont last edited by
@w1ldf1re While you are waiting...
Pardon my interest and confusion, but if your Danfoss stat (presumably from a single area sensor) is controlling the boiler, how does the Cube connect to it, and if the Danfoss is connected, why does the boiler run all day?
The discontinuation of the Cube compatible boiler relay due to lack of sales put me off the Cube, and quite a few complaints over reliability sealed it.
My next notion was to go for a Pi3 Homematic controller which was allegedly Max compatible (see https://www.elv.de/funk-system-homematic.html - Bausatz) but when prices shot up I abandoned it for better valves/TRVs instead.
Right now I'm looking at paralleling the existing commercial (Danfoss type) boiler relay with an Arduino fired one fed temperatures for all the rooms to cope with deep winters where the top floor can plunge, but they are quite separate controls.
If you can find a relay (Schaltaktor) which can be called by the Cube, you should be good to go, the parallel system I would suggest better in case your Cube has a brainfart... Just my 2c...
alx6ths last edited by alx6ths
i bought a MAX! set month ago including MAX Cube, 4 Valves and some window sensors. Now i want to use this project to be able to switch on and off gas boiler, which is operated by remote thermostat at this moment.
So far, i've got it runing, but i have a problem with room temperature reading.
I have four rooms, two are read correclty, but another two shows temperature and set temperature as 255, the Valve % seems to coresponds to other rooms somehow.
I hope this thread/project is not completely dead and somebody can help me with it ... thanks guys!
EDIT: I have resolved the relay issue described in my original post, so i removed that question. It was caused by wrong configuration in variables.txt
(sorry for my poor english)
alx6ths last edited by alx6ths
Ok, it works. Looks like the problem was caused by windows sensors that were not connected but initialized, so they were missing.
I removed them in the MAX software and then everything was displayed correctly.
Thank you for this great project!
king bily last edited by
This post is deleted!