[Feature suggestion] Add the weather prediction to the calculation
Typically, when it's rainy (maybe snowy as well; can't test in Israel), the sky will become darker earlier due to many clouds being together across a wide area Currently, to combat this I need to manually specify a large offset (the other day it was as much as -66 minutes), but it isn't reliable, as in Israel the next day might be sunny, thus the sky will turn dark later
I believe that the calculation shouldn't be hard: If it's predicted to be rainy (e.g. showers), offset the time to the rain time if it's close to the afternoon (e.g. 3 PM)
good idea, hard to implement. will see how this goes.
Weather query APIs generally aren't free, so I don't see this to be possible in the near future
This is now theoretically possibly by using OpenWeather's OneCall API (https://openweathermap.org/api/one-call-api) However the feature needs a lot more functional definition and specification.
I would put this feature in the ballpark of "possible, if more people contribute to it".
Good idea would love to support it
Good idea would love to support it
if you want to contribute, it would be nice to have a proof of concept C# application that reads and parses openweathermap API data
Here is an easy snippet or a library we can use.
I'm kind of unsure, regarding the current architecture, how to implement it.
I think a good way to implement this would be to create a WeatherHandler and introduce an additional offset variable.
Concept
The WeatherHandler is responsibe for querying the weather API and returning weather information for a provided geo position (Lat/Lon)
It would be a static class that has at least two public methods handle
- getting data from the weather API
- parsing the data
For example
T GetWeather(int lat, int lon) to retrieve the weather data.
Weather ParseWeatherData(T weatherData) where the return type Weather is an Enum consisting of for example:
- Cloudy
- Sunny
- Rainy
- Windy etc.
Ideally that happens asynchronously so the application doesn't pause.
Having that WeatherHandler available would go a long way in being able to implement this.
Integration in ADM
That weatherhandle can be wrapped by a module and update periodically. The module updates a variable in its global app state. This variable can then be used in the location service based switching logic to apply the offset.
Config
The rest would involve creating a config that stores offset values for certain weather types.
...
Sunny: -15
Rainy: 25
Cloudy: 10
...