esphome:
  name: gong
  platform: ESP8266
  board: nodemcuv2

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: !secret gong_key

ota:
  - platform: esphome
    password: !secret gong_password

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: true

button:
  - platform: template
    name: Ton 1
    id: ton_1
    icon: "mdi:music-note-eighth"
    on_press:
      - logger.log: "PLAY Ton1"
      - output.turn_on: ton1_pin
      - delay: 500ms
      - output.turn_off: ton1_pin
  - platform: template
    name: Ton 2
    id: ton_2
    icon: "mdi:music-note-eighth"
    on_press:
      - logger.log: "PLAY Ton2"
      - output.turn_on: ton2_pin
      - delay: 500ms
      - output.turn_off: ton2_pin
  - platform: template
    name: Ton 3
    id: ton_3
    icon: "mdi:music-note-eighth"
    on_press:
      - logger.log: "PLAY Ton3"
      - output.turn_on: ton3_pin
      - delay: 500ms
      - output.turn_off: ton3_pin
  - platform: template
    name: Ton 4
    id: ton_4 
    icon: "mdi:music-note-eighth"
    on_press:
      - logger.log: "PLAY Ton4"
      - output.turn_on: ton4_pin
      - delay: 500ms
      - output.turn_off: ton4_pin

output:
  - platform: gpio
    pin: D5
    id: ton1_pin
  - platform: gpio
    pin: D6
    id: ton2_pin
  - platform: gpio
    pin: D7
    id: ton3_pin
  - platform: gpio
    pin: D8
    id: ton4_pin

switch:
  - platform: gpio
    pin: D3
    name: "Gong Mute"