MODBUS and System air

modbus
Tags: #<Tag:0x00007f0148be4880>

(Gunnar Skjold) #41

I’m struggling with this as well. I’ve tried a cheap ch341 device as well as a ftdi device, but I can’t get any of them to work…

I hooked up pin4 to B and pin5 to A and plugged the RJ45 into the connector on the top of my VTR300. Sounds about right? Used the suggested config further up, but no luck…

For those who got it to work, how is the modbus config on the villavent unit? I noticed there is a meny under modbus which is called “gateway”, and on mine it says “not present”. Not sure what it means or if it is relevant.


(Kim Skatun) #42

So today i connected my usb modem directly to my laptop and used baudrate 9600 in the arduino serial monitor and this came out:

UUU⸮⸮]⸮⸮⸮UU⸮]]R]U⸮Pu⸮P⸮

at rapid speed, does that mean the wiring works?, when i swapped A and B nothing came out.

Same rubbish when I changed the setting to 19200 in the systemair, is this normal. Is it some kind of binary prototcol and not ascii?


(Gunnar Skjold) #43

Sounds to me like you are getting data. RTU is not ASCII from what I can tell, so its probably right. I don’t get anything out of my serial adapter though, so I must be doing something wrong…

For reference, I have this udev rule to create softlink, set permissions and owner for the serial device:
SUBSYSTEM==“tty”, ATTRS{idVendor}==“0403”, ATTRS{idProduct}==“6001”, OWNER=“openhab”, MODE=“0600”, SYMLINK+=“modbus”

This gives me:
ls -al /dev/ttyUSB0 /dev/modbus
lrwxrwxrwx 1 root root 7 sep. 19 22:22 /dev/modbus -> ttyUSB0
crw------- 1 openhab dialout 188, 0 sep. 22 09:51 /dev/ttyUSB0

In /etc/defaults/openhab2 I also have:
EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/modbus"

Which is something I understand is often necessary for making serial ports work in openhab. I have a similar setup for my zwave dongle which works, so I think this should be sufficient.


(Kim Skatun) #44

I asked system air and they said I need to connect it to the modbus port and not the control panel port, so I need to take the saw to get of the lid to connect the wires, I will see what I manage todo by the end of the month…


(Gunnar Skjold) #45

When you get connected, you can test this tool:
http://www.focus-sw.com/fieldtalk/modpoll.html

I dont get any data, but I have probably f***ed up somewhere… Going to check the internal wiring since I have connected to the plug at the top.


(Kim Skatun) #46

Hi, I get this error:

2017-09-30 13:47:32.390 [ERROR] [.binding.modbus.internal.ModbusSlave] - ModbusSlave (fan): Error getting modbus data for request net.wimpi.modbus.msg.ReadMultipleRegistersRequest@1eb21e1. Error: I/O exception - failed to read. Endpoint ModbusSerialSlaveEndpoint@1386d57[portName=/dev/ttyUSB0]. Connection: SerialConnection@14a68b8[portName=/dev/ttyUSB0,port=/dev/ttyUSB0]

Is wiring or USB port wrong?

I have two usb things attached:

[13:39:39] pi@openHABianPi2:~$ lsusb
Bus 001 Device 005: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 001 Device 004: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[13:40:36] pi@openHABianPi2:~$ sudo lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
        |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=smsc95xx, 480M
        |__ Port 2: Dev 4, If 0, Class=Vendor Specific Class, Driver=usbfs, 12M
        |__ Port 4: Dev 5, If 0, Class=Vendor Specific Class, Driver=ch341, 12M
[13:40:45] pi@openHABianPi2:~$ ls /dev/ttyUSB*
/dev/ttyUSB0
[13:42:12] pi@openHABianPi2:~$

how to know which is usb0 and not?


(Gunnar Skjold) #47

Your USB devices have different drivers. You can check which driver is used for a device by using:

udevadm info --query=all /dev/ttyUSB0

You can find something like:

E: ID_USB_DRIVER=ch341

Which will match the Driver from lsusb -t


(Gunnar Skjold) #48

After fighting with serial port problems in OH (which was caused by lgtvserial binding), I have now successfully connected my VTR300 to openhab with a FTDI USB-RS485-PCB. Modbus have been set to 9600 baud and address 1 via the control panel on the unit. I’m adding my OH config below for reference.

I have this is my modbus.cfg file:

serial.vvfan.connection=/dev/ttyUSB0:9600:8:none:1:rtu:35:5000
serial.vvfan.id=1
serial.vvfan.start=100
serial.vvfan.length=38
serial.vvfan.type=holding

serial.vvhc.connection=/dev/ttyUSB0:9600:8:none:1:rtu:35:5000
serial.vvhc.id=1
serial.vvhc.start=200
serial.vvhc.length=21
serial.vvhc.type=holding

And the following items:

Number VillaventFan "Fan speed [%d]" <fan> { modbus="vvfan:0" }
Number VillaventSupplyFanRpm "Supply fan RPM [%d]" <fan> { modbus="vvfan:10" }
Number VillaventExtractFanRpm "Extract fan RPM [%d]" <fan> { modbus="vvfan:11" }
Number VillaventHeatSetpoint "Set temperature [%d]" <temperature> { modbus="vvhc:7"}

Number VillaventSupplyAirTemp "Supply air temperature [%.1f °C]" <temperature>
Number VillaventSupplyAirTemp_in "Supply air temperature [%d]" { modbus="vvhc:13" }

Number VillaventExtractAirTemp "Extract air temperature [%.1f °C]" <temperature>
Number VillaventExtractAirTemp_in "Extract air temperature [%d]" { modbus="vvhc:14" }

