Gas usage and Integration into HA

I’m in the UK and currently do have SMETS1 gas and electric meters and they have been adopted/upgraded to the latest standard. I have these setup using the glow app from Hilderbrand and planned to use the API.

But i have a problem with my gas meter unfortunately it updates very sporadic (we are a rural location) to the DCC sometimes once a week, sometimes not for weeks, certainly not every 5 minutes. I have asked my energy provider to investigate but that hasn’t gotten me anywhere as they are essentially getting what they want.

The HID display works perfectly so i’m wondering if anyone has come across a project using OCR to capture this using a Pi or similar and integrate into HA or any other alternatives?

This is the last piece of my HA puzzle and has driven me mad for over a year.



I still have a dumb gas meter, but have it working with HA, to a point. I have a Blink camera in the gas meter cupboard, and at 2350 each night, it takes a photo. That photo is then sent to the LLMVision integration (the free tier gemini-1.5-flash model) at 2358, which returns the digits in the image. The result of which is then stored in an input.number for the reading at the end of that day. When that input.number updates, it stores the previous reading in another input.number, and the difference between the two is the consumption for that day.

Its working well, and so far reliably - I’ve only had it set up a couple of days - and the LLMVision integration is awesome, my image is at a slight angle, slightly out of focus, with reflections from the camera IR on a couple of digits, and gemini-1.5-flash still reads it out fine, I was quite sceptical when I was setting it up, but amazed at the results!

image

I used an image to set it up with LLMVision first, to make sure it would read them with the image quality I had, and then fed it the snapshot image once it was working.

I haven’t yet got it set up in the Energy Dashboard, but its most of the way there.

Hope thats of some use!

That is very cool. That would be pretty cool for a daily measurement. I’m guessing if you wanted to increase the frequency the only limitation would be Gemini usage allowances? i will investigate this hourly would be granular enough for me.

I’ve found this which could be a really good option OCR and MQTT i need to have a proper read when i have a bit more time. https://community.element14.com/challenges-projects/design-challenges/sci-pi-design-challenge/b/blog/posts/any-measurement-to-pi---blog-9-sending-ocr-data-to-cloud-visualize-in-dashboard-using-node-red

Yeah I plan to move to hourly readings at some point - this was mainly a proof of concept for myself (never used the AI stuff before etc). I do actually send the value to MQTT as well, as my other Home Assistant Pi I use for tinkering picks it up so I can play around without breaking my main HA setup.

It was good fun setting it up, if nothing else :slight_smile:

Found a rather significant problem! The display will not permanently display KWH and after 5 minutes reverts to costs only and i can’t see any option to change the default in the menus. ChatGPT easily extracted the data from some test images but i guess i’m back to the drawing board!

You could craft the prompt to ChatGPT to check it contains Meter Index before returning the numbers, else skip it. At least you can ensure you only get valid readings, even if some are missed when the display is not showing the reading.

You could probably get the automation to try again in 5 mins if the reading is not displayed, but I am really not very good with automation stuff, so not 100% sure.