Modbus integration faulty?

Hello,
I have been desperately trying to install a device via Modbus for quite some time.
Currently, I am using two Modbus devices; one works without any issues. The second device is causing problems when writing to the registers.
More specifically:
In the configuration.yaml, I have added two sensors as an example, which can be read without any issues. This applies to all 30 or so sensors.

modbus:
  - name: smartfox
    type: tcp
    host: 172.16.6.202
    port: 502
    timeout: 5
    delay: 5
    sensors:
      - name: smartfox.boiler_mode
        data_type: uint16
        input_type: holding
        slave: 1
        address: 42206
        scan_interval: 100    
      - name: smartfox.pt1000
        unit_of_measurement: °C
        data_type: int16
        input_type: holding
        slave: 1
        address: 41038
        scan_interval: 100
        scale: 0.1
        precision: 1

With the following code, I am now trying to use a custom card for writing:


type: custom:button-card
name: Boiler Off
icon: mdi:power
entity: sensor.smartfox_boiler_mode
tap_action:
  action: call-service
  service: modbus.write_register
  service_data:
    hub: smartfox
    unit: 1
    address: 42206
    value: 0
state:
  - value: '0'
    icon: mdi:power
    styles:
      card:
        - background-color: red
      icon:
        - color: white

Unfortunately, I always receive the following error message:

Logger: homeassistant.components.modbus.modbus
Quelle: components/modbus/modbus.py:331
Integration: Modbus (Dokumentation, Probleme)
Erstmals aufgetreten: 10:43:48 (6 Vorkommnisse)
Zuletzt protokolliert: 13:45:53

Pymodbus: smartfox: Error: device: 1 address: 42206 → Exception Response(144, 16, IllegalFunction)

The following entries are listed in the Modbus manuals of the manufacturer:


Screenshot 2024-10-02 135029

After trying everything, I quickly downloaded the Modbus Mechanic tool and tested the writing. With the settings as they appear in the Modbus table, along with an offset of -1, it works immediately without major changes.
Where am I missing something? Is there a specific parameter that ensures it works? I have now used register 42207 -1 offset → 42206 as an example for all write registers.

@brun059 You have quite a bit of experience with Smartfox. Have you managed to write to the registers? - maybe you can help me?

habe die lösung grfunden sollte es wer suchen:


type: custom:button-card
name: Boiler Off
icon: mdi:power
entity: sensor.smartfox_boiler_mode
tap_action:
  action: call-service
  service: modbus.write_register
  service_data:
    hub: smartfox
    unit: 1
    address: 42206
    value: [0]  # Wert als Liste, obwohl es ein einzelnes Register ist

das hat bei mir gefruchtet habe damit smartfox voll integrieren können.

mfg

1 Like