Modbus configuration gives an error

Hi,
The problem occurred after the HA core update. Modbus configuration gives an error.Failed to call service homeassistant/reload_all.
Cannot quick reload all YAML configurations because the configuration is not valid: Invalid config for [modbus]:
HT Energy: count: 2 cannot be combined with data_type: float32 @ data[‘modbus’][0][‘sensors’][0].
Got {‘name’: ‘HT Energy’, ‘device_class’: ‘energy’, ‘unit_of_measurement’: ‘kWh’, ‘slave’: 21, ‘address’: 300, ‘count’: 2, ‘data_type’: ‘float32’, ‘precision’: 2, ‘scan_interval’: 15}. (See /config/configuration.yaml, line 32).
/config/configuration.yaml:
modbus: !include modbus.yaml

/config/modbus.yaml:

  - name: moxa
    timeout: 1
    type: tcp
    host: 192.168.1.190
    port: 502
    sensors:
      - name: HT Energy
        device_class: energy
        unit_of_measurement: kWh
        slave: 21
        address: 300
        count: 2
        data_type: float32
        precision: 2 

Just remove the “count: 2” line and restart HA.

4 Likes

Thank you very much. Everything is fixed. Just curious. This configuration has lasted for over a year without any errors.

Exactly same here when reading my power meter - was almost going crazy as it was a long walk to get it stable. What has triggered this to fail now in version 10?

Invalid config for [modbus]: sdm630_export_wh_since_last_reset: count: 2cannot be combined withdata_type: float32 @ data['modbus'][0]['sensors'][21].

The same issue here, 11 times. Thanks Marco, for this fix!