Created
February 1, 2021 14:42
-
-
Save FireBall1725/c22435bf87739cce27e514285c10b322 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| substitutions: | |
| device_name: "teckin_unused_1" | |
| plug_name: "Teckin SP20 1" | |
| esphome: | |
| name: ${device_name} | |
| platform: ESP8266 | |
| board: esp8285 | |
| wifi: | |
| ssid: !secret wifi_ssid | |
| password: !secret wifi_password | |
| logger: | |
| api: | |
| ota: | |
| web_server: | |
| port: 80 | |
| time: | |
| - platform: homeassistant | |
| id: homeassistant_time | |
| binary_sensor: | |
| - platform: status | |
| name: "${plug_name} Status" | |
| - platform: gpio | |
| pin: | |
| number: GPIO13 | |
| inverted: True | |
| name: "${plug_name} Button" | |
| on_press: | |
| then: | |
| - switch.toggle: relay | |
| - platform: template | |
| name: "${plug_name} Fault" | |
| lambda: |- | |
| if (id(relay).state == 1) { | |
| if (id(wattage).state <= 0.1) { | |
| return true; | |
| } else { | |
| return false; | |
| } | |
| } else { | |
| return false; | |
| } | |
| filters: | |
| - delayed_on: 10s | |
| on_press: | |
| then: | |
| - light.turn_on: | |
| id: light_led_blue | |
| effect: "strobe" | |
| on_release: | |
| then: | |
| - light.turn_off: light_led_blue | |
| switch: | |
| - platform: restart | |
| name: "${plug_name} Restart" | |
| - platform: gpio | |
| name: "${plug_name} Relay" | |
| pin: GPIO4 | |
| id: relay | |
| on_turn_on: | |
| then: | |
| - light.turn_on: light_led_red | |
| on_turn_off: | |
| then: | |
| - light.turn_off: light_led_red | |
| - platform: template | |
| name: "${plug_name} Relay Reset" | |
| lambda: |- | |
| return false; | |
| turn_on_action: | |
| then: | |
| - light.turn_on: | |
| id: light_led_blue | |
| effect: "strobe" | |
| - switch.toggle: relay | |
| - delay: 5s | |
| - switch.toggle: relay | |
| - light.turn_off: light_led_blue | |
| output: | |
| - platform: esp8266_pwm | |
| pin: GPIO2 | |
| inverted: True | |
| id: led_blue | |
| - platform: esp8266_pwm | |
| pin: GPIO0 | |
| inverted: True | |
| id: led_red | |
| light: | |
| - platform: monochromatic | |
| name: "${plug_name} LED Blue" | |
| output: led_blue | |
| id: light_led_blue | |
| effects: | |
| - strobe | |
| - platform: monochromatic | |
| name: "${plug_name} LED Red" | |
| output: led_red | |
| id: light_led_red | |
| effects: | |
| - strobe | |
| sensor: | |
| - platform: wifi_signal | |
| name: "${plug_name} WiFi Signal" | |
| update_interval: 60s | |
| - platform: uptime | |
| name: "${plug_name} Uptime" | |
| - platform: hlw8012 | |
| sel_pin: | |
| number: GPIO12 | |
| inverted: True | |
| cf_pin: GPIO5 | |
| cf1_pin: GPIO14 | |
| # Higher value gives lower watt readout | |
| current_resistor: 0.00221 | |
| # Lower value gives lower voltage readout | |
| voltage_divider: 871 | |
| current: | |
| name: "${plug_name} Amperage" | |
| unit_of_measurement: A | |
| voltage: | |
| name: "${plug_name} Voltage" | |
| unit_of_measurement: V | |
| power: | |
| name: "${plug_name} Wattage" | |
| unit_of_measurement: W | |
| id: "wattage" | |
| change_mode_every: 8 | |
| update_interval: 10s | |
| - platform: total_daily_energy | |
| name: "${plug_name} Total Daily Energy" | |
| power_id: "wattage" | |
| filters: | |
| # Multiplication factor from W to kW is 0.001 | |
| - multiply: 0.001 | |
| unit_of_measurement: kWh | |
| text_sensor: | |
| - platform: version | |
| name: "${plug_name} ESPHome" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment