Recently bought one of these plugs and managed to get the relay and LED lights to toggle with ESPHome:
Turns out this board has a BL0937 chip for energy monitoring. Unfortunately though I am struggling to get the energy monitoring part reading correctly. It is just showing random numbers. I am assuming I am getting the SEL, CF and CF1 pins wrong.
Does anyone know the best way to troubleshoot these and how to determine which GPIO number is SEL, CF and CF1?
esphome:
name: socket_monitoring
platform: ESP8266
board: esp01_1m
wifi:
ssid: "ssid"
password: "pass"
logger:
api:
ota:
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: true
name: "Power Button"
on_press:
- switch.toggle: relay
- platform: status
name: "Status"
switch:
- platform: gpio
id: blue_led
pin:
number: GPIO13
inverted: true
- platform: gpio
id: red_led
pin:
number: GPIO16
inverted: true
- platform: gpio
name: "Socket Monitoring Switch"
pin:
number: GPIO14
id: relay
on_turn_on:
- switch.turn_on: blue_led
- switch.turn_off: red_led
on_turn_off:
- switch.turn_off: blue_led
- switch.turn_on: red_led
sensor:
- platform: hlw8012
sel_pin:
number: GPIO12
inverted: True
cf_pin: GPIO5
cf1_pin: GPIO4
current_resistor: 0.0025
current:
name: "socket current"
unit_of_measurement: A
id: socket_my_amps
voltage:
name: "socket voltage"
unit_of_measurement: V
id: socket_my_voltage
power:
name: "socket power"
id: socket_my_power
unit_of_measurement: W
change_mode_every: 1
update_interval: 5s