explaingit

cian911/smart-gas-meter

Analysis updated 2026-05-18

5PythonAudience · developerComplexity · 4/5Setup · hard

TLDR

A Raspberry Pi pipeline that photographs your gas meter every 10 minutes, reads the digits with a YOLOv8 AI model, and reports readings to Home Assistant or submits them to Gas Networks Ireland.

Mindmap

mindmap
  root((smart-gas-meter))
    What It Does
      Photos meter every 10min
      Reads digits with AI
      Reports to Home Assistant
    AI Pipeline
      Camera captures image
      YOLOv8n detects digits
      Sorted left to right
    Integrations
      Home Assistant sensor
      Gas Networks Ireland
    Custom Training
      Calibrate display area
      Label your photos
      Fine-tune YOLOv8n
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Automatically photograph your gas meter every 10 minutes and log the reading to Home Assistant without manual input.

USE CASE 2

Train a custom digit-recognition model on photos of your own meter when the bundled model does not match your display.

USE CASE 3

Automatically submit monthly gas meter readings to Gas Networks Ireland's online form using the included script.

What is it built with?

PythonYOLOv8ONNX RuntimeRaspberry PiOpenCVHome Assistant

How does it compare?

cian911/smart-gas-meter1ncendium/aibusteraaronmayeux/ha-hurricane-tracker
Stars555
LanguagePythonPythonPython
Setup difficultyhardmoderateeasy
Complexity4/53/52/5
Audiencedeveloperops devopsgeneral

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1day+

Requires a Raspberry Pi 4 and Camera Module 3, retraining for your own meter needs a machine with a GPU.

No license information is provided in the README.

In plain English

smart-gas-meter is a Python project that automates the reading of a physical gas meter using a Raspberry Pi and a camera. Every 10 minutes the Pi takes a photo of the meter's LCD display. A computer vision model then identifies and reads the digits from the photo, reconstructs the full meter reading, and sends it to Home Assistant (a popular home automation platform). There is also an optional script that submits readings directly to Gas Networks Ireland's website. The digit-recognition model is a fine-tuned version of YOLOv8n, a compact object-detection model. It was trained on over 3,000 meter photos and achieves near-perfect accuracy. Because it detects and locates digits anywhere in the image rather than looking in fixed positions, it handles small shifts in the camera's position automatically without needing recalibration each time. A pre-trained model is included in the repository so you can start testing with photos immediately. If your meter looks different from the one used in training, the repository includes all the scripts needed to build your own labeled dataset and retrain the model. You calibrate a region of interest by drawing a box around the display, label a batch of photos by typing the reading you see, convert those labels into the training format, and retrain. Fine-tuning takes roughly an hour on a laptop with a GPU. The trained model is then exported to ONNX format (a lightweight format that works without the full PyTorch library) for deployment on the Pi. Home Assistant integration creates a sensor called sensor.gas_meter that appears as a gas consumption source in the Energy dashboard. The Gas Networks Ireland submission script handles the multi-step web form process automatically, including fetching a one-time security token before posting the reading. The repository does not specify a license.

Copy-paste prompts

Prompt 1
I want to set up smart-gas-meter on a Raspberry Pi 4 with Camera Module 3. Walk me through installing dependencies, running the bundled ONNX model on a test photo with --debug, and setting up the cron job.
Prompt 2
My gas meter looks different from the training data. How do I retrain the YOLOv8 model on my own photos -- walk me through calibrate.py, label.py, prepare_yolo_dataset.py, and train_yolo.py in order.
Prompt 3
How do I add smart-gas-meter to Home Assistant's Energy dashboard? What attributes does sensor.gas_meter expose and how do I configure it as a gas consumption source?
Prompt 4
I want to submit meter readings to Gas Networks Ireland using submit_gni.py. How do I find my GPRN, set it in .env, and run a dry-run to verify the payload before submitting for real?

Frequently asked questions

What is smart-gas-meter?

A Raspberry Pi pipeline that photographs your gas meter every 10 minutes, reads the digits with a YOLOv8 AI model, and reports readings to Home Assistant or submits them to Gas Networks Ireland.

What language is smart-gas-meter written in?

Mainly Python. The stack also includes Python, YOLOv8, ONNX Runtime.

What license does smart-gas-meter use?

No license information is provided in the README.

How hard is smart-gas-meter to set up?

Setup difficulty is rated hard, with roughly 1day+ to a first successful run.

Who is smart-gas-meter for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub cian911 on gitmyhub

Verify against the repo before relying on details.