Skip to content

Instantly share code, notes, and snippets.

@adrianmihalko
Last active January 28, 2019 20:58
Show Gist options
  • Save adrianmihalko/b94d5394a63c1d9b68a4c25e364205f1 to your computer and use it in GitHub Desktop.
Save adrianmihalko/b94d5394a63c1d9b68a4c25e364205f1 to your computer and use it in GitHub Desktop.
Sonoff, Esphome
esphomeyaml:
name: sonoff_1
platform: ESP8266
board: esp01_1m
wifi:
ssid: ''
password: ''
manual_ip:
static_ip: 192.168.1.80
gateway: 192.168.1.1
subnet: 255.255.255.0
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
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
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