Modbus sensor with multiple registers broken after update to 2023.8.2

Hello!

After updating from version 2023.8.1 to 2023.8.2, my modbus sensors stopped working.

There is a release note regarding modbus for version 2023.8.2, and I think this change has something to do with it, but I don’t understand how to make it work again. Anyone who knows?

This is my config that has been working up until now

- name: Input_Sensor_Register_41_Plus
  unique_id: input_sensor_register_41_plus
  slave: 1
  address: 40
  slave_count: 5 # count - 1
  input_type: input
  count: 6 # total number of registers to read
  scale: 1
  offset: 0
  precision: 0
  data_type: int16
  scan_interval: 15

- name: Holding_Sensor_Register_1_Plus
  unique_id: holding_sensor_register_1_plus
  slave: 1
  address: 0
  slave_count: 98 # count - 1
  input_type: holding
  count: 99 # total number of registers to read
  scale: 1
  offset: 0
  precision: 0
  data_type: int16
  scan_interval: 15

EDIT: Tried going back to version 2023.8.1 and then all the sensors work again, so it’s definitely something in version 2023.8.2 that’s causing this.

If I use this config and only reads two registers it works as before 2023.8.2, but if I increase to three registers, I get no value on any of the sensors.

- name: Input_Sensor_Register_1_Plus
  unique_id: input_sensor_register_1_plus
  slave: 1
  address: 0
  slave_count: 1 # count - 1
  input_type: input
  count: 2 # total number of registers to read
  scale: 1
  offset: 0
  precision: 0
  data_type: int16
  scan_interval: 15

- name: Input_Sensor_Register_3_Plus
  unique_id: input_sensor_register_3_plus
  slave: 1
  address: 2
  slave_count: 1 # count - 1
  input_type: input
  count: 2 # total number of registers to read
  scale: 1
  offset: 0
  precision: 0
  data_type: int16
  scan_interval: 15

@janiversen

Any update on this? I have the same issue.

Config Error:

Invalid config for [modbus]: Error in sensor A Eier swap(word) not possible due to the registers count: 1, needed: 2 @ data['modbus'][0]['sensors'][2]. Got {'name': 'A Eier', 'scan_interval': 1, 'address': 4, 'swap': 'word', 'input_type': 'holding'} Error in sensor Blutige Eier swap(word) not possible due to the registers count: 1, needed: 2 @ data['modbus'][0]['sensors'][5]. Got {'name': 'Blutige Eier', 'scan_interval': 1, 'address': 6, 'swap': 'word', 'input_type': 'holding'} Error in sensor Klappen auf swap(word) not possible due to the registers count: 1, needed: 2 @ data['modbus'][0]['sensors'][3]. Got {'name': 'Klappen auf', 'scan_interval': 1, 'address': 25, 'swap': 'word', 'input_type': 'holding'} Error in sensor Legeleistung swap(word) not possible due to the registers count: 1, needed: 2 @ data['modbus'][0]['sensors'][6]. Got {'name': 'Legeleistung', 'scan_interval': 1, 'address': 3, 'swap': 'word', 'input_type': 'holding', 'scale': 0.1, 'precision': 2, 'unit_of_measurement': '%'} Error in sensor Schmutz Eier swap(word) not possible due to the registers count: 1, needed: 2 @ data['modbus'][0]['sensors'][4]. Got {'name': 'Schmutz Eier', 'scan_interval': 1, 'address': 5, 'swap': 'word', 'input_type': 'holding'} Error in sensor Temperatur swap(word) not possible due to the registers count: 1, needed: 2 @ data['modbus'][0]['sensors'][0]. Got {'name': 'Temperatur', 'address': 528, 'input_type': 'holding', 'unit_of_measurement': '°C', 'device_class': 'temperature', 'state_class': 'measurement', 'scan_interval': 2, 'swap': 'word', 'scale': 0.1, 'precision': 2}. (See /config/configuration.yaml, line 46).

I have the same issue.

It seems that the problem has been solved in version 2023.8.4 if you remove “count” and “slave” from the configuration.

- name: Holding_Sensor_Register_1_Plus
  unique_id: holding_sensor_register_1_plus
#  slave: 1
  address: 0
  slave_count: 98 # count - 1
  input_type: holding
#  count: 99 # total number of registers to read
  scale: 1
  offset: 0
  precision: 0
  data_type: int16
  scan_interval: 15