-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
Description
The problem
Hello,
I updated my HA last week (from 2025.1.x to 2025.2.1) and since then I have issue with my Modbus sensor which record erroneous spikes.
It matches the update of the pyModbus library as well.
It used to work flawlessly but now I have regular issues.
What I noticed is that I am getting erroneous value, for example room temperature jumping multiple degrees or flowsensor jumping from 0 to a value for just 1 frame.
It looks like this value is the answer from another request.
This only happens when the Modbus telegram is sent again after 3sec (probably due to timeout).
Is there a way to avoid sending this new telegram after timeout ? (I am polling values each 10s anyway)
Now the interesting part: this spikes are only generated when the request is repeated.
Here are 2 examples:
- 30°C could well be the temperature from the "Retour condensateur"




What version of Home Assistant Core has the issue?
core-2025.2.1
What was the last working version of Home Assistant Core?
core-2025.1.x
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Modbus
Link to integration documentation on our website
https://www.home-assistant.io/integrations/modbus/
Diagnostics information
It looks like as soon as a Modbus frame is repeated (due to timeout), the next Modbus telegram is taken as answer.
This leads to value mixing between MB sensors.
The sequence of Modbus frame seems to be off.
A first approach would be to disable the Modbus timeout and wait for the next polling.
Example YAML snippet
"""yaml
# Read info from PAC
modbus:
- name: PAC
type: tcp
host: 192.168.1.23
port: 502
sensors:
- name: Température extérieure
slave: 1
address: 1003
input_type: holding
unit_of_measurement: °C
state_class: measurement
scale: 0.1
offset: 0
precision: 1
scan_interval: 10
- name: Température départ condensateur
slave: 1
address: 1004
input_type: holding
unit_of_measurement: °C
state_class: measurement
scale: 0.1
offset: 0
precision: 1
scan_interval: 10
- name: Température retour condensateur
slave: 1
address: 1005
input_type: holding
unit_of_measurement: °C
state_class: measurement
scale: 0.1
offset: 0
precision: 1
scan_interval: 10
- name: Débit capteur
slave: 1
address: 1020
input_type: holding
unit_of_measurement: l/min
state_class: measurement
scale: 0.1
offset: 0
precision: 1
scan_interval: 10
- name: Température ballon
slave: 1
address: 1100
input_type: holding
unit_of_measurement: °C
state_class: measurement
scale: 0.1
offset: 0
precision: 1
scan_interval: 10
- name: PAC Temp Z1 appartement
slave: 1
address: 1111
input_type: holding
unit_of_measurement: °C
state_class: measurement
scale: 0.1
offset: 0
precision: 1
scan_interval: 10
- name: PAC Temp Z2 Culte RdC
slave: 1
address: 1121
input_type: holding
unit_of_measurement: °C
state_class: measurement
scale: 0.1
offset: 0
precision: 1
scan_interval: 10
- name: PAC Temp Z3 Culte sous-sol 1er
slave: 1
address: 1131
input_type: holding
unit_of_measurement: °C
state_class: measurement
scale: 0.1
offset: 0
precision: 1
scan_interval: 10
- name: PAC Temp Z4 salle fête
slave: 1
address: 1141
input_type: holding
unit_of_measurement: °C
state_class: measurement
scale: 0.1
offset: 0
precision: 1
scan_interval: 10
- name: PAC état
slave: 1
address: 102
input_type: holding
state_class: measurement
scale: 1
offset: 0
precision: 0
scan_interval: 10
switches:
- name: Appartement
slave: 1
address: 6011
command_on: 1
command_off: 4
write_type: holding
verify:
- name: Salle culte
slave: 1
address: 6012
command_on: 1
command_off: 4
write_type: holding
verify:
- name: Sous-sol
slave: 1
address: 6013
command_on: 1
command_off: 4
write_type: holding
verify:
- name: Salle fête
slave: 1
address: 6014
command_on: 1
command_off: 4
write_type: holding
verify:"""
Anything in the logs that might be useful for us?
Log covering both event (14:48:15 and 14:50:27):
2025-02-09 14:48:10.910 DEBUG (MainThread) [pymodbus.logging] Frame advanced, resetting header!!
2025-02-09 14:48:10.910 DEBUG (MainThread) [pymodbus.logging] send: 0x1d 0xf 0x0 0x0 0x0 0x6 0x1 0x3 0x4 0x4c 0x0 0x1
2025-02-09 14:48:13.911 DEBUG (MainThread) [pymodbus.logging] send: 0x1d 0xf 0x0 0x0 0x0 0x6 0x1 0x3 0x4 0x4c 0x0 0x1
2025-02-09 14:48:14.377 DEBUG (MainThread) [pymodbus.logging] recv: 0x1d 0xf 0x0 0x0 0x0 0x5 0x1 0x3 0x2 0x1 0x40 old_data: addr=None
2025-02-09 14:48:14.378 DEBUG (MainThread) [pymodbus.logging] Processing: 0x1d 0xf 0x0 0x0 0x0 0x5 0x1 0x3 0x2 0x1 0x40
2025-02-09 14:48:14.378 DEBUG (MainThread) [pymodbus.logging] decoded PDU function_code(3 sub -1) -> ReadHoldingRegistersResponse(dev_id=0, transaction_id=0, address=0, count=0, bits=[], registers=[320], status=1)
2025-02-09 14:50:22.693 DEBUG (MainThread) [pymodbus.logging] Frame advanced, resetting header!!
2025-02-09 14:50:22.693 DEBUG (MainThread) [pymodbus.logging] send: 0x1d 0xb0 0x0 0x0 0x0 0x6 0x1 0x3 0x3 0xed 0x0 0x1
2025-02-09 14:50:25.695 DEBUG (MainThread) [pymodbus.logging] send: 0x1d 0xb0 0x0 0x0 0x0 0x6 0x1 0x3 0x3 0xed 0x0 0x1
2025-02-09 14:50:26.708 DEBUG (MainThread) [pymodbus.logging] recv: 0x1d 0xb0 0x0 0x0 0x0 0x5 0x1 0x3 0x2 0x1 0x2c old_data: addr=None
2025-02-09 14:50:26.708 DEBUG (MainThread) [pymodbus.logging] Processing: 0x1d 0xb0 0x0 0x0 0x0 0x5 0x1 0x3 0x2 0x1 0x2c
2025-02-09 14:50:26.708 DEBUG (MainThread) [pymodbus.l
5CDB
ogging] decoded PDU function_code(3 sub -1) -> ReadHoldingRegistersResponse(dev_id=0, transaction_id=0, address=0, count=0, bits=[], registers=[300], status=1)
Additional information
Full log attached covering both events: