Controlling Max! radiator thermostats with arduino or ESP

Begonnen von kennybl, 26 September 2020, 16:04:22

Vorheriges Thema - Nächstes Thema

kennybl

Hello,

I'm sorry if i ask stupid questions but i am new to this.

I have a few MAX! radiator thermostats. They are connected to a MAX! Cube and i can control the MAX! cube via a raspberry pi.

This works but the MAX! cube looses all its configuration multiple times a year. When it does i need to reconnect all thermostats before it will work again. I think this is a common problem.


I have read that i can make my own CUL with an arduino and a CC1101 868mhz transceiver.
I have followed some tutorials and i think i have flashed an arduino with nanoCUL (V 1.67 nanoCUL868) but  now i have no idea how to connect to the radiator thermostats.

Do i NEED to use the FHEM software? I am a software programmer by myself and i would like to control the thermostats without FHEM or at least i want to control it with my own ipad app.
Is this even possible? I was hoping to use an ESP32 with wifi to set and read more radiator thermostats but i am not sure if this is possible.

All the help is welcome and if you need more information i am happy to give.

Used tutorials:
https://www.hoek.mn/2016/01/20/making-your-own-cul-the-nanocul/
https://www.maredana.nl/max-thermostat-raspberry-arduino/


Thanks!

Wzut

oh yes Cube & Alzheimer is a pain in the ass .... but the solution is easy & cheap -> a CUL or a nanoCUL
To use it first you must define a CUL device with attr rfmode MAX ,example my Test CUL :

defmod CUL CUL /dev/serial/by-id/usb-busware.de_CUL868-if00 0000
attr CUL event-on-change-reading .*
attr CUL event-on-update-reading credit10ms
attr CUL maxid 14491a
attr CUL rfmode MAX
attr CUL room MAX
attr CUL stateFormat credit10ms
attr CUL verbose 3


second Step , define a CULMAX Device :
defmod cm CUL_MAX 14491a
attr cm IODev CUL
attr cm debug 1
attr cm event-on-change-reading .*
attr cm room MAX
attr cm verbose 3


on both devices are the very important MAXID -> 14491a , thats my ID your Cube uses a diffrent number. You can save a lot of work if you can find out this number !!

Do you already have FHEM running ? If yes please start not with CUL and CUL_MAX , start with MAXLAN first.
MAXLAN connects to your Cube and autocreate will define all your MAX devices in FHEM. After this you can see your MAXID in the Internals of your MAXLAN device. Use this ID for your CUL & CUL_MAX device and delete the MAXLAN device.
But only the MAXLAN device NOT your MAX devices !!!
Maintainer der Module: MAX, MPD, UbiquitiMP, UbiquitiOut, SIP, BEOK, readingsWatcher

kennybl

Thank you for your reply.

I have maid a nanoCul and i was testing FHEM software on windows. It can find COM3 but instead of initialized it says open without receiving values.
I can test it on a raspberry pi.

The only thing i don't know is how to communicate to FHEM without using the FHEM web gui. I have made an ipad app for my house to control lights, music, shutters etc, i want to be able to integrate the max thermostat into my app (using php, python, or whatever is needed).

Can this be done?

I have had this working with the cube but as i said, it likes to forget the configuration, it may be the alzheimer haha...

Wzut

Zitat von: kennybl am 26 September 2020, 17:19:56
Can this be done?
everthing can be done but we are here in the FHEM Board. I can help you with FHEM not with your own Software.
But you can run FHEM only for controlling your MAX devices  and if this is running you transfer the live data from FHEM to your Software and vice versa. Dont use Windows first, start with your Raspberry. FHEM & Windows is a litte bit special.
Maintainer der Module: MAX, MPD, UbiquitiMP, UbiquitiOut, SIP, BEOK, readingsWatcher

kennybl

Thank you,

I understand you don't know my software but i only wanted to know if something like that would be possible. Does FHEM has some kind of API or way to communicate via python, php etc?
I will install it on the raspberry and set it up the right way

Wzut

yes it can :) the normal way to connect from your software to FHEM is telnet, default Port 7072.
If want to use telnet please have also a look to the allowed device but please use the English Corner Board -> https://forum.fhem.de/index.php/board,52.0.html for none MAX questions. There are more and better people active with the right know-how
Maintainer der Module: MAX, MPD, UbiquitiMP, UbiquitiOut, SIP, BEOK, readingsWatcher

