"I just want to know my usage" Edition 🚀
Quickstart | Getting Started | Project Structure | Contributing
Simple, modern, and AI-powered water meter reading for Home Assistant.
# Clone the latest commit via this command, or download source using the button below ⬇️
git clone https://github.com/MauroDruwel/Watermeter.git
cd Watermeter
cp .env.example .env # On Windows, use 'copy', instead of 'cp'
# Fill in your .env with your API keys and config
docker-compose up -d- Flash your ESP32-CAM with the code in
CameraWebServer/(via Arduino IDE) - Create a Home Assistant helper:
input_number.water_meter_reading - Enjoy automatic water meter readings in Home Assistant! 💦
You'll need an ESP32-CAM and a WS2812B LED ring. Instead of the stock example, use the code in the CameraWebServer folder in this repo. It's got the special sauce for the LEDs. 🍝
- Open
CameraWebServer/CameraWebServer.inoin Arduino IDE. - Update your WiFi creds.
- Flash it!
- Hook up your LED ring (check the code for pins).
Create a helper so we have somewhere to put the numbers.
Settings → Devices & Services → Helpers → Create Helper → Number.
Call it input_number.water_meter_reading.
- Copy the env file:
copy .env.example .env - Fill in the blanks (API keys, URLs, etc.).
docker-compose up -d- Sit back and watch the magic happen.
.
├── app.py # Main application logic
├── config.py # Configuration management
├── Dockerfile # Docker image definition
├── docker-compose.yml # Docker Compose configuration
├── requirements.txt # Python dependencies
├── test.py # Testing script
├── CameraWebServer/ # Modified ESP32 code with WS2812B support
└── .env.example # Environment variables template
Edit .env to set your options:
GEMINI_API_KEY: Get this from Google (free tier available)READING_INTERVAL_MINUTES: How obsessed are you with your water usage?
- Wakey Wakey: The script runs every X minutes.
- Sanity Check: It grabs the previous reading from Home Assistant. This helps us spot bad readings (because water meters don't run backwards... usually). 🕵️♂️
- Lights On: It fires up the WS2812B LED ring (via the ESP32).
- Say Cheese 📸: Snaps a pic of the meter.
- Lights Off: Saves energy (and my eyes).
- AI Brain: Sends the pic to Google Gemini to figure out the numbers.
- Home Assistant: Dumps the data into HA so you can make pretty graphs. 📈
So, here's the tea ☕. I started this because I wanted to automate reading my water meter. My electricity meter is already digital and smart, but my water meter? Still stuck in the analog stone age (and probably will be for a while). 🦕
My first big brain idea 🧠 was to just turn on the garage lights to see the meter. I hooked it up to Home Assistant (because why not? 😎), but imagine having your garage lights flickering on and off in the middle of the night just to check how much water you used... yeah, spooky and not ideal. 👻
Next attempt: A simple LED. Result? A blinding beam of light and reflections everywhere. The camera couldn't see a thing! 🕶️
The Solution:
I ended up modifying the CameraWebServer source code to support a WS2812B LED ring. Now we get nice, even lighting without the disco ball effect. ✨
(Check out the CameraWebServer folder in this repo for the modified code!)
[Link to video coming soon!]
I spent way too much time testing different Gemini models.
After battling with hallucinations and bad reads, I settled on gemini-2.5-flash-preview-09-2025.
Right now, it's the king 👑 of reading these analog dials, with it also being completely free. But hey, AI moves fast, so this might change next week.
I also tweaked the prompts until they were just right. It's not perfect, but it works like a charm for me!
Got a better prompt? Found a cooler model? PRs are welcome! Let's make this thing even better. 🎉
Made with ❤️, milk, and a lot of trial and error.
