Page 6 of 13
Re: Nefit data/control via Arduino to Domoticz (directly without OpenTherm module or Easy)
Posted: Tuesday 06 February 2018 21:19
by bbqkees
The first batch of PCB's are finally ready.
See
http://domoticz.com/forum/viewtopic.php?f=22&t=22079 for all the details and how to get one.

Re: Nefit data/control via Arduino to Domoticz (directly without OpenTherm module or Easy)
Posted: Monday 26 February 2018 14:57
by WillemNL
How to integrate this project into Domoticz?
Having an EMS level shifter, an Arduino Mega and a working Domoticz installation on my NAS, my next challenge is to integrate the measurements into Domoticz. What's the right setup methode?
Re: Nefit data/control via Arduino to Domoticz (directly without OpenTherm module or Easy)
Posted: Monday 26 February 2018 17:03
by bbqkees
Create virtual sensors and switches in Domoticz for the parameters you want to log.
Write down the device ID's.
Copy the sketch from my Github page, change the device ID's and the IP address etc in the sketch to the values of your setup.
And for reading out the regular parameters you are done. Devices are updated every 30 seconds (or when they change).
If you want to change the temperature you need the correct thermostat and some additional code that can write the correct EMS register.
Re: Nefit data/control via Arduino to Domoticz (directly without OpenTherm module or Easy)
Posted: Thursday 08 March 2018 13:59
by Sungray
Hi @bbqkees,
I want to control my Buderus heating installation using 0-10v outputs (start temperature control). The current controllers are one RC300 (heating floor, low temp) and one RC200 (radiators, high temp). So there are 2 distinct circuits with one MM100 module each.
Is there any way I can use your work to take control of my installation, bypassing the thermostats ? Or even better, having the thermostats in a surveillance/observation mode while controlling the heater with my home automation system 0-10v ?
This is irrelevant but my home automation system is Loxone. If need be I can interface it with a Domoticz device.
Can we plug two PCBs to control two circuits separately ?
Re: Nefit data/control via Arduino to Domoticz (directly without OpenTherm module or Easy)
Posted: Thursday 08 March 2018 16:34
by bbqkees
As I understand it everything eventually operates on the same EMS bus and therefore only one circuit board is needed.
To control the temperature you need to set the thermostats that are on the bus.
So you don't bypass the thermostats but you can override any setpoint they have.
But how this works specifically with the MM100 is unknown to me. Maybe the MM100 acts like a proxy and then you might need a second board for simplicity.
Furthermore the EMS interface circuit should be connected to a microcontroller like the Arduino because there is no control logic on it. It's just a signal level shifter.
If you would want to operate something with an analog voltage you could program an Arduino to take the voltage as an input I guess. But the logic needed inside is something you have to program yourself.
Re: Nefit data/control via Arduino to Domoticz (directly without OpenTherm module or Easy)
Posted: Thursday 08 March 2018 21:39
by Sungray
bbqkees wrote: ↑Thursday 08 March 2018 16:34
As I understand it everything eventually operates on the same EMS bus and therefore only one circuit board is needed.
To control the temperature you need to set the thermostats that are on the bus.
So you don't bypass the thermostats but you can override any setpoint they have.
But how this works specifically with the MM100 is unknown to me. Maybe the MM100 acts like a proxy and then you might need a second board for simplicity.
Furthermore the EMS interface circuit should be connected to a microcontroller like the Arduino because there is no control logic on it. It's just a signal level shifter.
If you would want to operate something with an analog voltage you could program an Arduino to take the voltage as an input I guess. But the logic needed inside is something you have to program yourself.
Thanks for your answer. I'm a programmer so the logic with the arduino part should be OK. If I can override the controls from the two thermostats then you're my savior.
As I understand it, one of the MM100 modules has an actuator valve and the other doesn't, using the start temperature of the heater. Anyway I'll have to fiddle with it, thankfully your documentation is extremely good.
Re: Nefit data/control via Arduino to Domoticz (directly without OpenTherm module or Easy)
Posted: Friday 16 March 2018 22:58
by WillemNL
My problem: Errors when uploading sketch into my Arduina Mega and no values in Domotics.
Lately I received my ordered EMS-board from bbqkees (thanks!) and connected all bits and pieces together to read out my Nefit boiler. So far so good... I installed the sketch and the serial monitor shows values, however when uploading the edited sketch I receive some errors regarding the ID's I have used.
Can anyone point me in the right direcion?
In Domoticz I created 3 virtual instruments with the ID's: 00082026, 1406B and 14069. The last one seems ok, but I receive errors on the first 2:
Edited part of the sketch:
int IDXcvpressure = 00082026; // Set here your own Domoticz ID's
int IDXburnerpower = 000;
int IDXburner = 000;
int IDXboiler = 000;
int IDXcvreturn = 1406B;
int IDXsupply = 14069;
int IDXhotwater = 000;
int IDXcvpump = 000;
Arduino error log while compiling sketch:
EMSbusReceiveEdit:187: error: invalid digit "8" in octal constant
int IDXcvpressure = 00082026; // Set here your own Domoticz ID's
^
EMSbusReceiveEdit:191: error: unable to find numeric literal operator 'operator""B'
int IDXcvreturn = 1406B;
Re: Nefit data/control via Arduino to Domoticz (directly without OpenTherm module or Easy)
Posted: Sunday 18 March 2018 15:09
by WillemNL
Problem solved

