Neo coolcam smart plug with power monitor

I can confirm that this works. Both the button and the led.

substitutions:
  plug_name: coolcam_plug1
  # Higher value gives lower watt readout
  current_res: "0.00221"
  # Lower value gives lower voltage readout
  voltage_div: "800"
esphome:
  name: ${plug_name}
  platform: ESP8266
  board: esp8285
wifi:
  ssid: 'MySSID'
  password: 'MyPassword'
# Enable logging
logger:
# Enable Web server
web_server:
  port: 80
# Enable Home Assistant API
api:

ota:

time:
  - platform: homeassistant
    id: homeassistant_time
    
binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      inverted: True
    name: "${plug_name}_button"
    on_press:
      - switch.toggle: relay
    
switch:
  - platform: gpio
    name: "${plug_name}_LED_Red"
    pin: GPIO13
    inverted: True
    restore_mode: ALWAYS_OFF
    id: red_led

  - platform: gpio
    name: "${plug_name}_Relay"
    pin: GPIO14
    restore_mode: ALWAYS_ON
    id: relay    
    
    on_turn_on:
      - switch.turn_on: red_led    

    on_turn_off:
      - switch.turn_off: red_led      
   
sensor:
  - 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
      
# Extra sensor to keep track of plug uptime
  - platform: uptime
    name: ${plug_name}_Uptime SensorPreformatted text
1 Like

Thanks thanks thanks.
It works really well.
It’s cool

yey worked for me as well.
Used tuya-convert initially and flashed tasmota.
Then had to downgrade to tasmota-minimum 7.2
Setoption78 1 in tasmota console then restart tasmota
select esphome.bin and upgrade.

Worked for me as well, but although I managed to calibrate the power reading (W), the current reading (A) is always quite off.
This might be due to the SEL pin (GPIO12) being pulled permanently high or low, see https://esphome.io/components/sensor/hlw8012.html
Or maybe some other issues I’m not aware of.

I was wondering if any of you got consistent current readings. If you have pictures of the pcb please post them, so we can check if the pin is actually pulled.
If that’s the case, I can post an updated config for ESPhome which disables the current reading to avoid confusion and false readings.

Great, worked for me too.

With tasmota i used with template gosund. Monitor energy was ok, but the phisIcal button didn’t work.

Thank you veru much.