Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 03:51 20 Aug 2026 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Chat develops a leak detector program on Dockstar hardware

Author Message
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3863
Posted: 05:57pm 18 Aug 2026
Copy link to clipboard 
Print this post

My household sensors send TCP or UDP messages to a Seagate Dockstar running OpenWrt for logging. This includes 11 temperature sensors--inside, outside, and in barn, and also current-sensing Tasmotized Sonoff POWR3 devices on boiler, fridge, freezer, well pump, and a mini-split heat pump.

I've plotted usage, including that the fridge draws about 3kWh per day, the freezer 1.5, the boiler none this summer, and the well pump around .5kWh in an average of 15 very brief cycles a day--average around half a minute at close to 1 kilowatt.

I had a thought last night that a leak detector could probably be developed from this.

I've been thinking about having ChatGPT talk to the Dockstar via serial (which gives it root access). I got browser Chat to walk me through getting PowerShell codex (Chat API) to connect to the Dockstar and interact with it. I first had it characterize the well pump behavior. It looked through my log files and analyzed runs by day and period. Very good job, no interaction on my part.

I then asked it to graph usage on the day with the most cycles. This is what it came up with:



Beautiful. I told it that the 8am runs were a bath, the 2 periods near noon were washing machine fill and then rinse, and the 10pm one, the dishwasher. On several other days I pointed out periods of watering the garden.

Based on these examples, I asked it to develop a python program to detect unusual runs--possible leaks slow or fast--and send me a warning email and SMS message. It did all of this, testing scenarios, without my further intervention. I then added a crontab line run this every minute, and set up tests confirming that I got the email and SMS message.

I asked Chat to summarize the day's work:

  Quote  Today, August 18, 2026, I:

 - Established serial access to the Dockstar through COM4 at 115200 8N1.
 - Confirmed it runs OpenWrt/Linux 5.10.176 at 192.168.2.70.
 - Inspected its sensor receivers, logging programs, crontab, processes, and recent data files.

 I mapped the sensor data flow:

 - TCP 8086 → listener2.lua → signals.txt
 - UDP 46225 → udp46225.py → signals.txt, then forwarded to 192.168.2.65:8086
 - UDP 39191 → udp39191.py → panels.txt
 - HTTP 8002 → receiver.py → Rx02.txt and signals.txt
 - poller.py polls four Tasmota devices every three seconds and records transition events in KLMT.txt

 I identified current temperatures for sensors A, B, C, D, G, H, J, and Y, including their last valid change times.

 For well-pump sensor K at 192.168.2.173, I reconstructed:

 - 947 complete episodes from June 22 through August 18
 - 498 episodes in the latest 30-day period
 - Median run duration of 36 seconds
 - Normal stable power around 970 W
 - Recent median of 15 episodes per day
 - Historical maximum of 31 episodes in one day
 - Longest observed motor run of 72 seconds
 - No evidence of sustained multi-minute operation or regular all-night leak cycling

 I analyzed August 9, the highest-use day, and created:

 - C:/dl/micromite_picomite_claco/chat/pump_runs_2026-08-09.html
 - C:/dl/micromite_picomite_claco/chat/water_cycle_annotations.csv

 Known or probable annotations include:

 - Morning bath
 - Washing-machine wash phase
 - Washing-machine rinse phase
 - Probable dishwasher cycle
 - Garden-watering events

 I developed and installed the water-leak detector:

 - Local source: C:/dl/micromite_picomite_claco/chat/leak_detector.py
 - Dockstar installation: /home/user0/leak_detector.py
 - State: /home/user0/leak_detector_state.json
 - Log: /home/user0/leak_detector.log
 - AWAY flag: /home/user0/leak_detector_away

 It detects:

 - Continuous runs over 120 seconds
 - Urgent continuous runs over five minutes
 - Seven starts in 30 minutes
 - Ten starts in one hour
 - Dense or persistent overnight cycling
 - Activity during four consecutive overnight hours
 - Unusually high daily episode counts
 - Recovery after suspicious activity stops

 It also sends a daily email summary around 07:05. Urgent warnings use both email and SMS, with duplicate suppression and recovery notifications.

 I added AWAY mode. When enabled, every newly completed pump episode sends email and SMS containing:

 - Run duration
 - Representative running wattage
 - Start time
 - Time since the previous pump episode

 AWAY mode was designed to arm at the current end of the log, preventing an old episode from being mistaken for a new one.

 Testing included:

 - Python syntax and file-integrity checks
 - Historical normal-use and washing-machine tests
 - Synthetic rapid-leak, continuous-run, and slow-overnight-leak tests
 - Production-mode state handling
 - Live AWAY-mode email and SMS delivery

 You added the once-per-minute crontab trigger. The live test successfully produced individual AWAY notifications and an appropriate leak warning during the washing-machine cycles. You have since returned the AWAY flag to false.


This was a pretty good morning to early afternoon's work. I set the prompts (sometimes with browser Chat guiding me) and mostly spent the time working through my daily substack reading list.

~
Edited 2026-08-19 03:58 by lizby
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on FOTS
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026