Impulse readers / electricity metering

i am wondeirng if anyone has any experience they would care to share with metering the electricity and/or gas consumption with an impulse meter.
in my home i have an impulse meter which lets out an impulse per kwh, or per m3ā€¦ these are installed by the electricity/gas company.
i would like to have a counter for thisā€¦ which i can integrate into home assistantā€¦ are there any people who have done this?.. or what tools could one use for thisā€¦ i would rather not solder something together, but would like to use some kind of wireless technology ā€¦ Wifi/zwave or zigbeeā€¦ any ideas?

1 Like

If you can find out an existing device you can integrate for this Iā€™d be keen to find out also. There are a few ways I know people have done this, one involving a photodiode on top of the blinking LED, for example this one:
https://www.4-noks.com/shop/energy-meter-en/zigbee-optical-interface-for-energy-meter/?lang=en

I have no experience with this product myself though.

Iā€™ve been fiddling around with a current transformer ring which outputs the measurements via MQTT. The accuracy is lower (around 90%) than a MID certified meter, but for non-billing purposes should be fine. This approach does entail some electrical work, in any case, please be safe if you do look into it and obey your local regulation.

OpenEnergyMonitor has several products intended for this type of purpose.
https://openenergymonitor.com/

A notable thing about pulse counting is, that not all pulse meters emit pulses at the same frequency/power, probably itā€™s a lot less than one kWh.

I just finished that project today :slight_smile:
I think it needs some additional fine tuning with conversion, etc.
If anyone has any suggestions how to make this configuration better, please share :slight_smile:

I copied this project from this guide: Here (polish)

Here is what I did:

Assumptions:

  • MQTT Broker configured
  • ESP Flashing Basics Guide

Hardware:

  • ESP-12E CP2102 NodeMcu Lua V2 Here
  • Photodiode Here
  • Connector Wires
  • Duct tape :wink:

Steps:

  • Connect photodiode to GPIO Pin (my case GPIO-14), Voltage (3.3V) and GND

  • Flash ESP Easy Mega Here

  • Configure ESP to communictae with MQTT Broket in HA

  • Configure device in ESP:
    image


    Note: Values 1/6400 is defined by my electricity couter from provider - it is stated on cover as 6400 impulses / kWh
    Note2: Change ā€œCountā€ value to: ā€œ(%value%*(1/6400)) * 1000 * 60ā€ to get value of Watts every 60 seconds

  • Configure MQTT sensors in HA:
    image
    First one uses Count value and provides power consumption every minute (ESP is set to 60 seconds interval - screen above)
    Second one uses Total value and provides input for utility meter component:
    image

  • Place photodiode directed on electricity meter flashing diode:
    image
    Duct tape is your friend :slight_smile:

Final efect looks like this:
image
I added cost calculation

1 Like

almost what i looking for, i dont what whan to use mqtt to get all the info, i what to use Utility Meter in HA to get in all the data. any ide how?

Will you be using an ESP device with ESPHome firmware on it? If so, you donā€™t need to use mqtt, you can just use the homeassistant API for communication, then just plug the values into a Utility Meter entity.

mmm i dont know, rellyā€¦ now i am just trying to understand how i can bulid on, then i need some to make the code

So Iā€™d definitely suggest using an ESP device, flashing it with an ESPHome firmware (where youā€™re using homeassistant for communication rather than mqtt). Hereā€™s the code for my firmware:

esphome:
  name: power_meters
  platform: ESP32
  board: esp-wrover-kit

wifi:
  ssid: {{ssid}}
  password: {{passw}}

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

# Enable Web server
web_server:
  port: 80

sensor:
  # Uptime sensor
  - platform: uptime
    name: Elec Meter Uptime

  # WiFi Signal sensor
  - platform: wifi_signal
    name: Elec Meter WiFi Signal
    update_interval: 60s
  
  #########################################
  #
  # Electricity usage
  #
  #########################################
    
  # usage right now in kW
  - platform: pulse_counter
    pin: GPIO12
    unit_of_measurement: 'kW'
    name: 'Power Meter'
    id: power_meter
    filters:
      - multiply: 0.06
    
  # converts above to kWh used today
  - platform: total_daily_energy
    name: "Total Daily Energy test"
    power_id: power_meter
    id: kwh_so_far
    
switch:
  # Switch to restart
  - platform: restart
    name: Electricity meter monitor restart
    
# Sync time
time:
  - platform: sntp
    id: my_time

i have order some stuff. I hope i can make it work never use esp so its a a good way to trying to get it to work.

Hello, have almost got all that I order:

ESP-32 ESP32S Development Board 2.4GHz WiFi+Bluetooth Antenna CP2102 Module

NodeMcu Lua V2 WiFi Development Board Based On ESP8266 ESP-12E CP2102 Module

I am still wating for Photodiode module detects brightness light-sensitive light detector

Can link what firmware I should download so I can use your code?

Regard

If you get my code just paste it into a new node on the Hass.io ESPHome addon, change your details, compile the firmware, download it and flash it onto your board with something like ESPHome Flasher. Does that make sense? Sounds long winded but itā€™s relatively simple.

i think i understand. This is a new world for me, never using this before so i know very litel about this.
think i need to reda alot about this
i allos need to figuer out how to coonect it all:S

Yeah I understand, if you want to get into ESPHome this video covers the basics I mentioned. Youā€™d have to specify the correct board type youā€™re using and generate a firmware based on your needs but this is a good start: https://www.youtube.com/watch?v=soKuma8DJWQ

I just starting to get this a chance:)

Do I need to use the card on image? Or can I use it the esp directly in the usb?

If not, how should I wiring them?

Regard

i have done my homework:P well some:D

now i understand how to flash it and get it in to HA,
but i am a bit unsuer how to wiring it.

i have Photodiode and having AO,DO,GnD, and VCC

just a guess is
gnd= ground
AO = anolog
do= digital
VCC= power

so if think right it sholde ne
gnd to gnd
VCC to 3.3V
do= to a pin like that one u using in the code (pin: GPIO12)

I did it! It works flawlessly
thank you

Hello everybody,
can i use that part too?

I am going to give this a try to, did you get it to work?

BTW, why is the NodeMcu board needed, shouldnā€™t one esp32 suffice?

This looks like a neat solution, but doesnā€™t the energy company mind that you have duct-taped something to their meter? It would look awfully suspicious for the person that comes and does periodic readingsā€¦ :slight_smile:
I suspect the duct tape has an extra role to filter out outside light that might confuse the photodiodeā€¦

Hi, Iā€™m desperately trying to get this to work, I have much newer versions of HomeAssistant, so am struggling. Does your YAML go in here?