Watermeter plugin for Juham

Juham - Juha's Ultimate Home Automation Masterpiece

Contents:

Watermeter plugin for Juham™

Description

A web camera and AI-based water meter solution for Juham™ home automation.

This package includes two different water meter implementations:

  • Tesseract OCR and OpenCV solution for reading and interpreting water meter digits. This class requires further work to be truly useful. My Raspberry Pi didn’t have enough disk space, so I decided to set this aside for now.

  • A simple class that compares subsequent images to measure differences. The greater the difference between images, the more the arrows and digits on the water meter have changed, indicating water consumption. This solution also uploads the images to a specified FTP site when water consumption is detected, allowing homeowners to inspect the water meter visually. While this solution doesn’t provide exact water consumption readings, it is highly reliable for detecting leaks. Just ensure that spiders or other potentially moving objects don’t obstruct the camera’s view of the water meter.

Web camera based water meter leak detector based on comparison of subsequent images

Getting Started

### Note about Python - a Professional Ecosystem

I’m affraid I have wasted more time solving all sorts of build, documentation, testing, and god-knows-what issues with Python ecosystem than I’ve spent actually writing Python code. Most recently, I wasted an entire day trying to figure out why coverage failed with the following error:

'No source for code: 'juham_watermeter\config-3.py'.

error, when all the other Python projects with precisely identical structures worked fine. The solution was to add a .coveragerc file with the following content:

[run]
omit =
  config.py
  config-3.py

This will of course blow up sooner or later, when some Python developer decides to rename those files.

### Installation

  1. Prerequisities

In order to use the first solution you need Tesseract OCR to read the digits. To install Tesseract:

sudo apt install tesseract-ocr

If you are on Windows, visit the Tesseract GitHub repository, or Download a precompiled Windows binary from UB Mannheim.

  1. Install

    pip install juham_watermeter
    
  1. Configure

To adjust update interval and other attributes edit WaterMeter.json configuration file.

MIT License

Copyright (c) 2024, Juha Meskanen

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE

Changelog

[0.0.3] - Februrary 23, 2025

  • Debug messages removed.

[0.0.2] - January 11, 2025

  • Image comparison: based trivial water leak detection plugged in. Simply compares the image agains the previous one, measures the diferences, and records the magnitude. If there is no leak then there should be periods where no changes are detected between record images.

[0.0.1] - January 5, 2025

  • First release:

Classes

Index