Skip to content

Instantly share code, notes, and snippets.

@webbson
Created June 12, 2020 19:50
Show Gist options
  • Save webbson/dfff64a4df8dc1532f4794246040dfcf to your computer and use it in GitHub Desktop.
Save webbson/dfff64a4df8dc1532f4794246040dfcf to your computer and use it in GitHub Desktop.
Config for Nedis Wifi Smart Outdoors plug ESPHome custom firmware. Tuya convert esp8266
# https://esphome-configs.io/guides/tuya-convert/#introduction
substitutions:
plug_name: poolheater
# Higher value gives lower watt readout
current_res: "0.00221"
# Lower value gives lower voltage readout
voltage_div: "1910"
esphome:
name: ${plug_name}
platform: ESP8266
board: esp01_1m
wifi:
ssid: !secret wifiname
password: !secret wifipass
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "${plug_name} Fallback Hotspot"
password: "3XtYLy5n2pgc"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
time:
- platform: homeassistant
id: homeassistant_time
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: "${plug_name} Button"
on_press:
- switch.toggle: relay
- platform: status
name: "${plug_name} Status"
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: GPIO04
cf1_pin: GPIO05
current_resistor: ${current_res}
voltage_divider: ${voltage_div}
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: "${plug_name}_Wattage"
change_mode_every: 8
update_interval: 10s
- platform: total_daily_energy
name: "${plug_name}_Total Daily Energy"
power_id: "${plug_name}_Wattage"
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001
unit_of_measurement: kWh
switch:
- platform: gpio
name: "${plug_name} Relay"
pin: GPIO14
id: relay
restore_mode: ALWAYS_OFF
status_led:
pin: GPIO13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment