How to connect Nilan CTS602 modbus interface

Adding a MAP to your Item’s display format will never change the state of the Item, or the commands to the Item, and so would never affect how it interacts with any binding.

The error is nothing to do with this.

The Nilan docs I looked at point out that the CTS-602 only accepts the FC16 “multiple write” Modbus command, so I would expect an error.
You have forgotten the writeMultipleEvenWithSingleRegisterOrCoil parameter in your data Thing.

Modbus is so simple that it means every device manufacturer can do things in completely different ways.

Nope I have it in my holding register 123:

  Bridge poller holdingRegisters [ start=100, length=28, refresh=6000, type="holding" ] {
      Thing data hol100 [ readStart="100", readValueType="int16" ]
      Thing data hol102 [ readStart="102", readValueType="int16" ]
      Thing data hol103 [ readStart="103", readValueType="int16" ]
      Thing data hol123 [ readStart="123", readValueType="int16", writeStart="123", writeValueType="int16", writeType="holding", writeMultipleEvenWithSingleRegisterOrCoil="true" ]
      Thing data hol125 [ readStart="125", readValueType="int16", writeStart="125", writeValueType="int16", writeType="holding" ]
      Thing data hol126 [ readStart="126", readValueType="int16", writeStart="126", writeValueType="int16", writeType="holding" ]
   }

I havn´t used register 125 and 126, yet… They will probably fail as well.

It´s not simple… Even thrying to find the length of the addresses to read is a real pain. I always got it wrong, or modbus binding is pulling tricks on me.

Forgot to answer this…
When I remove the mapping, I no longer get the error when I activate the swicth from openhab.
So it has to have something to do with it.

Experimented to see that binding DEBUG messages do correctly distinguish WRITE_SINGLE_REGISTER from WRITE_MULTIPLE_REGISTERS.

On looking closer, your data Thing parameter is not set correctly, so it’s ineffective. Not -
writeMultipleEvenWithSingleRegisterOrCoil="true"
but
writeMultipleEvenWithSingleRegisterOrCoil=true
Per the docs, it’s a bool not text.

We already know the Nilan ignores write-single, so it’d always return an error the way it was. Think you have some more trials to do !!

I also experimented with your exact MAP in a Switch type Item [format], and obtained exactly no difference in Modbus behaviour, whatever else your xxx.items file editing did, it wasn’t that. Bear in mind errors were to be expected either way here, with the write-single fault.

I will try again tomorrow… I positive this has to work… I just need to figure how.

Hi, I’ve followed the instructions in the first post and created all the files and placed the in all folders (including maps).
I get “Modbus Serial Slave on-line” under things, but the communication to the CTS seems not to work (all Data and Poll things are “offline”).
My dongle is a DSD TECH SH-U10 USB to RS485 Converter with CP2102 Chip.

My Nilan comfort 150 is a version 3 with the 8 poled plug (can only post one image…).

In the log I repeatedly see these errors:

2020-10-07 19:11:28.226 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 3 failed when executing request (ModbusReadRequestBlueprint@1937d13[slaveId=30,functionCode=READ_INPUT_REGISTERS,start=200,length=23,maxTries=3]). Aborting. Error was I/O error, so reseting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: IOException Error reading response (EOF) [operation ID 7e2ace94-0bcc-41de-8b21-f73293a62e8f]

2020-10-07 19:11:29.846 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 3 failed when executing request (ModbusReadRequestBlueprint@fb2d73[slaveId=30,functionCode=READ_INPUT_REGISTERS,start=400,length=10,maxTries=3]). Aborting. Error was I/O error, so reseting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: IOException Error reading response (EOF) [operation ID 38e15cc0-7748-47ab-a00f-abff553fcb5c]

2020-10-07 19:11:31.467 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 3 failed when executing request (ModbusReadRequestBlueprint@12074ee[slaveId=30,functionCode=READ_INPUT_REGISTERS,start=1000,length=4,maxTries=3]). Aborting. Error was I/O error, so reseting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: IOException Error reading response (EOF) [operation ID ba65b904-7ba7-4a12-baa1-323d10929aaa]

2020-10-07 19:11:33.086 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 3 failed when executing request (ModbusReadRequestBlueprint@15eb62e[slaveId=30,functionCode=READ_INPUT_REGISTERS,start=1100,length=5,maxTries=3]). Aborting. Error was I/O error, so reseting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: IOException Error reading response (EOF) [operation ID 3d1fb41b-a19b-4a7b-8595-983207cbcf63]

