OpenHAB1/2 Nilan heatpump

Maybe I can reply here with my observations relating to Nilan-integration as previous post was moved to area where it wasnt noticed by anyone…Nilan 602/Raspberry/openhab2

Shortly, looking for stable environment for Nilan communication setup on Raspberry3, versions and installations proven to work, aka. “minimal setup”.

I have now installed Openhab2 2.4 from scratch 2 times on Rpi with exactly same results, i.e. Nilan connection does not work. (Python script for connection test works however) These instruction followed: https://www.openhab.org/docs/installation/linux.html#installation. Last line in log is still the same:

2019-03-24 17:04:41.306 [WARN ] [rm.AbstractFileTransformationService] - Could not transform ‘-’ with the file ‘nilan_program_select.map’ : Target value not found in map for ‘-’

First of all…
All warnings about transformation should be ignore in the first place. Transformation is just… transformation. It transformate a value from one text to another text. If your device for some reason does not read the first text, then ofcouse transformation wouldn´t work either. But it has nothing to do with your original problem. It´s just an indication that something else is wrong, in your situation…

Anyway…
It´s very unclear to me, which version of openhab you have installed (how you installed it, ie manual or from an image on an Rpi etc…
Second. It´s unclear which modbus binding you have installed. There are two modbus bindings. So this information is required as well.
Third… You´ll need to post your modbus configuration as well. Without it´s impossible to help.

A common treatment for that would be to edit the file nilan_program_select.map and add a line like
-=unknown
The underlying cause is probably a NULL Item.

Thanks a lot for prompt comments!

Starting from Kim’s reply.

I have version pi@raspberrypi:~ $ openhab-cli info
Version: 2.4.0 (Build)

I Installed it using Package Repository option,
pi@raspberrypi:~ $ cat /etc/apt/sources.list.d/openhab2.list
deb https://dl.bintray.com/openhab/apt-repo2 stable main

About MOdbus binding:
Modbus Binding
binding-modbus - 2.4.0

openhab console:
209 ? Active ? 80 ? 2.4.0 ? Modbus Binding
210 ? Active ? 80 ? 2.4.0 ? openHAB MODBUS Transport Bundle

Modbus.cfg copied as such from https://github.com/starze/openhab2

Then for rossko57:

You are right, after adding those lines in each of *.map files, no WARNs anymore, last log line is now:

2019-03-24 19:15:26.079 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Error during the execution of startup rule ‘nilan date items concatenation’: For input string: “NULL”

is useless for Modbus binding v2, that file is for binding v1.x
v2 binding is configured with things and channels, as per the docs
You can run v1.x under OH2 but must remove v2

ok…in princible what should be done is similar than in example Modbus Binding V1 -> V2 Config Update Howto ?
Didnt find Modbus 1.x binding any more as it was stated Obsolete in https://www.openhab.org/addons/bindings/modbus1/

What might be last version of OpenHab2 that comes with 1.x binding, this is probably easiest way to get communication working…

Dear @jin, the last version that used the modbus 1.x binding was OpenHAB 2.3

If you set paperUI to include legacy bindings, I think V1 modbus is there. But I´m not sure to be honest.
I would suggest to move to the 2.4 binding. It isn´t that hard to get working… I plan to release my setup for the CTS602 interface to be included in the docs. But I´m not sure when this will happen.

1 Like

Guys, you are genius!! I did what Kim proposed - there were 1.x* binding available when enabled- restarted OH. Only error related to access rights on /dev/ttyUSB0, just added rw-rights for “others”.

crw-rw-rw- 1 root dialout 188, 0 Mar 24 20:54 /dev/ttyUSB0

Basic UI woke up at once!

thanks a lot!

Hi Kim, I’m thinking of moving to modbus2.x as well, is there anything you could release up front?

I can provide the files (as is) now, if you want to have a look. But be prepared, some of the information has been translated to danish… I´m about to translate it back to english :slight_smile: I had hope to get through the rest this weekend, but I had alot of work to do. And right now I´m doing some tests with my Zigbee stuff.

I’d be pleased to take a look at some danish words… :slight_smile:

Last time (similar scenario) starze and I collaborated do bring up a vanilla version, which worked pretty well. We created a repository where we committed a vanilla config version.

Okay, I´ll put up the files somewhere later today…

Perhaps we can do the same again… The channels are the same, just a different way of setting up the modbus things and do the linking.

There will be a need of someone with a CTS602 interface including a heater. My Nilan Comfort 300LR do have this option of adding heating plates (before and after exhaust). But I have not added these. Therefore I havn´t added the modbus registers for the heaters or settings of the heaters either.
I recall you got a heater, (Nilan Heatpump with CTS602 interface) right? It would be suitable if you could do these registers then. And we´ll end up with setup files for CTS602 with and without heaters…
The same goes for the CO2 sensors as well. I do not have this CO2 sensor either. But it´s an option in the CTS602 interface, so it should be noticed (and tested if possible).

Last thing - Even though there are modbus registers for reading the display text, I have not yet been able to get anything useable from the values I receive… I get strange numbers and not text. I have no idea how to deal with this. And no idea if this is a Nilan, modbus or openhab issue. I think it might be a transform issue. I just havn´t got a clue how to transform a number (which will change) into an ascii/text like this… Since the display of the Nilan CTS602 uses modbus as well, I should be possible to get something readable/usefull in someway. I just cant figure how to. Perhaps it´s not possible with openhab.

Modbus is just 16-bit numbers, no more, no less.
So there is no way to pass text around directly.
Of course, any designer can come with some scheme to encode text, this happens all the time in any computer system.

So here your task would be to guess what scheme Nilan decided to use. There’s a couple of likely choices, as you’ve already guessed probably involving ASCII coding. Perhaps a character count as well. But individual characters in registers, or packed two to a register in bytes, or?? Maybe there is colour or highlighting info packed in as well.

A first approach would be to use the clues you already have to extract a block of raw data in hex format (non openHAB modbus tool likely best for that) and eyeball it for familiar patterns.

Once the encoding scheme is understood and data can be captured, openHAB can also decode it. It’s only numbers remember, so it can be decoded with a transform or script.

Thanks rossko.
I hear you, but I have no idea how to on this issue…
According to the Nilan CTS602 modbus doc https://reader.livedition.dk/nilan/272/html5/ (page 8-9) its ascii. But I have no idea how to get from numbers to ascii, since that part isn´t explain in the modbus doc. And I can´t find any pattern in this…
This is how it looks right now:

The external (original) LCD display for the Nilan Comfort is connected through modbus as well. So I would assume there has to be some way to transform these numbers into text. Thats the part I cant figure probably due to my lack of knowledge.

The items is set up as String types… But I guess that shouldn´t matter in this situation.

A float has two bytes. You gotta mask out high and low bytes separately and transform them into ASCII.

In python3 that would look like this:

>>> def toChars(float):
...  print(chr(float & 0xFF), end="")
...  print(chr(float >> 8), end="", flush=True)
... 
>>> toChars(21825); toChars(20308); toChars(8224); toChars(8224); toChars(12606); toChars(8252); toChars(13106); toChars(17375)
AUTO    >1< 23ßC

Lower byte - mask out everything but least significant 8 bits - chr(float & 0xFF)
Upper byte - move everything 8 bits to the right, which brings the upper 8 bits down to the lower ones, kicking out the 8 lower bits - chr(float >> 8)

However, I wouldn’t do any of that because those are information which you are going to get by reading the other registers anyway.

The CTS602 by default is able to use the heat-pump to heat up air or water - which is what I have. To point the following out: There is an optional electrical heating element available (that’s what I do not have).
Are the registers between CTS602 and 300LR the same?

We should start a new thread for this…

Thats way above my knowledge… No wonder why I couldnt figure that part :grin:

I know… But if someone would like to simulate the LCD display, it is possible… For the value itself, it makes no sense, I agree.

The CTS602 is the interface (the actual board/print inside the agregate/Plant). It´s used for several different models (Plants) of Nilan plants.
Comfort 300LR is a ventilation Plant, not a heatpump. But Comfort 300LR has an option of adding waterbased heating or electrical heating plates. It´s an option, and because of that, the CTS602 would have to support it as well. When heating plates are not added, then I´ll receive no values when reading the registers, (ofcouse). The CTS602 is still the same, in my Comfort 300LR and yours whatever-nilan-Plant-that-is :slight_smile: And therefore the registers are all the same…
If you look at the modbus doc for the Nilan CTS602, you´ll see which systems each registers are applying to (list of plant types to the right of all the registers pages). For my system, I have added all the registers to the Comfort plant, but without the heating registers. If someone has the Comfort plant with heating plates, they´ll have to add these registers as well as those I have.

We should. And this new thread should be named “Nilan CTS602 Modbus” then. Then we can take it from there, cause there will be alot of different ways to show examples, like the modbus interface (TCP or Serial) as well as the different Nilan plants.

After 2 years Nilan and Openhab started to be intresting. Just got preinstalled Openhabian working.

What is todays best practice to get data from CTS602 with new Openhab? Quite a lot of things have changed on Openhab side.

Not really that difficult. You’ll need at rs485 to modbus, either as serial /USB or perhaps rs485 ethernet to modbus converter. From there it is just as simple af adding other stuff to openhab.

1 Like