Esphome switch how to use?

Hi, I need a switch to enable/disable a control of my inverter. The log indicates two possibilities, 0 and 1. I can read the set state but I really don’t know how to check it. I tried to write the code but i don’t know how to proceed.

switch:
 - platform: modbus_controller
   modbus_controller_id: zcs
   id: eps_on_off
   name: EPS On/Off
   register_type: holding
   address: 0x1029
   on_turn_on: # what to write here?
   on_turn_off: # what to write here?

A binary_sensor: tells you the state of a physical switch or button typically on a GPIO pin.
A switch: is how ESPHome controls a light or relay connected to a GPIO.
id: is how the binary sensor can control the switch.

Example Code:

binary_sensor:
  - platform: gpio
    name: "Doorbell button"
    icon: mdi:bell-circle-outline
    pin:
      number: D2
      mode: INPUT_PULLUP
    filters:
      - delayed_on: 10ms   # THIS DOES THE DEBOUNCE
    on_press:
      then:
        - switch.turn_on: relay1
        - delay: 700ms
        - switch.turn_off: relay1

switch:
  - platform: gpio
    name: "Doorbell Relay"
    id: relay1
    icon: mdi:alarm-bell
    pin: 
      number: D4
      inverted: false

I have nothing physical connected to the pins. I need a virtual switch that assigns/writes the value 0 or 1 to register 0x1029