Open ctosae opened 1 year ago
@Dan-in-CA I'm testing your project but I can contribute with a donation if I can use it :)
@Dan-in-CA sorry, can you help to understand what is happening in this pluging?
This plugin has been contributed and edited by several users over time. The logic is not well defined. I think it needs a complete re-write.
What do you think such a plugin should do?
Dan
Hi Dan, thanks for reply!
What do you think such a plugin should do?
The idea of this plugin is good, but if not fixable I think it could be simplified (without temperature and more). A plus of SIP project would be to avoid wasting water and not to irrigate too much, so:
Based on the parameters of this plugin you could take a cue and keep:
Still on debug... @Dan-in-CA Instead of building a new one, the plugin needs just a "little" fix and it's perfect...
Like the first example https://github.com/Dan-in-CA/sip_plugins/issues/72#issue-1644061589 there are only 3 files per day:
# ls -l history*
-rw-r--r-- 1 root root 595 May 12 16:54 history_2023_05_12-16_54_45.json
-rw-r--r-- 1 root root 492 May 12 17:54 history_2023_05_12-17_54_50.json
-rw-r--r-- 1 root root 496 May 12 18:54 history_2023_05_12-18_54_55.json
In this case:
# cat history* | jq -r .rain
{
"1h": 0.24
}
{
"1h": 0.32
}
{
"1h": 1.78
}
Where: 0.24+0.32+1.78 is....
cat /var/log/syslog | grep rainfall | tail -n10
#033[36msip-irrigation |#033[0m b'Total rainfall:\n2.34mm'
#033[36msip-irrigation |#033[0m b'Total rainfall:\n2.34mm'
#033[36msip-irrigation |#033[0m b'Total rainfall:\n2.34mm'
#033[36msip-irrigation |#033[0m b'Total rainfall:\n2.34mm'
#033[36msip-irrigation |#033[0m b'Total rainfall:\n2.34mm'
#033[36msip-irrigation |#033[0m b'Total rainfall:\n2.34mm'
#033[36msip-irrigation |#033[0m b'Total rainfall:\n2.34mm'
#033[36msip-irrigation |#033[0m b'Total rainfall:\n2.34mm'
#033[36msip-irrigation |#033[0m b'Total rainfall:\n2.34mm'
#033[36msip-irrigation |#033[0m b'Total rainfall:\n2.34mm'
So the problem is that it saves only 3 times per day instead of every 1h (in this example the rain was for about 10h with a total of 10mm)
# cat weather_level_adj.json | grep da
"daily_irrigation": "4",
"days_forecast": "3",
"days_history": "3",
Not sure if the bug is about days_history = 3 (used as "hours_history" ?)
I concluded that it is better to improve the code, also using a new openweathermap feature. We've been up here a long time, so I hired a developer to do it You can ignore the case, thanks
Wow that's a first! I do know that one of the early contributors to that plugin was a professional software engineer.
One thing that has bothered me about the weather plugin in its present form is the amount of data it stores on the SD card with every check of weather conditions. Instead of saving just the date it uses it stores the entire response from Openweathermap including a lot of redundant data that is not needed. I have always tried to minimize the wear on the SD card as described in the SIP documentation: https://github.com/Dan-in-CA/SIP/wiki/SD-card-life
One thing that has bothered me about the weather plugin in its present form is the amount of data it stores on the SD card with every check of weather conditions. Instead of saving just the date it uses it stores the entire response from Openweathermap including a lot of redundant data that is not needed. I have always tried to minimize the wear on the SD card as described in the SIP documentation: https://github.com/Dan-in-CA/SIP/wiki/SD-card-life
Great point, I noticed this too and got concerned about it, although the new SDs are robust in terms of rewrites.
So initially I thought about minimizing the save date (an array saved with pickle or even pickle+gzip)
But after some analysis my new idea is great and now possible, to have the history... without saving any data and also without any data saved in the cloud! hehe ;)
It seems that the plugin shortly after the rain loses count of the rain that has fallen:
Mar 20 04:21 'Irrigation needed:\n0.9mm'
Mar 20 04:21 'Total rainfall:\n2.66mm'
Mar 20 05:21 'Irrigation needed:\n0.0mm'
<-- ok !Mar 20 05:21 'Total rainfall:\n4.1mm'
Mar 20 06:21 'Irrigation needed:\n1.3mm'
<-- ??Mar 20 06:21 'Total rainfall:\n2.3mm'
Mar 20 07:21 'Irrigation needed:\n3.4mm'
<-- ??Mar 20 07:21 'Total rainfall:\n0.92mm'
Mar 20 08:22 'Irrigation needed:\n4.2mm'
<-- ??Mar 20 08:22 'Total rainfall:\n0.2mm'
In thix example if I have to start at 08 or 09 o'clock it does not consider a few hours before.
Full log:
I also don't understand where the data for 3 days before and 3 days of forecasts are saved (as per setting)
Current
Mar 28 15:00
:Why only Mar 27 at 16.36, 17.36 and 18.36?
Here another example at
Mar 19 23:45
:Always only 3 history in one day at same time (16.xx, 17.xx and 18.xx)