esphome:
  name: mateusz-light-switch
  friendly_name: Mateusz's Light switch

bk72xx:
  board: generic-bk7231n-qfn32-tuya

logger:

web_server:

captive_portal:

mdns:

api:
  encryption:
    key: "6XGt8kCrllL861S4s3oBM5eUZ+p84JhxZqP6X4EsWE4="

ota:
  platform: esphome
  password: !secret ota

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:

text_sensor:
  - platform: libretiny
    version:
      name: LibreTiny Version

output:
  - platform: gpio
    id: output_led_1
    pin:
      number: P14
      inverted: true
  - platform: gpio
    id: output_led_2
    pin:
      number: P26
      inverted: true
  - platform: gpio
    id: output_led_3
    pin:
      number: P11
      inverted: true

light:
  - platform: binary
    id: light_switch_1
    output: output_led_1
  - platform: binary
    id: light_switch_2
    output: output_led_2
  - platform: binary
    id: light_switch_3
    output: output_led_3

binary_sensor:
  - platform: gpio
    id: binary_switch_1
    pin:
      number: P24
      inverted: true
      mode: INPUT_PULLUP
    on_press:
      then:
        - switch.toggle: switch_1
  - platform: gpio
    id: binary_switch_2
    pin:
      number: P20
      inverted: true
      mode: INPUT_PULLUP
    on_press:
      then:
        - switch.toggle: switch_2
  - platform: gpio
    id: binary_switch_3
    pin:
      number: P7
      inverted: true
      mode: INPUT_PULLUP
    on_press:
      then:
        - switch.toggle: switch_3

switch:
  - platform: gpio
    id: switch_1
    name: Switch 1
    pin: P6
    on_turn_on:
      - light.turn_on: light_switch_1
    on_turn_off:
      - light.turn_off: light_switch_1
  - platform: gpio
    id: switch_2
    name: Switch 2
    pin: P8
    on_turn_on:
      - light.turn_on: light_switch_2
    on_turn_off:
      - light.turn_off: light_switch_2
  - platform: gpio
    id: switch_3
    name: Switch 3
    pin: P9
    on_turn_on:
      - light.turn_on: light_switch_3
    on_turn_off:
      - light.turn_off: light_switch_3

status_led:
  pin:
    number: P22
    inverted: true