To couple the measurements to the right instruments in Domoticz I used their Idx numbers instead of the ID's and now it works!
For others who might struggle with this:
"Set here your own Domoticz ID's" should be: "Set here your own Domoticz Idx nrs"
Re: Nefit data/control via Arduino to Domoticz (directly without OpenTherm module or Easy)
Posted: Monday 19 March 2018 16:59
by bbqkees
Glad that it works.
On the
documentation/readme of the arduino code folder it mentions IDX as well.
Re: Nefit data/control via Arduino to Domoticz (directly without OpenTherm module or Easy)
Posted: Saturday 24 March 2018 19:42
by davidw
Hi bbqkees,
I get no output with the lines below. My output:
Code: Select all
New datagram found with Sender ID: Receiver ID: New datagram found with Sender ID: Receiver ID:
Where exactly do I need to add the extra lines?
bbqkees wrote: ↑Tuesday 09 January 2018 12:04
kapav,
You can add something like the following code to see which datagrams appear on the bus:
Place it in void loop between:
Code: Select all
if (crcCheckOK(buffer,ptr)){
nefitFrame2register(buffer,ptr);
Code: Select all
#if DEBUG
nefitSerial.print("New datagram found with Sender ID: ");
nefitSerial.print(buffer[0]); nefitSerial.print("Receiver ID: "); nefitSerial.print(buffer[1]);
nefitSerial.print("Frametype: "); nefitSerial.print(buffer[2]); nefitSerial.print("Offset: ");
nefitSerial.println(buffer[3]);
nefitSerial.println("------------------------");
#endif
For anyone that is interested, I added a lot of documentation and comments to the code on my Github page to make it easier to understand.
Re: Nefit data/control via Arduino to Domoticz (directly without OpenTherm module or Easy)
Posted: Tuesday 27 March 2018 10:01
by bbqkees
davidw wrote: ↑Saturday 24 March 2018 19:42
Hi bbqkees,
I get no output with the lines below. My output:
Code: Select all
New datagram found with Sender ID: Receiver ID: New datagram found with Sender ID: Receiver ID:
Where exactly do I need to add the extra lines?
Could be you did not put it in the correct spot so the buffer is already cleared or otherwise empty at that point.
After a succesful CRC check you know you received a valid datagram.
That's a good moment to print the buffer contents. The buffer contents can be anything from 4 to 32 bytes or so.
You can place the debug function after the opening bracket { and before the nefitFrame2register function.
You also need to set the #define DEBUG 1 line at the start of the sketch to 1.
I am going to add some additional helper sketches tot the Github page soon, one will include a simple dump/view function of the bus.
The older function you quoted does not print a whole datagram, just a piece of it.
Re: Nefit data/control via Arduino to Domoticz (directly without OpenTherm module or Easy)
Posted: Thursday 05 April 2018 11:07
by Pat0500
Hallo bbqkees,
I wanted to private message you but that is not possible for me becouse i dont have enough posts yet but my project is related with this post.
for my intershipment for my school i need to do an project and i selected energie monitoring.
my goal is to read and configure an nefit CV instalation with an arduino using labview software do you have any experience with that?
The comunication with arduino and labview is already done but is it possible to read out nefit and resol solarboiler with one arduino?
kind regards,
Patrick Postma
Re: Nefit data/control via Arduino to Domoticz (directly without OpenTherm module or Easy)
Posted: Thursday 05 April 2018 11:45
by bbqkees
No recent Labview experience here.
An Arduino Mega 2560 has 3 serial ports you can use simultaneously so both EMS and VBUS should be possible.
F.i. USB interface with pc/Labview with Serial0, EMS on Serial1 and VBUS on Serial2.
You would need to strip out the decoding part of f.i. my github projects for EMS and VBUS and interface that with Labview.
Re: Nefit data/control via Arduino to Domoticz (directly without OpenTherm module or Easy)
Posted: Thursday 05 April 2018 12:04
by Pat0500
Thank you for answering so quickly!!!
and thanks for the help.
i will get right into that and nice design on the ems PCB but i will probably try to make my own version in addition to my project.
Re: Nefit data/control via Arduino to Domoticz (directly without OpenTherm module or Easy)
Posted: Friday 06 April 2018 11:34
by remknul
Hi everybody, Kees,
I'm also inspired by this project and already have breadboarded prototype working.
I included opto-couplers between Arduino and the EMS bus electronics.
I also generated a 5V power from the EMS bus. Seems to work.
So far... thanks to Kees for all the info and Arduino code which gave me a good start.
I must admit I had to make quite some changes to the code of Kees, as it didn't work for me very well on the writing part.
Especially the flush commands on the UART did make the behaviour unstable. So I skipped those command on several places, and just read the bus after writing such that I see my own commands back. (it is a half-duplex bus, so this is expected behaviour).
For the time being I removed all Domoticz and ethernet related code and replaced it by print statements to the console.
Easier for debugging and learning/playing with the EMS bus protocol.
Since yesterday I'm able to change to temperature setting of my thermostaat (Nefit Moduline 100,
https://www.nefit.nl/consument/producte ... oduct_1159# ) !!
The Moduline 100 also uses bus-ID 0x17, just like the Moduline 200.
I'm able to read the current temp setting with the following command:
0x0B,0x97,0xB0,0x04,0x01,<CRC>,<BREAK>
And I'm able to write a new setting (0x29 = 41 = 20,5 degrees) with the following command:
0x0B,0x17,0xB0,0x04,0x29,<CRC>,<BREAK>
I'm still wondering if it is also possible to read the current room temperature from the Moduline 100.
Anybody a suggestion?
My next goal is to put the ethernet shield back on the Arduino, and write daemon code. So not a client which pushes data, but a daemon to which clients on my network can connect. I'm really thinking about keeping the Arduino software as 'stupid' as possible and only act as a bridge between commands send and received over the TCP/IP socket and the EMS bus. This way it is very flexible to connect to any other system, which can be Domoticz too of course.
To be continued...
-Remco
Re: Nefit data/control via Arduino to Domoticz (directly without OpenTherm module or Easy)
Posted: Friday 06 April 2018 11:55
by bbqkees
Great progress Remco.
Indeed writing can be a bit tricky, the half-duplex bus is prone to collisions.
I don't know if the Moduline 100 provides message HK1MonitorMessage 0x3E, but that is I believe the only one that has the current room temperature (Raumtemperatur Ist). Or maybe RCTempMessage 0xA3 (Raum-Ist).
I still need to dig into writing to the bus myself. Although I tested it a bit, until now I did not really need it because I do not have an EMS thermostat but an on/off zone system.
But I got so many questions lately about writing to the bus so last week I bought a secondhand Moduline 400 just for testing.
Maybe that's an idea for you too if you can't get the current room temperature from the Moduline 100.
I got the Moduline 400 for just 35 Euro on Marktplaats.
Re: Nefit data/control via Arduino to Domoticz (directly without OpenTherm module or Easy)
Posted: Friday 06 April 2018 12:13
by bbqkees
Remco maybe you can try out RC20StatusMessage 0xAE
Re: Nefit data/control via Arduino to Domoticz (directly without OpenTherm module or Easy)
Posted: Friday 06 April 2018 15:15
by remknul
I'll try the 0xAE telegram later. I haven't seen it broadcasted before. (I made some dumps)
Perhaps I can request it by a read action.
From the dumps I made earlier, one of the telegrams I do see broadcasted on the bus is the following:
17:00:B1:00:04:26:00:CD:00:00:00:CD
0x04 ??? flags ??
0x26 seems to be equal to the set room temperature
0x00:0xCD could be the current room temp which then would be 20.5 degrees Celsius. (if it is multiplied by 10)
0x00:0x00 ?????
0x00:0xCD Another temp ??? What the difference is between the first and the second 0xCD, I don't know.
I have to follow these variables over time to verify if it indeed follows the room temperature on the display of the Moduline100.
Re: Nefit data/control via Arduino to Domoticz (directly without OpenTherm module or Easy)
Posted: Friday 06 April 2018 15:35
by bbqkees
Do you see a message 0x91?
According to the array in my sketch this should contain the room temperature, at least for the Moduline 200.
You can quickly test if CD is the actual room temperature by pointing a hair dryer at the thermostat.
Re: Nefit data/control via Arduino to Domoticz (directly without OpenTherm module or Easy)
Posted: Friday 06 April 2018 15:42
by remknul
Never seen a 0x91 passing by on the bus.
The hair dryer is indeed a good tip! thx