Here's the output from my maintenance module....
[MS] 2019/06/14 00:40:20 Processing Plants - Check Watering Status
[MS] 2019/06/14 00:40:21 Plant #81 will need watering in 07h 51m
[MS] 2019/06/14 00:40:23 Plant #87 will need watering in 8d 17h 14m
[MS] 2019/06/14 00:40:38 Plant #86 will need watering in 1d 00h 15m
[MS] 2019/06/14 00:41:25 Plant #69 will need watering in 1d 08h 35m
[MS] 2019/06/14 00:41:36 Plant #83 will need watering in 6d 02h 07m
[MS] 2019/06/14 00:41:46 Plant #85 will need watering in 2d 11h 20m
[MS] 2019/06/14 00:41:46 Finished Processing Plants
Keep in mind, this is a first shot at this, and I have no way of knowing how accurate this will be until I let it run for days, or weeks, logging all the estimates, and actually comparing them to the actual time it determines they need watering.
I am pretty confident in the numbers, however something I had not considered originally is this...
Current Value: 450
Trigger Value: 200
The difference is 250, so we add that to the current value and get 700
What if the max value for that sensor in the log is 650? There will be no readings in the log file from which we can extract a date and time.
We cannot predict the time remaining if the sensor is reading more than about half way between the configured automatic watering trigger value, and the max reading in the log which would generally be when it was watered.
The closer we get to the watering time, I think the more accurate it will be, but we'll know once I start logging it and then looking to see how close it is, and whether the accuracy does change over time.
I'll log the plantId, the currentValue, estimatedTime, and the actual date/time it is predicting...
I'll be able to watch that last date/time to see how it fluctuates... and at what point, if any, was it not accurate.
So, it looks like another successful adventure, at least so far!