kennybl

Thank you very much for all your help, i am going to try it and will ask at the English board for more help!

Have a nice evening

kennybl

#7
Just one more question, i have installed FHEM on my raspberry pi and i have a connection with the nanoCul,

I need to add rooms, heaters etc, but i don't know how to start, i tried this command:

define sleepingroom_1 MAX HeatingThermostat 1XX8X0 but it doesn't seem to work, did i forgot something or am i doing things wrong. I used this tutorial: https://wiki.fhem.de/wiki/MAX!CubeMigrationToFHEM

PS: I haven't connected the MAX Cube now, do i need to? I think the nanoCUL replaces the MAX! Cube right?


EDIT:
I think it already works. I resetted the radiator thermostat, i run the command "set cm pairmode 60" and it added to FHEM! Now i need to figure out how to connect everything but it looks like it works way faster than the cube!

Great work!

Wzut

oh no , now you are on the hard way !
Please dont define CUL yet , define a MAXLAN device and autocreate will do the rest.
Please have a look at my first post.
Maintainer der Module: MAX, MPD, UbiquitiMP, UbiquitiOut, SIP, BEOK, readingsWatcher

kennybl

#9
Thank you, i just read about your first post, i connected the MAX! Cube and connected via "define ml MAXLAN 192.168.178.2"

