---
esphome:
  name: SP10
esp8266:
  board: esp01_1m
  restore_from_flash: true
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:
    ssid: SP10_AP
    password: !secret wifi_password
    channel: 1
logger:
api:
ota:
web_server:
  port: 80
  
time:
  - platform: homeassistant
    
    id: homeassistant_time
status_led:
  
  pin:
    number: GPIO0
    inverted: True
output:
  
  - platform: esp8266_pwm
    id: blue_led_output
    pin:
      number: GPIO2
      inverted: True
light:
  
  - platform: monochromatic
    name: SP10 Blue LED
    output: blue_led_output
    id: blue_led
    default_transition_length: 1ms 
    internal: True
sensor:
  - platform: uptime
    name: SP10 Uptime
  - platform: wifi_signal
    name: SP10 Wifi Signal
    update_interval: 60s
text_sensor:
  - platform: version
    name: SP10 ESPHome Version
  - platform: wifi_info
    ip_address:
      name: SP10 IP
binary_sensor:
  - platform: gpio
    
    pin:
      number: GPIO13
    id: button
    name: SP10 Button
    on_press:
      - switch.toggle: relay_template
    internal: True
switch:
  - platform: gpio
    
    pin: GPIO15
    id: relay
  
  - platform: template
    
    name: SP10
    id: relay_template
    lambda: |-
      if (id(relay).state) {
        return true;
      } else {
        return false;
      }
    turn_on_action:
      - light.turn_on: blue_led
      - switch.turn_on: relay
    turn_off_action:
      - light.turn_off: blue_led
      - switch.turn_off: relay