Created
January 15, 2019 21:36
-
-
Save adrianmihalko/dfab154681775538087d97baf704f990 to your computer and use it in GitHub Desktop.
Esphomeyaml Sonoff S20 for Home Assistant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This configuration allows you to use physical button on your Sonoff S20, add one button to Home Assistant and for safe turn off after x minutes. | |
esphomeyaml: | |
name: sonoffs20_esphomeyaml_1 | |
platform: ESP8266 | |
board: esp01_1m | |
wifi: | |
ssid: '' | |
password: '' | |
# Enable logging | |
logger: | |
# Enable Home Assistant API | |
api: | |
ota: | |
status_led: | |
pin: | |
number: GPIO13 | |
inverted: yes | |
switch: | |
- platform: gpio | |
id: relay | |
name: "Internal Relay (1)" | |
pin: GPIO12 | |
restore_mode: always off # on boot, always start as off - failsafe | |
internal: yes | |
# Use this to control the relay in HA: | |
- platform: template | |
name: "Sonoff S20 Relay (1)" | |
lambda: return id(relay).state; | |
turn_on_action: | |
- switch.turn_on: relay | |
# After 120min - turn off. Will be canceled if turn_off called in between | |
- delay: 125min | |
- switch.turn_off: relay | |
turn_off_action: | |
- switch.turn_off: relay | |
binary_sensor: | |
- platform: gpio | |
pin: | |
number: GPIO0 | |
mode: INPUT_PULLUP | |
inverted: True | |
name: "Sonoff S20 Button" | |
on_press: | |
- switch.toggle: relay | |
internal: yes | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment