Closed mr-manuel closed 1 year ago
This should work, but it's not so a nice solution, since we need two fetch files that are linked in different cron folders and they contain the same lines.
Do you have a better idea how to handle that?
Well, to be honest I don't know if we should implement this - it is a really special usecase not much users will need. But we need additional settings in the config, which may confuse most of the users.
Two fetch files is no option. If we will implement this, we have to think about how to optimize number of used API calls with onecall apis. E. g. if you fetch current weather every minute and forecasts every 3 minutes, you need only one call for both at the 3. minute...
Thanks for your answer. I had an idea now. I can create a cronjob_helper.pl
file that is called every minute. The file then executes the fetch.pl
considering the settings, how often which data should be fetched, by passing --current
, --daily
and/or hourly
.
The GUI should be intuitive.
So the second cronjob is active only if I use the alternative weatherservices for forecast? If I deactivate it, it will fetch only with the original cronjob and the second one is deactivated?
If Fetch Weather Data
is enabled, one cronjob cronjob.pl
(which runs every minute) gets enabled. The cronjob then checks which data should be fetched at the current minute. I uploaded already the changes in my branch, so maybe its easier to understand. The cronjob.pl
is not finished yet.
When I understood it correctly, the Alternative Weather Services
also before my modifications were only fetched, if the Fetch Weather Data
was on?
Now I finished it. The last question I have is where the cronjobs get deleted in the update process of the plugin. I found those lines https://github.com/mschlenstedt/LoxBerry-Plugin-Weather4Lox/blob/c3e1c45364e57567397b9d7be5aec3f2aec264cb/postupgrade.sh#L26-L47 to recreate them, but nowhere where they are deleted. Are they automatically deleted by LoxBerry during a plugin update?
Cronjobs named as the plugin (PLUGINNAME) in the /cron/cron.xxx folders are deleted on update and uninstall by LoxBerry.
Make a Pulltequest please. We will then have a look at the code. This should be easier to understand 😀
Could you first check and close my open pull request?
Done
Were you able to review the pull request?
Feature was merged
Cronjobs named as the plugin (PLUGINNAME) in the /cron/cron.xxx folders are deleted on update and uninstall by LoxBerry.
This does not seem to work anymore with LoxBerry V3. If I upgrade or uninstall the plugin the cronjobs are not deleted anymore. Is this a bug or a feature?
Would it be possible to fetch the current weather data with a different time interval as the forecast data?
Reason for this is, that I want to fetch the current data every minute from my own weather station over Weatherflow, but I don't need an update every minute for the forecasts from Visual Crossing. This would also exceed the free API calls.