Skip to content

Instantly share code, notes, and snippets.

@TheZoker
Created March 1, 2019 21:08
Show Gist options
  • Save TheZoker/4be6d00e9d633fb858080e3a1f484aec to your computer and use it in GitHub Desktop.
Save TheZoker/4be6d00e9d633fb858080e3a1f484aec to your computer and use it in GitHub Desktop.
Gosund
substitutions:
id: gosund
name: Gosund
relay_pin: '14'
button_pin: '3'
led_pin: '1'
esphome:
name: $id
platform: ESP8266
board: esp01_1m
board_flash_mode: dout
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
logger:
api:
password: !secret api_password
ota:
password: !secret api_password
web_server:
port: 80
switch:
- platform: gpio
pin: $relay_pin
id: relay
- platform: template
name: ${name} Relay
id: fakeswitch
turn_on_action:
- switch.turn_on: relay
- light.turn_on: ${id}_light
turn_off_action:
- switch.turn_off: relay
- light.turn_off: ${id}_light
lambda: !lambda |-
if(id(relay).state) {
return true;
}
return false;
binary_sensor:
- platform: gpio
pin:
number: $button_pin
mode: INPUT_PULLUP
inverted: True
name: ${name} Button
on_press:
- switch.toggle: fakeswitch
output:
- platform: esp8266_pwm
id: ${id}_led
pin:
number: $led_pin
inverted: True
light:
- platform: monochromatic
id: ${id}_light
output: ${id}_led
status_led:
pin:
number: GPIO13
inverted: True
sensor:
- platform: hlw8012
sel_pin: 12
cf_pin: 4
cf1_pin: 5
current:
name: ${name} Current
voltage:
name: ${name} Voltage
power:
name: ${name} Power
update_interval: 10s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment