ESPHome whole home power monitor

This AC power monitor can measure the current flowing over any mains power cable. It’s based on a Wemos D1 Mini (ESP8266 micro controller) and a 100A:50mA split core current transformer.

For this project, we will use the ESPHome add-on in Home Assistant to get it to report real time power consumption to Home Assistant. It will also display your current and today’s cumulative power consumption on the small oled display.

Step 1, grab the .stl’s on Printables and send them to the printer. I printed it using white PLA.

Step 2, time to gather your component. On top of my toolbox essentials, you’re going to need the following parts for this project:

Step 3, wire it up. A wiring diagram is coming at some point.

Step 4, finish off by flashing the firmware. Head over to your instance of Home Assistant, install the ESPHome addon if you haven’t already and then add a new device with the following config. Note, you’ll need to update parts of this to include your wifi credentials, etc.

YAML
esphome:
  name: power-monitor

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: #Your key here

ota:
  password: #Your password here

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Power-Monitor Fallback Hotspot"
    password: "power_monitor"

captive_portal:
    
i2c:
  sda: D3
  scl: D4
  scan: true
  id: db_busa
  
sensor:
  - platform: ct_clamp
    sensor: adc_sensor
    name: "Grid power"
#    update_interval: 3s
    filters:
      - calibrate_linear:
          - 0 -> 0
          - 0.09 -> 13.00
      - lambda: return x * 230.0 / 1000;
    unit_of_measurement: "kW"
    id: my_power

  # Example source sensor
  - platform: adc
    pin: A0
    id: adc_sensor

  - platform: total_daily_energy
    name: "Grid Total Daily Energy"
    id: daily_power
    power_id: my_power
    unit_of_measurement: kWh
    accuracy_decimals: 4

time:
  - platform: sntp
    servers: 192.168.10.210
    id: my_time

font:
  - file: 'Arial.ttf'
    id: font1
    size: 16

display:
  - platform: ssd1306_i2c
    model: "SH1106 128x64"
    reset_pin: D0
    address: 0x3C
    lambda: |-
        it.printf(0, 0, id(font1), "Now: %.2f kW", id(my_power).state);
        it.printf(0, 20, id(font1), "Today: %.2f kWh", id(daily_power).state);
        it.strftime(0, 40, id(font1), "Updated: %H:%M", id(my_time).now());
Expand

Lastly, pop the cover on and you should be ready to monitor your electricity usage!

*The product links in this post may contain affiliate links. I donate 20% of these earnings to the Good Work Foundation to help innovate learning in South Africa’s rural communities.

Thanks for making it to the end of the post!

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *