Home › Forums › Other Data Loggers › home-assistant Roll your own logger/sensor
- This topic has 0 replies, 1 voice, and was last updated 2025-07-25 at 8:27 PM by
neilh20.
-
AuthorPosts
-
-
2025-07-25 at 8:27 PM #19209
I’ve been trying home-assistant.io/ HA – a centralized “logger” that manages peripheral sensors or actuators. Might be better for control algorithms. It has some eye dazzling candy, and an ever increasing number of plug-n-play commercial devices.
For any software, and particularly open-source software, I like to start with a target sensor, figure out my accuracy of measurement, and RELIABILITY of methods. I put RELIABILITY in capitals as its often something that comes back to bite later.
I’m looking to interfaces to a “water meter” which has clicks for every unit (G) of water. The water-meter has a mechanical counter on the front. However to take a measurement, need to walk up to it and read it. Of course for further analysis or visualizing really want an automated measurement device.
This is a simple model, it is also something that can be used in the wider world when working with other forms of meters measuring diversions from streams like the now popular extra RELIABLE (that word again) Seametric electromagnetic Magmeters . I’ve used these devices on another project for amending stored water for enhancing some critical riparian habitat over long hot summer months.
Generally, for an irrigation controller where you want the applied water to be very targeted, it needs to have a sensor to measure the water being applied and decide when and how often the water is applied, possibly based on future weather predictions, and then apply that water in a set time period. So need to measure, process data, and then take an action. An open source irrigation controller that does some of this is – OpenSprinkler.
First the bad news about HA – its not low power, it squanders low cost relatively high power microcomputers and WiFi to make it easy to stitch a central server/controller and sensors together. Yes this is a plug for ModularSensors on the Mayfly – low power extra-ordinaire.
What is amazing about HA, is the no-coding and use of WiFi and WiFi servers to be able to debug. I’ve had a long career in programming, including building Modular-Sensors. Its fascinating watching HA automate the deployment process. From a starting point of a YAML (?) text file, to installing a platformIO project, create C++ files, build and then download them to the target – pretty amazing. btw YAML might stand for Yet Another Markup Language, or something else controversial – the file is editable with a text editor.
The two component types are – server and sensor – using a WiFi network to connect. The server I got was a RaspberryPi 5 (but a couple of other types of servers also available). For the sensor type – most are configured from ESP32 variants and optionally the RaspberryPi RP2040 with WiFi – with dedicated web site for sensors esphome.io
So my initially foray was using a board a teaching friend had spare, a standard ESP32-S3-DevKitC-1 board as a pulse counter – with a capacitor to debounce the relays chatter when closing. Mostly, I tried other ESP32s variants first, and they all seemed to be missing some HA support, and the pulse counting was bad, time update not happening – so went for the standard supported ESP32-S3
After a fair amount of work tweaking the two YAML files, and letting it run for a couple of weeks, the result could be displayed on a graph as shown below. Its for a fixed week, and then I’ve circled a day when extra water was used – its my home water meter, and its when I was doing a lot work in the garden.

To set it up and debug I created a separate WiFi network on my desk. The HA server was close to this, and the pulse sensor the other side of the room in my equipment cabinet .
However, when I went away for the weekend and turned off my desk power including HAserver – but not the pulse sensor in the cabinet – it didn’t collect any of pulses. Despite the sensor being on. The networking was “fragile”, the pulse collection was lost.
HA uses an internal proprietary API – so what I need is an MQTT with QoS 1 (at least once) guaranteed data delivery. So howlong do I need pulses to be collected with out the server working. I’ll pull a number out of the air – and say I’d like it still to deliver readings after 1 year of the server being off.
So to make my electronic pulse collector interface simple I’m going to need a little device with a display that can show the same value as the mechanical wheel, and can keep the delivery of data going for up to a year – probably need a low wear uSD. The ESP32 family has internal persistent data storage – but it is specified for a small number of finite writes. Of course some devices now have PSRAM.
If found a device that does this ESP32-c6-lcd-1 .
It also turns out, the graphs are very simple. I’ve got spoilt after using monitormywatershed.org visualizations and also HydroVu (Insitu) and Hobo – the HA network is pretty simplistic. Lots of comments of potential ways of improving.
Conclusion: as a first pass HA and espHome are a pretty fascinating learning environment possibly base development environment. HA does some amazing learning sensors on the local WiFi network and looks capable of some amazing mashups. For my simple design though going to need to put some more work into it.
I provide some links where this is being discussed.
https://community.home-assistant.io/t/using-esphome-to-build-a-water-flow-rate-meter/119380/70
Attachments:
-
-
AuthorPosts
- You must be logged in to reply to this topic.
Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of 