2020-10-07 19:11:34.706 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 3 failed when executing request (ModbusReadRequestBlueprint@b9f73b[slaveId=30,functionCode=READ_INPUT_REGISTERS,start=1200,length=7,maxTries=3]). Aborting. Error was I/O error, so reseting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: IOException Error reading response (EOF) [operation ID 1ca47e73-0254-4aab-b690-1b531dfe460e]

Any suggestions to what I should try to troubleshoot?

BR/Tom

Here is the Nilan plug:

Fancy thing, with twinkly lights. Do they twinkle? I’d hope to see Tx but am curious about Rx.

What have you connected to which?

A+ to Nilan pin 7
B- to Nilan pin 6
GND to Nilan pin 1

Yes, Tx blinks every 2 seconds or so, I have not seen Rx blink.
Could it be my Nilan that have a different baud=19200 or perhaps the id from the things file?
It is a fresh installation of openHABian 1.6
Only other thing is an IKEA hub to test that the installation worked.
And cable is 2 meters of Cat 6 using one pair for A+/B-.

Hi Mogens, I may have the same problem with my Nilan Comfort 150 with a 8 pin plug - how did you check this - what panel can you unmount to check?
Can you send a link to the post you have seen this in?
Thanks, Tom

Okay, that agrees with the error log. No response from your Nilan.

Of course it could be possible.

Hi Tom, I remember that I took off the side panel and could see that nothing was attached to the two pins on the print plate. So I connected to the plug and carried the wiring through. Suspect that Nilan nowadays - for reasons I do not understand - do not carry these wires through. A shame as this complicates things unnecessary. I’m by no means an electrician, but with knowledege about the print it was actually not a difficult job.
Good luck with your project:slightly_smiling_face:

Actually you probably need to take off the back panel first. If its the same as comfort 300LR, then there are two screws behind the backpanel, which hold the case for the printboard. Unscreew these screws, and one screw on the front. Then you will be able to pull out the case (printboard) from the front side.
Its a kinda mess, but possible when you first get the picture.

Hi all, I am new here, do you guys know if I can send data from my Nilan Comfort to my IoT dashboard using a modbus to IoT converter-endnode? I have running a IoT gateway myself. Does anyone here tried this already?

1 Like

Thank you Kim_Andersen for this topic. I can confirm that I was able to connect with Nilan VP18 K WT and OpenHAB 3.4 on Raspberry Pi 4.

Just few notes: I have to set UDEV rule for symlink USB-RS485 converter as default /dev/ttyUSB0 gives me error in OpenHAB when creates Regular Poll. This is a must.

Other steps are similar to your tutorial and works great. Thank you. We also provide step-by-step tutorial on our blog here

1 Like

Hi @Kim_Andersen

Thank you fellow dane for doing this write up! However I’m having a bit of trouble. I’ve followed your guide, but unfortunately 5 out of 17 “Regular Poll” are in error state. I have checked the documentation here and it all seems to be correct. Any suggestions of what might be wrong? I’m using this USB.

The error message is identical for all that are in error state.

2023-02-07 21:37:23.993 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=30, functionCode=READ_MULTIPLE_REGISTERS, start=1100, length=2, maxTries=3]). Aborting. Error was I/O error, so resetting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: IOException CRC Error in received frame. 0 bytes of payload () with invalid CRC of 1e 83  [operation ID ceda9c09-27d3-467a-afc9-222524d5b414]

Any help will be much appreciated! Thanks :slightly_smiling_face: :pray:

I believe I have found the reason. For example for InputRegisters, the documentation shows that registers 201-202, 205-206 and 210-220 are missing:
image

If I only set start to 200 and length to 1 it works. If I set start to 207 and length to 3 it works. Interesting… and very frustrating! But at least I have a goal now to make specific ranges for only known registers.

Sorry for late reply…

I recall I had the same issue trying to find the length of the register. I dont actually recall how I managed it, but I think I made the length as far as to the next available register.

I havnt used it for 1½ year, as I moved to a new house, where I have a Fronius solar system.

EDIT:

Guide for OH4-transform feature: OH 4 – Replacing MQTT JS transformation to SCRIPT transformation - #20 by reyhard

Remember to install the JS add-on “Javascript Scripting”.

Hi
Once again, thanks a lot for the job - working smooth for two years here at my place in Denmark.

BUT - did anyone re-write the transform-files so that they fit OH4 - then I do not want to start trying figuring it out (not that much into this stuff :slight_smile: )

I didnt.
Since I moved to a new place 2 years ago, I have no longer at Nilan device. Now I have a a Genvex GE2 insted, (though its almost the same as the Nilan). And I´m still working on the setup for this. I have it up running via modbus, but scripting etc stil missing. I might start all over insted of trying to translate the OH3 to OH4.