Modbus configuration check fail SMA solar

I have had this working on an old HA installation, accessing my sma solar converter using modbus. But now when trying the latest HA version and changing the yaml file accordingly I get errors parsing the configuration.yaml

As soon as I enter modbus: in the configuration.yaml I get the following error:
What is wrong ?

   result = await result
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/config/core.py", line 30, in post
    errors = await async_check_ha_config_file(request.app["hass"])
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/config.py", line 929, in async_check_ha_config_file
    res = await check_config.async_check_ha_config_file(hass)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/check_config.py", line 182, in async_check_ha_config_file
    config = config_schema(config)
  File "/srv/homeassistant/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/srv/homeassistant/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 595, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/srv/homeassistant/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 387, in validate_mapping
    cval = cvalue(key_path, value)
  File "/srv/homeassistant/lib/python3.9/site-packages/voluptuous/validators.py", line 229, in _run
    return self._exec(self._compiled, value, path)
  File "/srv/homeassistant/lib/python3.9/site-packages/voluptuous/validators.py", line 353, in _exec
    v = func(path, v)
  File "/srv/homeassistant/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 818, in validate_callable
    return schema(data)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/modbus/validators.py", line 151, in scan_interval_validator
    scan_interval = entry.get(CONF_SCAN_INTERVAL, DEFAULT_SCAN_INTERVAL)
AttributeError: 'str' object has no attribute 'get'

My configuration looks like this:

modbus:
  - name: smahubben
    type: tcp
    host: 10.x.x.x
    port: 502

#    scan_interval: 20
    sensors:
      - name: SMA Power AC
        unit_of_measurement: W
        slave: 3
        address: 30775
        count: 2
        data_type: int
        scan_interval: 20

A following old template sensor format caused this error. Correcting that syntax SOLVED it.

1 Like