substitutions:
device_name: gosund-sp111-v14
device_name_upper: "SmartPlug 01"
# Change these to your values
current_res: "0.0012"
voltage_div: "771"
#######################
# GOSUND SP111
#######################
# WiFi connection
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# reboot_timeout: 0s
# ssid: "abc"
# password: "12345678"
ap:
ssid: "${device_name}"
# password: "12345678"
# Enable Home Assistant API
api:
password: !secret api_password
reboot_timeout: 36h
# Enable OTA-Flashing
ota:
password: !secret ota_password
# Enable Web server
web_server:
port: 80
# Enable Captive Portal
captive_portal:
# Text sensors with general information
text_sensor:
- platform: version
name: ${device_name}_version
# Sync time with Home Assistant
time:
- platform: homeassistant
id: homeassistant_time
esphome:
name: ${device_name}
platform: ESP8266
board: esp8285
sensor:
- platform: hlw8012
sel_pin:
number: GPIO12
inverted: True
cf_pin: GPIO05
cf1_pin: GPIO14
current_resistor: ${current_res}
voltage_divider: ${voltage_div}
change_mode_every: 3
# initial_mode: CURRENT
update_interval: 5s
current:
name: "Current"
unit_of_measurement: A
accuracy_decimals: 3
voltage:
name: "Voltage"
unit_of_measurement: V
accuracy_decimals: 1
power:
name: "Wattage"
unit_of_measurement: W
accuracy_decimals: 0
# filters:
# - multiply: 0.5
id: "Wattage"
- platform: total_daily_energy
name: "Total Daily Energy"
power_id: "Wattage"
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001
unit_of_measurement: kWh
binary_sensor:
# Binary sensor for the button press
- platform: gpio
name: button
pin:
number: GPIO13
inverted: true
on_press:
- switch.toggle: relay
switch:
# Switch to toggle the relay
- platform: gpio
id: relay
name: relay
pin: GPIO15
on_turn_on:
- light.turn_on: led
on_turn_off:
- light.turn_off: led
output:
# Relay state led
- platform: esp8266_pwm
id: state_led
pin:
number: GPIO02
inverted: true
light:
# Relay state light
- platform: monochromatic
output: state_led
id: led
# Uses the red LED as a ESPhome status indicator
status_led:
pin:
number: GPIO00
inverted: true