Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monthly averages #387

Open
2 tasks done
stevelacey opened this issue Dec 15, 2024 · 1 comment
Open
2 tasks done

Monthly averages #387

stevelacey opened this issue Dec 15, 2024 · 1 comment
Labels
enhancement New feature or request keep
Milestone

Comments

@stevelacey
Copy link

stevelacey commented Dec 15, 2024

Describe the feature

Monthly averages would be a great addition here, I want to be able to lookup forecasts from previous years to approximate a forecast for the future, e.g. look at March 2024 to estimate what the average temperature might be in March 2025.

...or better yet, let me look up March 2025 directly and do the legwork there too, average the last X years?

Examples

This is what I tried so far but obviously a particular day isn't going to represent a month, and I have to dance around making the date a datetime, and not in the future:

forecast = pirateweather.load_forecast(
    settings.PIRATE_WEATHER_API_KEY,
    instance.latitude,
    instance.longitude,
    time=datetime.combine(
        next(
            start_date
            for start_date in [
                instance.start_date,
                instance.start_date.replace(year=date.today().year),
                instance.start_date.replace(year=date.today().year - 1),
            ]
            if start_date <= date.today()
        ),
        time(12, 0, 0),
    ),
)
daily_forecast = forecast.daily()

This would be nice:

forecast = pirateweather.load_forecast(
    settings.PIRATE_WEATHER_API_KEY,
    instance.latitude,
    instance.longitude,
    time="2025-05"  # or "2024-05"
)
monthly_forecast = forecast.monthly()

Acknowledgements

  • I have searched this repository and Home Assistant Repository to see if the feature has already been requested.
  • I have written an informative title.
@alexander0042
Copy link
Collaborator

Sorry for my slow reply here, and thanks for suggesting this idea! As I'm sure you've noticed, the current historic data implementation is pretty slow, so not very well suited to this. Some sort of averaged or long term data retrieval is something that I'd love to add though, since it would be very helpful in a lot of cases.

Long story short, there are quite a few enhancements I'm trying to work though at the moment, so this might take a while to make happen. Open to any ideas/ suggestions/ PRs though, and I'll keep you updated as I move along!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request keep
Projects
Status: Todo
Development

No branches or pull requests

3 participants