I have this working, but a far too high voltage…
What can be wrong?
esphome:
name: wallswitch02
platform: ESP8266
board: esp8285
wifi:
ssid: "IOTDOM"
password: "nono"
use_address: 192.168.6.21
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Wallswitch01 Fallback Hotspot"
password: "nono"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
time:
- platform: homeassistant
id: homeassistant_time
substitutions:
plug_name: wallswitch02
# Higher value gives lower watt readout
current_res: "0.00260"
# Lower value gives lower voltage readout
voltage_div: "940"
# Enable Web server
web_server:
port: 80
sensor:
- platform: wifi_signal
name: "${plug_name} - WiFi Signal"
update_interval: 6s
- platform: uptime
name: "${plug_name} - Uptime"
icon: mdi:clock-outline
update_interval: 60s
- platform: hlw8012
sel_pin:
number: GPIO12
inverted: True
cf_pin: GPIO05
cf1_pin: GPIO04
current_resistor: ${current_res}
voltage_divider: ${voltage_div}
current:
name: "${plug_name} - Ampere"
unit_of_measurement: A
accuracy_decimals: 3
icon: mdi:flash-outline
voltage:
name: "${plug_name} - Volt"
unit_of_measurement: V
accuracy_decimals: 1
icon: mdi:flash-outline
power:
name: "${plug_name} - Watt"
unit_of_measurement: W
id: "${plug_name}_Wattage"
icon: mdi:flash-outline
change_mode_every: 4
update_interval: 3s
- platform: total_daily_energy
name: "${plug_name} - Dagverbruik"
power_id: "${plug_name}_Wattage"
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001
unit_of_measurement: kWh
icon: mdi:clock-alert
text_sensor:
- platform: version
name: "${plug_name} - ESPHome Version"
status_led:
pin:
number: GPIO02
inverted: True
binary_sensor:
- platform: gpio
id: button
internal: true
pin:
number: GPIO13
on_state:
- switch.toggle: relay
output:
- platform: gpio
pin: GPIO00
inverted: true
id: led
switch:
- platform: gpio
pin: GPIO15
id: relay
name: '${plug_name} - Switch'
icon: mdi:power-socket-eu
on_turn_on:
- output.turn_on: led
on_turn_off:
- output.turn_off: led