Number VillaventIntakeAirTemp "Intake air temperature [%.1f °C]" <temperature>
Number VillaventIntakeAirTemp_in "Intake air temperature [%d]" { modbus="vvhc:17" }

And the following rules:

import java.math.BigDecimal

rule "Correct supply air temp"
when
    Item VillaventSupplyAirTemp_in changed
then
    val BigDecimal ret = (VillaventSupplyAirTemp_in.state as DecimalType).toBigDecimal.movePointLeft(1)
    VillaventSupplyAirTemp.postUpdate(new DecimalType(ret))
end

rule "Correct extract air temp"
when
    Item VillaventExtractAirTemp_in changed
then
    val BigDecimal ret = (VillaventExtractAirTemp_in.state as DecimalType).toBigDecimal.movePointLeft(1)
    VillaventExtractAirTemp.postUpdate(new DecimalType(ret))
end

rule "Correct intake air temp"
when
    Item VillaventIntakeAirTemp_in changed
then
    val BigDecimal ret = (VillaventIntakeAirTemp_in.state as DecimalType).toBigDecimal.movePointLeft(1)
    VillaventIntakeAirTemp.postUpdate(new DecimalType(ret))
end

And this in my sitemap:

			Selection item=VillaventFan icon=fan mappings=[0="Off", 1="Low", 2="Medium", 3="Max"]
			Selection item=VillaventHeatSetpoint mappings=[220="22 °C", 210="21 °C", 200="20 °C", 190="19 °C", 180="18 °C", 170="17 °C", 160="16 °C", 150="15 °C", 140="14 °C", 130="13 °C", 120="12° C", 0="Off"]
			Text item=VillaventSupplyFanRpm
			Text item=VillaventSupplyAirTemp
			Text item=VillaventExtractFanRpm
			Text item=VillaventExtractAirTemp
			Text item=VillaventIntakeAirTemp

(Kim Skatun) #49

I am struggling to get it to work, I am afraid I did not wire it correctly. Could you please provide a picture of your setup and how you did your initial testing to see if it was wired correctly before moving to Openhab


(Gunnar Skjold) #50

I’ll try to take a picture over the weekend. It was sort of hard seeing what was A and B on the PCB, so I just soldered pin 4 and 5 where I though was correct and then downloaded modpoll (http://www.focus-sw.com/fieldtalk/modpoll.html) and did:

unzip -d modpoll modpoll.3.4.zip
cd modpoll/linux
chmod +x modpoll
./modpoll -m rtu -r 101 -b 9600 -p none /dev/ttyUSB0

Then first I got the following output

Protocol configuration: Modbus RTU
Slave configuration...: address = 1, start reference = 101, count = 1
Communication.........: /dev/ttyUSB0, 9600, 8, 1, none, t/o 1.00 s, poll rate 1000 ms
Data type.............: 16-bit register, output (holding) register table

-- Polling slave... (Ctrl-C to stop)
Reply time-out!
-- Polling slave... (Ctrl-C to stop)
Reply time-out!

I figured my wiring was incorrect, so I switched the wires and tried again. This time I had a constant stream of this:

-- Polling slave... (Ctrl-C to stop)
[101]: 2

Which basically tells you that register 101 has a value of 2, which was correct. Just remember to have openhab2 service stopped when you do this so that your current config does not interfere with the communication.

After this I moved straight on to openhab where it worked out of the box after I added the config and restartet openhab.

Earlier I had a cheap dongle using ch341 driver, but I could never get that to work. Not sure if it was hardware or driver related, but I did read online that many people have issues with devices using the ch341 driver. I knew that a FTDI device would never let me down, so that’s why I bought the dongle I use now.


(Kim Skatun) #51

Do you have that picture and the link to the dongle that you use?


(Gunnar Skjold) #52


(Pawel Potempski) #53

I also have Thessla Green. Today I received Modbus User Guide and I agree it looks clear. Tell me which commands (registers) do you use (or did you try) to control it – seems “airFlowRateManual” looks perfect for it in manual mode. Is RS485 your only way to control it or you use it together with i.e. Air++ simultaneously?


(Marcin) #54

I use many of them like mode, season, flow, program, temperatures, fun voltage, heater (PWM), etc. I don’t remember Thessla’s names, since in config you just operate on registers. If you will be able to config one item/register then they rest is simple.
Air++ works together with OH without a problem, so all parameters can be read or change via both channels :slight_smile:


(Pawel Potempski) #55

Great to hear about Air++ which would help to evaluate my attempts. Thank you for quick answer.


(Lukasz) #56

Could you share a documentation of modbus protocol Theesla green air system? I mean commands using to change all function by RS485.


(Pawel Potempski) #57

Priv please, pot***ski@gmail.com.


(Jo B D) #58

Hi gskjold. I´m facing some trouble locating the modbus pins on my systemair VR400, which have a very similar PCB as your unit. Could you provide a picture of the soldering or a description of the location?

On my PCB the only RJ-plugs are for manual control…


(Gunnar Skjold) #59

Hi, Attached below is an overview of the pcb in my unit. I have a RJ45 for my modbus connection and a RJ11 for the control panel. The only place on the terminals I can find A and B is for the control panel connection which I find weird. I think someone commented in this thread that this connection could not be used for modbus, but maybe worth a try? I am lifting the unit off the wall today to paint the room. I can have a closer look at my PCB then. But I would definitely look for terminals marked with modbus or “A” and “B” in your case. VR400 is supported for modbus, so there must be a way to connect it.


(Gunnar Skjold) #60

Had it open today, but there is no real way of telling how the RJ45 is connected on the PCB without removing it. I suggest contacting systemair and ask them how to connect to modbus on your unit. They have been helpful with me in the past, so I think they will help you out.