Entity Button Card and call-service modbus.write_register

Hi everybody
I’ve created an Entity Button Card in Lovelace. Setting the tap-action to call-service : modbus.write_register.
I’m filling ind the required data for the modbus.write_register requirements found at https://www.home-assistant.io/components/modbus/#service-data-attributes.
This is done in the service_data
Altogether I end up with the following:

type: entity-button
  action: call-service
  service: modbus.write_register
    name: Nilan
    unit: 1
    address: 20180
    value: 1
  action: none
show_icon: true
show_name: true
entity: sensor.allow_active_cooling

But it gives an error when pressing the button:

extra keys not allowed @ data[‘name’]
Traceback (most recent call last):
File “/usr/src/app/homeassistant/components/websocket_api/commands.py”, line 121, in handle_call_service
File “/usr/src/app/homeassistant/core.py”, line 1130, in async_call
processed_data = handler.schema(service_data)
File “/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py”, line 267, in call
return self._compiled([], data)
File “/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py”, line 589, in validate_dict
return base_validate(path, iteritems(data), out)
File “/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py”, line 427, in validate_mapping
raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: extra keys not allowed @ data[‘name’]

How to proceed? I’m a little lost.

Thanks in advance!

PS: Hope I’ve formatted everything correctly. I’ve also tried to search the community, but to no avail.

The error says it. According to the services,yaml, there is no ‘name’ key in the service data.
I think the docs are outdated.

Figured out that much :wink:
But what should I do to make it work? Can’t figure that out :confused:

Don’t know, have no modbus, but if that ‘name’ key is needet for it to work, you should file an issue on gitub.
Maybe search the issues if it’s not already posted.

I’m no dev, but looking at the code, it’s possible that the key should be ‘hub’ instead of ‘name’.

Anyone else that has actual experience with this that can chip in?

You were right!
After countless hours of trials it was the hub attribute that worked.
And you were right 'bout the documentation: it’s outdated. It says name, but hub is the attribute to use.

Cool! If you want, you can update the docs.