Sonoff Basic light template not working anymore

Recently I upgraded Esphome, but one of my device’s code become obsolete. Can you help me make it work again?

light: 
  # Use this to control the relay in HA:
  - platform: template
    name: "Business Neon (1)"
    lambda: return id(relay).state;
    turn_on_action:
    - switch.turn_on: relay
    turn_off_action:
    - switch.turn_off: relay
    
binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    name: "Sonoff Basic Button"
    on_press:
    - switch.toggle: relay
    internal: yes