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 · 0 comments
Open
2 tasks done

Monthly averages #387

stevelacey opened this issue Dec 15, 2024 · 0 comments
Labels
enhancement New feature or request Needs Review

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Needs Review
Projects
Status: Todo
Development

No branches or pull requests

1 participant