Openhab / Nilan EC9 (VP18CEK) / Modbus binding


I’ve been trying to get Openhab and Nilan EC9 (VP19CEK) communicating but so far without any real results.

My current setup is:

Modbus binding:



write out nilan connection


Modpoll with command “Modpoll COM2” doesn’t seem to find anything.

It’s a little suspicious that TX/RX lights blink only when I plug in the USB-interface
After couple of weeks the great ideas are coming to end. Any help from professionals? :slight_smile:


The logs:

2016-12-10 18:40:15.953 [INFO ] [.o.core.internal.CoreActivator] - openHAB runtime has been started (v1.8.3).
2016-12-10 18:40:20.500 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl] - mDNS service has been started
2016-12-10 18:40:21.078 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl] - Service Discovery initialization completed.
2016-12-10 18:40:29.125 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'demo.sitemap’
2016-12-10 18:40:29.593 [INFO ] [] - Started REST API at /rest
2016-12-10 18:40:34.953 [INFO ] [.o.u.w.i.servlet.WebAppServlet] - Started Classic UI at /classicui/
2016-12-10 18:40:40.109 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'nilanrules.rules’
2016-12-10 18:40:42.468 [ERROR] [.o.m.r.i.engine.ExecuteRuleJob] - Error during the execution of rule nilan t0-15 sensor division
java.lang.RuntimeException: The name ‘heat_nilan’ cannot be resolved to an item or type.
at org.openhab.model.script.interpreter.ScriptInterpreter.internalFeatureCallDispatch( ~[na:na]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._evaluateAbstractFeatureCall( ~[na:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_111]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_111]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_111]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_111]
at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(


Modbus problem or something else?

Please follow the trouble shooting steps in the wiki

Hope it works for you!


For serial, it is really worth using Modbus binding version 1.9 not the bundled 1.8.3 version

Lights on which end? But yes, if Modpoll doesn’t work either you need to look at basics - baud settings, wiring, COM port etc.

RS485 markings for A/B wires can be inconsistent sometimes, worth swapping to try?
Using an old mains cable as RS485 really isn’t going to work well, this ought to be twisted pair - a pair in a Cat5 cable do.
Please try to keep signal cables away from mains power cables, for safety as well as interference.

Thanks for good tips!

Made some changes and updates based on your comments:


  • Changed the cable to CAT5e
  • Updated modbus binding to 1.9
  • Tested connection with Nickma82 connection tester: seems to work?


Something is still broken but I can’t figure out what.

This is maybe the biggest question:
18:11:47.494 [ERROR] [.o.m.r.i.engine.ExecuteRuleJob:57 ] - Error during the execution of rule nilan t0-15 sensor division
java.lang.RuntimeException: The name ‘heat_nilan’ cannot be resolved to an item or type.

Thanks for the update!

It looks like the items are not parsed or what? Can you paste the configurations as is, without combining different configurations to same file. I’m thinking of syntax issue preventing anything working??

At least there is no modbus mentioned in the logs so it’s something with the actual configurations

Perhaps you should try to continue the troubleshooting and have minimal configuration.



  • Renamed nilan.item -> nilan.items like it should be.

nilan.item //BIG error here. Should be nilan.items not nilan.item FIXED


19:57:10.002 [DEBUG] [.o.m.r.i.engine.ExecuteRuleJob:53   ] - Executing scheduled rule 'nilan t0-15 sensor division'
19:57:10.934 [ERROR] [o.u.i.items.ItemUIRegistryImpl:438  ] - Cannot retrieve item nilan for widget org.openhab.model.sitemap.Text


  • Sitemap loads icons.
  • No data in sitemap

you might want to remove the default openhab cfg as it is being loaded as well

 19:56:26.693 [DEBUG] [o.config.core.ConfigDispatcher:146  ] - Processing openHAB default configuration file 'c:\NILAN\configurations\openhab_default.cfg'.
 19:56:26.783 [DEBUG] [o.config.core.ConfigDispatcher:168  ] - Processing openHAB main configuration file 'c:\NILAN\configurations\openhab.cfg'.

Also, as far as I can see there is no item called ‘nilan’, so the error is expected? Perhaps the sitemap is wrong?

Also, the modbus configuration is wrong in openhab cfg :


There is no such parameter. See wiki for the “poll” parameter


The connection to the device (instrument) looks good. Reading from and writing to the device is successful.

Link to the connection tester

Alllrightey… Things go forward step-by-step. I’ve been watching Notepad++ for like 6hrs today :slight_smile:

After couple of tests/changes I think I managed to fix some things.


  • Fixed the modpoll (modbus:poll=2000) Still a bit open what it should be.
  • Fixed settings for RS485-USB converter (see pictures attached at bottom)
  • Copied once again accidentally deleted org.openhab.binding.modbus-1.9.0-SNAPSHOT.jar


  • I can change fan speed in Nilan
  • I can change operation mode in Nilan
  • No temperatures showing in sitemap
  • Modbus related error in logs


Error in log

22:32:49.003 [DEBUG] [.o.m.r.i.engine.ExecuteRuleJob:53 ] - Executing scheduled rule ‘nilan t0-15 sensor division’
22:32:49.891 [ERROR] [ ] - Last request: 1e 04 00 c8 00 10 72 57
22:32:49.892 [ERROR] [ ] - failed to read: Error reading response (EOF)
22:32:49.910 [ERROR] [ ] - execute try 1/3 error: I/O exception - failed to read. Request: net.wimpi.modbus.msg.ReadInputRegistersRequest@18894 (unit id 30 & transaction 8). Serial parameters: SerialParameters@1398d43[portName=COM3,baudRate=19200,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=even,encoding=rtu,echo=false,receiveTimeoutMillis=1500]
22:32:49.980 [INFO ] [ ] - execute eventually succeeded with 1 re-tries. Request: net.wimpi.modbus.msg.ReadInputRegistersRequest@18894. Serial parameters: SerialParameters@1398d43[portName=COM3,baudRate=19200,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=even,encoding=rtu,echo=false,receiveTimeoutMillis=1500]
22:32:50.004 [DEBUG] [.o.m.r.i.engine.ExecuteRuleJob:53 ] - Executing scheduled rule ‘nilan t0-15 sensor division’

Should the “Receive (Bytes)” be lower? Nilan manual says “Packet size: Max. 255 bytes”

These are as described in Nilan manual

Hopefully I can write a short wiki if this thing gets working. I have feeling that we have other Nilan EC9 users also here in Finland.

Nice progress!

Regarding error in the logs: Note that read is eventually successfull on second try.

Does the log reveal cases where three retries is not enough?

Do not know what the usb parameter means, have not worked with these really… It’s possible that tuning those parameters help but not sure really. Remember to restart openhab if you change parameters.

Do you have anything in the events log? I wonder why the temperatures are missing if the modbus reads successfully. Do you have any other errors in the logs?

I would like you to try out an experimental modbus binding that tries to read again even though the serial library returns EOF (end of file). I will come back to this next week.


New day, new changes:


  • No changes to configuration except logging:
  • Added to logback_debug.xml:
<logger name="net.wimpi.modbus" level="TRACE" />
<logger name="org.openhab.binding.modbus" level="TRACE" />


No win today.

Actually if you read the log carefully you can note that reads are successful.

execute eventually succeeded with 1 re-tries.

What do you get in the events log?



Seems to be ok

2016-12-12 18:35:31 - nilan_onoff state updated to ON
2016-12-12 18:35:31 - nilan_user_operation_mode state updated to 3
2016-12-12 18:35:31 - nilan_vent state updated to 1
2016-12-12 18:35:31 - nilan_user_tempset state updated to 3000
2016-12-12 19:09:46 - nilan_onoff state updated to ON
2016-12-12 19:09:46 - nilan_user_operation_mode state updated to 3
2016-12-12 19:09:46 - nilan_vent state updated to 1
2016-12-12 19:09:46 - nilan_user_tempset state updated to 3000
2016-12-12 19:16:16 - nilan_vent state updated to 2

I have a feeling that it might be something to do with items or the sitemap maybe.It’s still a bit mystery why it shows everything except none of the temperatures.

Are these in sync?

Text item=nilan_t8_div

Number nilan_t8_div “Outdoor (t8) [%2.2f °C]” (nilan_aggregated)

I don’t see any div item updates? Perhaps it helps to add logging statements to the rule file?


Is that supposed to linked to a Modbus device, or is it updated by some rule we cannot see?

Rossko57: here’s my configuration currently. Strange that it shows everything except measured temperatures.


/* nilan computations */
rule "nilan t0-15 sensor division"
    Time cron "0/1 * * * * ?" or
    System started
    heat_nilan?.members.forEach(sourceEl| {
            var Number temp = (sourceEl.state as DecimalType) 
            if(temp > 0x8000) {temp = temp - 0xFFFF }
            temp = temp / 100

            nilan_aggregated?.members.forEach[targetEl |
                if( == + "_div"){
                    postUpdate(targetEl, temp)
                } ]

I’m no professional coder and the rules are pure copy from Nickma82 great work done here in Modbus binding sample config:

One forEach has a ( bracket, one a [ bracket, not sure what the effect of that is.

As Sami said, add some logging in your rule

Hi Sami @nodeco,
how is your status?

A lot of changes found their way, please see:

Best, Nick