Hello All,
Since approx. 1 year I’m a happy user of HA to monitor my solar-panels/screens/heat pump/… over Modbus.
While adding an extra module to my network (2x Digital In/out) to the same modbus-branch where my solar-inverter is connected to, I’m running into issues.
I’m not able to get (stable) communication with my new module using Home-assistant.
It looks like the communication with the solar-inverter is blocking/interrupting/interfering/… the communication to the new module.
Setup
I use the following setup:
The setup without the new module worked fine over the last +6 months.
Automations
For testing I used 2 automations, the first sets an output in the module every 20sec, another resets the output every 20sec (with an offset of 10sec)
(0:00 >> Set, 0:10 >> Reset, 0:20 >> Set, 0:30 >> Reset , …)
extract of automations.yaml (click to open)
alias: Set output Every 20 seconds to 1
description: ""
trigger:
- platform: time_pattern
seconds: "0" #second scripts runs on "10"
- platform: time_pattern
seconds: "20" #second scripts runs on "30"
- platform: time_pattern
seconds: "40" #second scripts runs on "50"
condition: []
action:
- service: modbus.write_coil
data:
hub: zlan203
address: 1
state: 1 #second scripts has 0
slave: 5
mode: single
TEST 1: Reduced configuration file that works
The following simplified setup works
Extract of configuration.yaml (click to open)
modbus:
- name: "logo1" #logo202
type: tcp
host: 192.168.0.202
port: 502
delay: 5
- name: "zlan203"
type: tcp
host: 192.168.0.203
port: 502
delay: 5
#removed all slave devices from zlan203 for this test
- name: "zlan204"
type: tcp
host: 192.168.0.204
port: 502
delay: 5
sensors: ### SENSORS ##
#CH1: PT100
- name: heatpump_ch1_pt100 #see customize section for friendly name
slave: 2
address: 0x0000
input_type: holding
device_class: temperature
unit_of_measurement: °C
scale: 0.1
precision: 1
state_class: measurement
data_type: uint16
scan_interval: 10
#...much more sensors below...
After restart of home-assistant, this gives a good result, the relay is toggling every 10 seconds.
This can also be confirmed by wireshark. (filtered on modbus communcation)
TEST 2: Reduced configuration file that fails
The following simplified setup fails.
It is the same setup as above, but I only added one sensor for the solar panel.
(this is tested with the solar panels switched off)
Extract of configuration.yaml (click to open)
modbus:
- name: "logo1"
type: tcp
host: 192.168.0.202
port: 502
delay: 5
- name: "zlan203"
type: tcp
host: 192.168.0.203
port: 502
delay: 5
sensors:
#DC1 Voltage - Solar panel sensor - Only 1 of the many sensors is included for this test
- name: "inverter_dc_v1"
slave: 1
address: 0x0006
#input_type: holding
device_class: VOLTAGE
unit_of_measurement: V
scale: 0.1
precision: 1
state_class: measurement
data_type: uint16
scan_interval: 10
- name: "zlan204"
type: tcp
host: 192.168.0.204
port: 502
delay: 5
sensors: ### SENSORS ###
#CH1: PT100
- name: heatpump_ch1_pt100 #see customize section for friendly name
slave: 2
address: 0x0000
input_type: holding
device_class: temperature
unit_of_measurement: °C
scale: 0.1
precision: 1
state_class: measurement
data_type: uint16
scan_interval: 10
Just after restart of HA the relay toggles a couple times, with increasing intervals (10 sec, 1 minute, 2 minutes, 4 minutes in between,…) , after 10 toggles it doesn’t toggle any more.
It feels to met that a buffer/stack or something is filling ?
This can also be confirmed in wireshark.
Time interval between slave(=unit id) 5 is increased from 10 seconds to 70 seconds.
home-assistant.log (including startup of HA - 343kb) (Download link due to size)
Solar inverter
Important to notify is that solar-inverter will shutdown (no communication possible) when it is not generating power. (e.g. during evening/night)
I read a lot of values from this device, see below my full configuration file I normaly use.
configuration.yaml during normal use (Download link due to size)
Hardware/Cabling
I can confirm that it is not related to the hardware/cabling issues.
Writing/Polling the module using the application “Modbus Poll” from my laptop works without issues.
Other things I tested
- With module connected to gateway “zlan204” in test-setup: I’m able to control it over home-assistant services, thus Service call/adresses/… are correctly configured (with modbus-hub correctly set)
- With module connected to gateway “zlan203” (as in first figure): I’m able to control it using “Modbus Poll” from my laptop without anny issues, thus cabling/hardware is correct
- I have a lot of pcap-files in wireshark and more loggings, if needed for debugging.
- In day-time when solar-inverter is awake, I never see slave-id 5 passing by in the packages.
Question
Does anybody have an idea why I’m not able to use my new module in this setup ?
Especially, the increasing time between the relay-toggle-commands are pulling my attention.
Thanks
Roel
(first post here in the community/forum)