MODBUS - multiple holding register writing via automation

Update.:

After intensive searching I managed to find a thread where I found a solution to my problem.:

https://community.home-assistant.io/t/modbus-switch-write-specific-bit-in-holding-register/363580/6

Currently, this is what the automation that works in my case looks like after appropriate modification.:

id: 'acc1b5a0-ec70-4500-9011-b4ab3f6d0f9a'
alias: 'deye system_mode_soc_time1_update'
description: "DEYE aktualizacja poziom baterii okres 1"
initial_state: on
trigger:
  - trigger: state
    entity_id: sensor.system_mode_soc_time1
condition: []
action:
  - action: input_number.set_value
    target:
      entity_id: input_number.system_mode_soc_time_1
    data:
      value: "{{ trigger.to_state.state | int(0)  }}"


id: "adb78a66-27fb-4032-88ae-94723a11d8e1"
alias: deye system_mode_soc_time1
description: "DEYE poziom baterii okres 1"
initial_state: on
trigger:
  - trigger: state
    entity_id: input_number.system_mode_soc_time_1
condition: []
action:
  - action: modbus.write_register
    data:
      hub: deye
      unit: 1
      address: 166
      value: >-
        [{{ trigger.to_state.state | int(default=30) }}]
  - action: homeassistant.update_entity
    data:
      entity_id: sensor.system_mode_soc_time1