BK-G4M Gas Meter – Home Assistant

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 –

2 thoughts on “BK-G4M Gas Meter – Home Assistant”

  1. 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

  2. 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.

Leave a Reply

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