Updated – 12May 2024
I wanted to measure the volume of gas taken by my Ideal Vogue 18kW boiler in order to convert this to input energy in kW and therefore determine if the boilers displayed efficiency is accurate.
I decided to get a secondary gas meter fitted inline with the gas feed to the boiler, the meter was a BK-G4M from HERE.
The meter comes with a prewired switch assembly to count the number of 1/100 of m3 wheel rotations:
I’m a complete novice when it comes to Home Assistant and rely wholly on YouTube, community forums and search engines for information, and I would like to pass my sincere thanks onto all content creators who help folks like me.
I used a ESP8266 flashed from within Home Assistant with the coding configuration to enable the meters switch to increment the displayed gas reading on the dashboard of Home Assistant.
Current code used below:
The above code gives a stable output to Home Assistant with no creep over time 🙂
Once the data is being imported into Home Assistant you can manipulate in many ways:
ESP8266 mounted on breakout board from Aliexpress, the other items within the enclosure are an M-Bus reader and Open Energy Monitor Pi for my heat meter.
Links to Sources –
- https://community.home-assistant.io/t/esphome-pulscounter-with-in-z61-gascounter/335598/17
- https://blog.insanegenius.com/2021/08/09/esp32-water-and-gas-utility-meter/
- https://github.com/svenwal/gaszaehler-home-assistant-esphome
- https://community.home-assistant.io/t/gas-meter-tracking-with-counting-in-home-assistant-instead-of-on-esp32-side/635688/2
- https://simplyexplained.com/blog/tracking-gas-usage-with-esphome-home-assistant-and-tcrt5000/
- https://github.com/kalinchuk/esp32_pulse_meter
- https://smarthome.ms1.de/projekte/gasverbrauch/
- https://community.home-assistant.io/t/track-a-gas-meter-with-esphome/162669/22
- https://community.home-assistant.io/t/help-required-analog-dial-dumb-gas-meter-monitor-for-a-1991-ugi-gas-meters-ltd-analog-meter/482222/27
Thanks for posting this.
Just testing out your code – definitely works! however I am getting some kind of double-read.
I am testing my Z61 reed switch by just slowly passing a magnet over the pickup point – emulating the dial of the gas meter dial rotating the internal magnet past the reed switch.
It appears (because you can hear the faint *click* on the switch) that it is reading when the magnet pulls, and then again when it releases – causing a double-read in the logs.
And idea how to fix this?
21:15:36
[D]
[sensor:094]
‘Gas Used’: Sending state 0.20270 mÂł/min with 2 decimals of accuracy
21:15:36
[D]
[sensor:094]
‘Gas Used’: Sending state 0.73230 mÂł/min with 2 decimals of accuracy
21:15:40
[D]
[sensor:094]
‘Gas Consumption Total’: Sending state 97.54000 mÂł with 2 decimals of accuracy
Hi Andrew,
You could try increasing the delay off time setting to see if that makes a difference.
Code isn’t my ‘thing’ lol, but I’m sure you will get help off the Home Assistant forum if my humble suggestion doesn’t do the trick.