On/Off wall switch

Hi everyone, I’m trying to change from Tasmota to ESPHome in the wall switches but I can’t find the follow function. On Tasmota the command is SWITCHMODE 1, what’s the equivalent function on ESPHome? I tried this code but doen’t work with hw switch:

switch:
- platform: gpio
  name: "Relay di prova"
  pin: GPIO0
  id: relay

binary_sensor:
- platform: gpio
  pin: GPIO1
  name: "Switch di prova"
  id: toggle_command
  on_press:
      then:
        - switch.turn_on: relay
  on_release:
      then:
        - switch.turn_off: relay

In my binary sensor I just have

on_press:
      - switch.toggle: load1

It works. no then:

I tried this but don’t work:

binary_sensor:
- platform: gpio
  name: "Switch di prova"
  pin: GPIO1
  id: toggle_command
  on_press:
      then:
        - switch.toggle: relay

I need to add the mode parameter?

Get rid of the “then”