After that, all thermometers are already shown. I only cannot find my MAXID (in ml there are some id's but it is FUUID (a long guid), and a SERIAL but it starts with NEQ12....)

Do i need to start over and do it different?

Wzut

MAXIDs or MAX addresses are always six digits hex.
Have a look at the Internal addr in your MAXLAN (ml) device thats your friend.
Maintainer der Module: MAX, MPD, UbiquitiMP, UbiquitiOut, SIP, BEOK, readingsWatcher

kennybl

Would it be possible to give me a step by step explanation of what exactly to do?
Even Teamviewer would be an option but i understand if you don't want to do that ofcourse

Wzut

#12
Sorry I dont have software like Teamviewer or Skype running on my PC

If I understand your posts in Englisch Corner correctly, I think you are simply missing certain FHEM basics.
I would recommend to a German speaking user to read this first:
https://forum.fhem.de/index.php/topic,19621.0.html
https://wiki.fhem.de/wiki/Erste_Schritte_in_FHEM
Unfortunately i don't know any good english documentation but maybe Google can help you a litte bit to translate.

Anyway : You asked for a fresh FHEM and if it is running now please define first your MAXLAN device :
define ml MAXLAN 192.168.0.228:62910 30
no CUL or CUL_MAX device yet !

192.168.0.228 is my IP please use yor own.
After a few minutes autocreate has define all your existing MAX devices and you can do some things from FHEM , e.g. change the set temperature of a HT or WT.

If that's the case come back, I'll explain the next step to you


Maintainer der Module: MAX, MPD, UbiquitiMP, UbiquitiOut, SIP, BEOK, readingsWatcher

kennybl

#13
I did define ml MAXLAN 192.168.0.228:62910 30 with my own ip and I think it works so far, I got all the 8 thermostats that are installed in my house.



BTW: This is the log:


2020.10.11 16:30:28 0: Server started with 6 defined entities (fhem.pl:21056/2020-01-26 perl:5.028001 os:linux user:fhem pid:24150)
2020.10.11 17:48:42 3: Opening ml device 192.168.1.16:62910
2020.10.11 17:48:43 3: ml device opened
2020.10.11 17:48:43 2: MAXLAN_Parse: Cube thinks it is 11.10.2020 18:48
2020.10.11 17:48:43 2: MAXLAN_Parse: Time difference is 60 minutes\2020.10.11 17:48:43 2: autocreate: define MAX_1bccc1 MAX HeatingThermostat 1bccc1
2020.10.11 17:48:43 2: autocreate: define FileLog_MAX_1bccc1 FileLog ./log/MAX_1bccc1-%Y.log MAX_1bccc1
2020.10.11 17:48:43 2: autocreate: define MAX_1bd434 MAX HeatingThermostat 1bd434
2020.10.11 17:48:43 2: autocreate: define FileLog_MAX_1bd434 FileLog ./log/MAX_1bd434-%Y.log MAX_1bd434
2020.10.11 17:48:43 2: autocreate: define MAX_1bdd75 MAX HeatingThermostat 1bdd75
2020.10.11 17:48:43 2: autocreate: define FileLog_MAX_1bdd75 FileLog ./log/MAX_1bdd75-%Y.log MAX_1bdd75
2020.10.11 17:48:43 2: autocreate: define MAX_1bccc6 MAX HeatingThermostat 1bccc6
2020.10.11 17:48:43 2: autocreate: define FileLog_MAX_1bccc6 FileLog ./log/MAX_1bccc6-%Y.log MAX_1bccc6
2020.10.11 17:48:43 2: autocreate: define MAX_1bdd5d MAX HeatingThermostat 1bdd5d
2020.10.11 17:48:43 2: autocreate: define FileLog_MAX_1bdd5d FileLog ./log/MAX_1bdd5d-%Y.log MAX_1bdd5d
2020.10.11 17:48:43 2: autocreate: define MAX_1bdb83 MAX HeatingThermostat 1bdb83
2020.10.11 17:48:43 2: autocreate: define FileLog_MAX_1bdb83 FileLog ./log/MAX_1bdb83-%Y.log MAX_1bdb83
2020.10.11 17:48:43 2: autocreate: define MAX_1be7d4 MAX HeatingThermostat 1be7d4
2020.10.11 17:48:43 2: autocreate: define FileLog_MAX_1be7d4 FileLog ./log/MAX_1be7d4-%Y.log MAX_1be7d4
2020.10.11 17:48:43 2: autocreate: define MAX_1be048 MAX HeatingThermostat 1be048
2020.10.11 17:48:43 2: autocreate: define FileLog_MAX_1be048 FileLog ./log/MAX_1be048-%Y.log MAX_1be048
2020.10.11 17:48:43 3: MAX Cube is set to timezone CET-CEST



The time difference is 60 minutes, do I need to (and am I able to) change this?
also, changing temperature works but I see this in the log after updating 3 thermostat temperatures:


2020.10.11 17:55:26 2: MAX: Invalid value  for READING groupid on MAX_1bdb83. Forcing to 0
2020.10.11 17:55:36 2: MAX: Invalid value  for READING groupid on MAX_1bdd5d. Forcing to 0
2020.10.11 17:56:09 2: MAX: Invalid value  for READING groupid on MAX_1bccc6. Forcing to 0

Wzut

#14
yes you can change the time - the ml device has a attribute timezone but I think thats not important now because later FHEM is your clock master.


Zitat2020.10.11 17:55:26 2: MAX: Invalid value  for READING groupid on MAX_1bdb83. Forcing to 0
Thats a little bit strange. The Cube organizes all devices in rooms and each room has its own id. In FHEM is that the reading groupid and it must have a value, if not it is set to 0
Did you define rooms in your Cube ?
Valid Rooms are very important for the Cube because all devices of a room (group) are peered.
A peered devices is sending its messages direct to his peers and also to the cube.
Unfortunately it is not possible to read this (and other) informations back from a device !   

The next step is to find out the MAXID of your Cube -> look at the Internal addr of your ml device (6 digits hex).
Make a backup of all your MAX devices :
In FHEMWEB in the comandline field :
{ MAX_Save('all') }
if this fails you can go to each device and do the set saveConfig command.
It is very important to have a valid backup file of each device ( stored under logs/ )
After you have a saved config each device has a new get command show_saved_Config here you can look what you saved.

Now it is time to delete the ml device and save your fhem.cfg ( no red question mark ! ) and power down the Cube
Shutdown & restart FHEM

Now define your CUL and your CUL_MAX device -> my post from 26 September 2020, 17:15:50
Dont use 123456 as MAXID use your own !!!

After you have defined the CUL_MAX device go to each normal device and check the attribute IODev , normaly it points to your old MAXLAN device (ml)
Change this to your new CUL_MAX device cm. After that save and shutdown restart.

If after all something is not working only the FHEM Log file can tell you what the problem is. To get a log with more details and informations please set  the attribute verbose to 5 on your CUL_MAX device ( not global ! , global can be 3 or less )
Additionally you can set on all MAX devices the attribut debug to 1 than you will have more informations of the device in its readings.
Maintainer der Module: MAX, MPD, UbiquitiMP, UbiquitiOut, SIP, BEOK, readingsWatcher