Folks, I am a bit stuck with how to get something done with a message.
I am using the openweather node to get the weather and detect if it is RAINING NOW and how much.
The information is in msg.payload.rain and there is three modes of operation.
A, B and C (and Q, which I'll get to later)
B is easy. It gets the weather at that time and nothing else.
A and C are average weather readings from either mid-night or sunrise.
And that's where the problem starts.
Let's go with the mid-night one.
There will be a few messages averaged to get the final value.
I added the two extra options as it may be raining from mid-night (or dawn) but stop by mid-day and there is no rain. So with 'no rain', the plants get watered, which is kind of silly as they have already received enough water for that day.
So there is a threshold where there is enough rain fallen, and getting that value - as an average is driving me mad.
Example:
The cut off is 0.3mm rain.
Rain detected at 01:00 = 0.1mm
Rain detected at 04:00 = 0.1mm
Rain detected at 09:00 = 0.1mm
All other readings were 0
So the plants don't need watering.
I understand I only count non-zero values.
But the average is where I'm falling over.
Maybe I should be using TOTAL rather than average. I get that.
But I'm just wanting to ask if there is an elephant I'm not seeing.
Thanks.
OH!
The Q mode.
So I have it set to mode B.
But it is raining and looking like it s going to clear before mid-day.
I press a button and it gets the rainfall NOW and if it is greater than the 0.3mm, it is marked as to be skipped.
(a value of > 0.3 is then sent when the value is requested.)
Clear?