Add Teckin SP20 (US) example to 'Generic Sonoff' page (#191)

* add Teckin SP20 (US) example to 'Generic Sonoff' page

* Simplify config
This commit is contained in:
mjoshd 2019-03-06 14:10:43 -05:00 committed by Otto Winter
parent f4c1d31a1d
commit b1e5b6b4e6
2 changed files with 110 additions and 0 deletions

View File

@ -327,6 +327,23 @@ Teckin
See :doc:`/components/sensor/hlw8012` for measuring power.
Example config: `teckin.yaml <https://github.com/esphome/esphome-docs/blob/current/devices/teckin.yaml>`__
Teckin SP20 (US)
----------------
.. pintable::
GPIO13, Button,
GPIO2, Blue LED (inverted),
GPIO0, Red LED (inverted),
GPIO4, Relay,
GPIO12, HLW8012 SEL Pin (inverted),
GPIO5, HLW8012 CF Pin,
GPIO14, HLW8012 CF1 Pin,
See :doc:`/components/sensor/hlw8012` for measuring power.
Example config: `teckin_sp20_us.yaml <https://github.com/esphome/esphome-docs/blob/current/devices/teckin_sp20_us.yaml>`__
See Also
--------

View File

@ -0,0 +1,93 @@
# Example ESPHome code to emulate stock firmware functionality while maintaining 100%
# local control through Home Assistant.
substitutions:
device_name: '<NODE_NAME>' # used internally.. e.g. teckin_sp20
friendly_name: '<Node Name>' # displayed in HA.. e.g. Teckin SP20
wifi_ssid: '<WIFI_SSID>'
wifi_password: '<WIFI_PASSWORD>'
esphome:
name: ${device_name}
platform: ESP8266
board: esp01_1m
wifi:
ssid: ${wifi_ssid}
password: ${wifi_password}
# Enable Logs from the device
logger:
# Enable Home Assistant API
api:
# Enable Over-The-Air updates
ota:
sensor:
# Power measuring sensor
- platform: hlw8012
sel_pin:
number: GPIO12
inverted: True
cf_pin: GPIO5
cf1_pin: GPIO14
current:
name: ${friendly_name} Current
power:
name: ${friendly_name} Power
id: power
filters:
# Some calibration
- multiply: 0.4545
voltage:
name: ${friendly_name} Voltage
current_resistor: 0.001 # default 0.001
voltage_divider: 910 # default 2351
change_mode_every: 3 # default 8
update_interval: 3s # default 60s
# Sum power readings over the day
- platform: total_daily_energy
name: ${friendly_name} Total Daily Energy
power_id: power
filters:
- multiply: 0.001 # convert Wh to kWh
unit_of_measurement: kWh
# Enable getting local time for total daily energy calculation
time:
- platform: homeassistant
id: homeassistant_time
status_led:
pin:
number: GPIO0 # Red LED
inverted: True
binary_sensor:
- platform: gpio
pin: GPIO13
id: button
name: ${friendly_name} Button
on_press:
- switch.toggle: relay
internal: True
switch:
- platform: gpio
id: blue_led
pin:
number: GPIO2
inverted: True
- platform: gpio
pin: GPIO4
id: relay
name: ${friendly_name}
# Tie Blue LED to relay
on_turn_on:
- switch.turn_on: blue_led
on_turn_off:
- switch.turn_off: blue_led