Homeassistant.service help

Hello,

I just moved all my Tasmota sockets to ESPHome and just flashed my sonoff wall switch (touch 3 gang) on ESPHome too.

On Tasmota, I used MQTT to be able to switch another device via multi-click.
I understand esp node to node control is still a feature request.

I tried the native api request via http with failure. I resorted to call home assistant to do the changes in the automation but failed equally.

Can someone point me to the right direction. This is my esphome code:

# Device Specific Config for sonoff-t1-3ch
#button3 turns on relay3 for the light
#button2 to turn a fog light via Home Assistant.

binary_sensor:
  - platform: gpio
    id: button3
    pin:
      number: GPIO10
      mode: INPUT_PULLUP
      inverted: True
    on_press:
      if:
        condition:
          - switch.is_off: relay3
        then:
          - switch.turn_on: relay3
        else:
          - switch.turn_off: relay3

  - platform: gpio
    id: button2
    pin:
      number: GPIO9
      mode: INPUT_PULLUP
      inverted: True

    on_press:
      - homeassistant.service:
          service: switch.toggle
          data:
            entity_id: switch.rfr3_switch_front_fog

switch:
  - platform: gpio
    name: "Bedroom Light"
    pin: GPIO4
    id: relay3

https://esphome.io/cookbook/http_request_sensor.html