esphome:
  name: sonoff-prise
  platform: ESP8266
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  platform: esphome
  password: "257e2759c54b37ec0dc09295dd79f34d"

wifi:
  networks:
  - ssid: WifiHome0
    password: louca2212
  - ssid: WifiHome
    password: louca2212
  - ssid: WifiHome2
    password: louca2212
  - ssid: WifiHomeG
    password: louca2212
    
  manual_ip:
    static_ip: 10.0.0.53
    gateway: 10.0.0.1
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Sonoff-Prise Fallback Hotspot"
    password: "QaNy5G8FruSx"

captive_portal:

web_server:
  port: 80

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: true
    name: "Sonoff Basic Button"
    on_press:
      - switch.toggle: relay


switch:
  - platform: gpio
    name: "Sonoff Basic Prise"
    pin: GPIO12
    id: relay

  - platform: restart
    name: sonoff-prise Restart 

output:
  # Register the green LED as a dimmable output ....
  - platform: esp8266_pwm
    id: s20_green_led
    pin:
      number: GPIO13
      inverted: true

light:
  # ... and then make a light out of it.
  - platform: monochromatic
    name: "Sonoff S20 Green LED"
    output: s20_green_led
