Have a systemair SAVE VSR 300 ventilation unit. It can be controlled via the MODBUS protocol. So what i did - got myself some el cheapo RS485 adapter from aliexpress
Plugged it into RPi running HA and… Now i’m stuck.
The instruction manual for VSR states
1 Introduction
The unit works as a Modbus slave and complied with MODBUS over serial line specification and
implementation guide V1.0 if nothing else is mention in this manual. 2 Transmission modes
Modbus RTU.
Supported function codes:
1: Read Coils
2: Read Discrete Input
3: Read Holding Register
4: Read Input Register
5: Write Single Coil
6: Write Single Register
15: Write Multiple Coils
16: Write Multiple Registers 3 Physical layer
Two wire RS-485.
The supported communication parameters are:
9600 Bd or 19200 Bd.
No parity, even parity or odd parity. 4 Address
Slave address 1 to 247.
So i have set up the following in configuration.yaml
modbus:
type: serial
method: rtu
port: /dev/ttyUSB0
baudrate: 9600
stopbits: 1
bytesize: 8
parity: N
As in the manual it states that registers 208-218 are responsible for different temp readings. And for Access
(Reg./Coil) it states they are regs.
But in the logs i only get
WARNING (MainThread) [homeassistant.components.sensor] Updating modbus sensor took longer than the scheduled update interval 0:00:30#033[0m
WARNING (MainThread) [homeassistant.components.sensor] Updating modbus sensor took longer than the scheduled update interval 0:00:30#033[0m
ERROR (Thread-5) [homeassistant.components.sensor.modbus] No response from modbus slave 1 register 218#033[0m
ERROR (Thread-5) [homeassistant.components.sensor.modbus] No response from modbus slave 1 register 218#033[0m
So the questions
Is there any simple software to test the connection in the first place? Win or mac based?
Maybe i’m doing something wrong with the seup above?
Problem solved. There was a setting on a ventilation unit. And all the difference that there the parity was set to Even. As soon as got it to None values started pouring in.
Now the question remaining. When i write the register from HA to the ventilation unit - does it actually gets written into some EEPROM with it’s limitation on the number of write cycles?
Wouldn’t this be hardware dependent?! How the manufacturer implemented the controller. I’d test the following way - write some value to change the setting. Cut off power. If the setting is lost - then it’s saved in some electricity-dependent memory and most probably NOT an EEPROM.
The clearest and most definitive answer should come from the manufacturer, however
Yes thanks. Good idea about the power cut. Will try it out.
But looking at the modbus realisation in Home Assistant - currently completely lost. Let’s say i have the following register
Name: REG_HC_HEATER_TYPE
Register address: 201
R or R/W: R/W
NVM: Y
Scaling: 1
Access (Reg./Coil): Reg
Description/remarks:
0: no heater
1: Water heater
2: Electrical heater
3: Contactor
How do i use it? All i can see in HA for types is sensor/binary sensor and a switch. Switch sounds good enough but…
Switch can only control coils. Furthermore i couldn’t find an option for payload. It’s only switch name and coil number… So how do i set up for example to switch register to 0 or 2 with the above example?
And even for some of the coils. I can change them from HA via the switch. But where is the bidirectional exchange? How will HA change it’s values if i change the coils from the control panel?
Is it that HA modbus realisation is very undeveloped?
Got some progress. At least i’ve set up several switches to write the coils. But still cannot figure out how to write the register.
Tried something like below with no luck. What am i misssing?
action:
- service: modbus.write_register
data:
unit: 1
address: 207
value: 0 #(is this decimal or hex?!)
Also have set up several binary sensors. Have switches with same coil addresses working fine. But these on never show up and get the following error
- platform: modbus
coils:
- name: VSR Speed Low
slave: 1
coil: 11200
- name: VSR Speed Off
slave: 1
coil: 11201
- name: VSR Speed High
slave: 1
coil: 11202
ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step
result = next(coro)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 381, in async_process_entity
new_entity, self, update_before_add=update_before_add
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-pakages/homeassistant/helpers/entity_component.py", line 223, in async_add_entity
self.entities.keys())
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 53, in async_generate_entity_id
name = (name or DEVICE_DEFAULT_NAME).lower()
AttributeError: 'function' object has no attribute 'lower'
I’m using an input_slider to control the fan speed and another slider for controlling the temperature of a ventilation system.
Take a look at my configuration and see if that can help you out: https://github.com/persandstrom/.homeassistant/blob/master/configuration.yaml
For the heater type I would suggest you to use an input_select, you can see an example of that in my config as well. The input_select in my config is not used together with modbus though.
Thank you for the configs. But now i’m totally confused and wonder if it’s a bug in HA or…
Trying different solutions i’ve set up a lot of switches and noticed that they behave strangely. Investigating further i’ve found that the documentation from systemair doesn’t match registers in HA.
Hard to explain but i will try.
In the docs for ventilation unit i see that fan control is register 101 with options 0,1,2,3 for different speeds. Tried it didn’t work.
So i tried register 100. And it worked out. Went further and changed all the registers in HA (“register in the doc” - 1) and it works. Everything came into place. I really don’t think systemair messed up so big on this. So is this a bug in HA? Can somebody confirm it? All the registers are offset by -1? Don’t want to open an issue if it’s just me.
Modbus documentation is a bit confusing. Holding register 1 can be documented as address 0 or register 1. Somtimes even register 40001. HA is using a modbus library that use adress as input and has inherrited that approach. Systemair specifies register number. Adress = register - 1.
This is not a bug, but a comment about this in HA docs would be good.
Can you make a PR for the docs? I’m not sure i have the knowledge to eplain this in such detail as you did.
But still confused.
For the service call we have the address: 207 and everything above is applicable. But for the sensors it states directly REGISTER. But looking at the data looks like it is an address as well (x-1). If it is indeed adress i guess best way is to rename it to address as well?
- name: VSR Temp Exhaust Air
unit_of_measurement: °C
slave: 1
register: 215
Well everything almost working now. But binary sensors still don’t show up even on dev tools. Is there any story with coils as well?
ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step
result = next(coro)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 381, in async_process_entity
new_entity, self, update_before_add=update_before_add
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 223, in async_add_entity
self.entities.keys())
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 53, in async_generate_entity_id
name = (name or DEVICE_DEFAULT_NAME).lower()
AttributeError: 'function' object has no attribute 'lower'
If you look at the NVM column in the systemair modbus document you’ll see if it is stored in non-volatile memory. (EEPROM) Some registers are marked with “Y1” meaning: “Stored by writing to register 549 (REG_STORE_NVM).”
Thanks for the link to adapter on Aliexpress. I got mine today, up and running with my VSR 500.
Does anyone else have problems with “REG_HC_TEMP_IN3” (Temparature sensor exhaust air)? Mine show way too high value.
Hello,
What kind of cable to use use between your USB link adapter and the device your are controlling? DIY based on network TP cable? I’m at the planing stage to control a warmwire floor system.
Thanks.
I hit another bug. Now it’s a minus temperature outside. And i get 6553.3 °C for the outside air. Can anybody confirm similar behaviout?
Tried switching to float data and get instead unknown °C
This looks to me like an overflown 16-bit integer. I.e. is it possible that outside it was -0.2ºC?
I.e. you might need to additionally interpret the data that you are getting, but you’ll need another thermometer to find a co-relation.
I.e. If you’re getting 6552.0ºC and the other thermometer is showing -1.5ºC then you’re still getting correct data, but you need to do an additional interpretation of it. Check whether the data is below 6280, then it’s a positive temperature, otherwise from the value you’re getting substract 6553.5 and you get the real temperature.