substitutions: devicename: "sonoff-basic-r2-two-led" descriptive_devicename: Sonoff basic R2 Two LED esphome: name: $devicename on_boot: then: - switch.turn_off: relay - light.turn_off: red_led - light.turn_on: green_led esp8266: board: esp8285 logger: api: encryption: key: "l1uZaqqERr0zVpmTBdnikEb/dEyiLbacrFoOLN+lfgI=" reboot_timeout: 0s ota: password: "fd7f5cf9211f8a8f7dd6c1ed7f3f187a" wifi: ssid: !secret wifi_ssid password: !secret wifi_password ap: ssid: $descriptive_devicename password: "sonoffr2" captive_portal: web_server: port: 80 # # Prepare outputs for LEDs # output: - platform: esp8266_pwm id: green_led_output inverted: true pin: GPIO13 - platform: esp8266_pwm id: red_led_output inverted: false pin: GPIO3 # # LEDs would be presented as lights # light: - platform: binary id: green_led name: Green LED output: green_led_output - platform: binary id: red_led name: Red LED output: red_led_output # # Prepare control for relay # switch: - platform: gpio id: relay name: Relay pin: GPIO12 restore_mode: ALWAYS_OFF on_turn_on: - light.turn_on: red_led - light.turn_off: green_led on_turn_off: - light.turn_on: green_led - light.turn_off: red_led # # Prepare control of a button # binary_sensor: - platform: gpio id: button name: Button pin: number: GPIO0 mode: input: true pullup: true inverted: true on_press: - switch.toggle: relay