EPEVER UPower-Hi, write to modbus holding register?

I have UPower-Hi hybrid inventer and I can read “Charging Mode” value from it (via HA → TCP → mbusd → orginal Epever rs485 USB cable, chip CH343).
But I also wan’t to write new value to it and let HA control battery charge from grid on cheap hours.

I have following config to read it and this works.

modbus:
  - name: epever
    type: tcp
    host: 172.16.0.33
    port: 502
    timeout: 10
    close_comm_on_error: false
    retry_on_empty: true
    retries: 20
    sensors:
      - name: "Charging Mode"
        slave: 4
        address: 0x9607
        input_type: holding

Unofficial docs says that function code to read is 04 and write 10.
Values is: 1=Solar Priority, 2=Utility & Solar, 3=Solar.

So I thinking to set it to “2=Utility & Solar” to night times and rest of the day to “3=Solar”.

Any ideas how I can write to this holding register?

I tried with

    switches:
      - name: "Charge from grid"
        address: 0x9607
        slave: 4
        write_type: holding
        command_on: 2
        command_off: 3

but I got error

Logger: homeassistant.components.modbus.modbus
Source: components/modbus/modbus.py:385
Integration: Modbus (documentation, issues)
First occurred: 22:15:22 (1 occurrences)
Last logged: 22:15:22

Pymodbus: epever: Exception Response(134, 6, IllegalFunction)

Whats’s wrong?

It was close, now it works. Write_type was holding and not holdings

    switches:
      - name: "Charge from grid"
        address: 0x9607
        slave: 4
        write_type: holdings
        command_on: 0x2
        command_off: 0x3