berne
Junior Member
Posts: 85
|
Post by berne on Jan 31, 2023 7:36:44 GMT -8
Hi Doc, Many thanks for publishing the weatherrack2 error codes. I have spent quite a bit of time working on the skyweather2.weatherdata table in Excel getting rid of bad or spurious data, fixing total rain, etc. (Could not figure out how to easily program python catch all the errors, so this was done mostly manually.) These codes would enable trapping bad data when it actually occurs, before its written to the SQL DB. Do you plan to add such code in the next update?
When do you expect the next update? (If you are not going to update in the next few months I may write the code myself.)
Do you plan to fix the TotalRain reset zero bug in the next update? I have been thinking about this bug and would add a new table to the DB that captures reset times and the total rain prior to the reset. Detection of reset would be based on cumulativerain going to zero or a value much less than the previous TotalRain*10. (Unless you tell me some other better way to do this.) The code would then immediately add the last value of TotalRain*10 from the aforementioned table to the latest read cumulativerain and thereby ensure that Total Rain never decreases. This code would be called from wirelesssensors.py inside processFT020T. Do you think this would work?
Berne
|
|
|
Post by SDL on Jan 31, 2023 18:06:37 GMT -8
Yes, I think that would work. If you think about it, it should never decrease (except when it overflows which is a long time out). If it does decrease, you could act on the data to give you the right values. I'm not sure you need a whole new database.
No update in the near future.
We will let you know when we plan to do a new update.
The whole cancellation of the WeatherRack3 product has put a big hiccup in the schedules.
BP
|
|
berne
Junior Member
Posts: 85
|
Post by berne on Feb 2, 2023 6:51:12 GMT -8
I think we need a new table that captures cumulativerain/10 and the total rain. This is because every value of TotalRain should equal
'TotalRain.new =
if(cumulativerain.new - cumulativerain.prev) < 0 then TotalRain.new = TotalRain.prev + cumulativerain.new/10 else TotalRain.new = TotalRain.prev + (cumulativerain.new - cumulativerain.prev)/10
On a reset if cumulativderain.new = 0 TotalRain.new = TotalRain.prev Otherwise TotalRain always adds the difference between cumulativerain.new and the previous value.
Anyway, Let me know what you think. I may start coding this up soon. The new table would simply have a timestamp, and capture cumulativerain at each measurment along with the correct Total calculated above. Using SQL to store this gets around any issues with rebooting the Pi loosing memory values. (Of course given we really don't use SQL relational features a simple CSV data file would also suffice.)
Let me know, Thanks, Berne
|
|
berne
Junior Member
Posts: 85
|
Post by berne on Feb 2, 2023 13:30:20 GMT -8
One more quick question, the config.py and state.py modules seem to be a way to store global values that are used elsewhere. Sort of like a FORTRAN common block (yes I am that old)? Could you confirm? I haven't found yet where they are written to disk so they would vanish when the RPi would reboot, correct?
|
|
|
Post by SDL on Feb 2, 2023 16:53:32 GMT -8
Yes, that is exactly what they are like. You are dating yourself!
They do vanish when the program restarts. Look for how these are loaded from the JSON file.
BP
|
|