Need help setting up a Template Switch in ESPHome

I am trying to set up a template switch in ESPHome that will use a binary sensor (button1) on a Nextion display. When I try to validate the whole page is mostly red.

# Example configuration entry
  - platform: template
    name: "Template Switch"
    lambda: |-
      if (id(some_binary_sensor).state) {
        return true;
      } else {
        return false;
      - switch.turn_on: switch2
      - switch.turn_on: switch1

I am not sure what the switch1 and switch2 are.

I replaced some_binary_sensor with button1, changed the name to button1_switch and I set up under binary senor:

  - platform: nextion
    page_id: 0
    component_id: 2
    nextion_id: irrigation
    id: button1
    name: "Button 1"
      - delayed_on_off: 100ms
        - switch.toggle: button1_switch

Thanks for any help.

So now all you need is a switch with id: button1_switch. Perhaps show us more code and explain what should be happening. It’s always good practice to give your entities descriptive names rather than “Button 1”.