I'm not absolutely sure why that didn't work better, the theory seems good...
So I grabbed a piece of paper, and started figuring it out on paper, I tend to do that a lot. Model the problem in layman's terms without a computer. Turn it into a word problem, and then it's a lot easier to turn it into a computer function...
So, here's the new plan...
All of this information can come directly from the database...
TimeSinceLastWatering: 7437 minutes ago
With that information, we can calculate the rest.
ChangeSinceWatered: how much has the sensor value changed since it was last watered
ChangePerMinute: on average, how much does the value change every minute
UnitsToGo: how many Sensor Reading "units" to go until we reach AutoWater Trigger
MinutesToGo: how many minutes until we reach AutoWater Trigger
ChangeSinceWatered = SensorReadingAfterLastWatering - CurrentSensorReading
ChangeSinceWatered = 708 - 439
ChangeSinceWatered = 269
ChangePerMinute = ChangeSinceWatered / TimeSinceLastWatering
ChangePerMinute = 269 / 7437
ChangePerMinute = 0.0361704988
UnitsToGo = CurrentSensorReading - AutoWaterSensorReadingTarget
UnitsToGo = 439 - 220
UnitsToGo = 219
MinutesToGo = UnitsToGo / ChangePerMinute
MinutesToGo = 219 / 0.0361704988
MinutesToGo =6054 (Roughly 4 days))
I think this will work better, I'll let it go for a while and watch the logs...