Nilan VP18 vs OpenHAB
We provide tutorial for the connection of the active Nilan recuperation unit, in our case the VP18 K WT type with OpenHAB 3. By communicating via Modbus it is possible to read the whole range of values, but mainly also to control the unit through OpenHAB. This allows us to remotely or programmatically change the performance and ventilation settings depending on the mode (night, cooking, etc.)
Hardware
USB to RS485 adapter
Pi-Home - see section How to
Software
OpenHAB 3
Wirin Nilan and USB -> RS485 dongle
We have ~ 5m distance between ventilation unit USB-RS485 dongle. We used classic Cat 5 UTP cable for wiring.
Brown - > A1 - A
Orange -> B1 - B
Blue -> GND - GND
Configuration of USB -> RS485 dongle
In this tutorial we have tested Raspberry Pi 4 8GB board with OpenHAB 3.4 installed. We have exactly this model of converter, but other similar models should work as well. Critical is setting UDEV rule to create symlink to /dev/tty*. When selecting the default (e.g. /dev/ttyUSB0) it didn't work in OpenHAB 3 and it listed an error for us, so this step is crucial!.
Let's go. Connect USB-RS485 dongle to Rpi. Connect to Rpi via SSH. Add user openhab to groups dialout and tty:
$ sudo adduser openhab dialout
$ sudo adduser openhab tty
then shows detials about your converter:
$ sudo lsusb -v | grep 'idVendor\|idProduct\|iProduct\|iSerial'
You should get similar inforamtion as below. Focuse to green rectangle.
Write down values for idVendor, idProduct and iserial. Then add UDEV rule, which creates symlink
and gives the path"ttyUSB-RS485"
$ sudo nano /etc/udev/rules.d/99-usb-serial.rules
copy row below (edit based on your values!)
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="AG0JHQYU", SYMLINK+="ttyUSB-RS485"
Restart Rpi.
Application
After the restart, go to OpenHAB. In the Settings -> Bindings section, install the binding Modbus. On the Other tab, install the Javascript Transformation extension. You can use Search as well.
After installing the extension, go to Things and add a new entry with the icon + -> Modbus Binding -> Modbus Serial Slave
Fill the values according to the picture below:
Modbus Serial Slave should be in "Online" state. Then we add another thing, icon + -> Modbus Binding -> Regular Poll. Fill in as follows:
We add two more things + -> Modbus Binding ->Modbus Data.
First Thing provides On/Off switching of the Nilan unit:
Second Thing provides ventilation setting:
All you have to do is add your own Items. If you click on Channel and select Add Equipment to Model at the bottom, you can create an Item directly. Select "Value as Switch" type and fill in Name and Label, you can add an icon (Category):
Same for ventilation setting:
See result as example when you present new items in Overview pane:
Of course, you can add lots of other Regular Polls and Modbus Data. For a complete list of values that can be read or set, see the Modbus Protocol Guide for VP18 below. If there are multiple values, you don't have to click it in Things and Items, but you can always add these values in bulk either by importing or copying the *.items and *.things files to their respective directories in OpenHAB conf. We attached configuration of items and things with multiple values (temperatures, controls). There are also transformations that adjust the values from Nilan (ie. temperature reads *100 needs to correct the value at final)
Sources
https://community.openhab.org/t/how-to-connect-nilan-cts602-modbus-interface/71263
Add comment