Closed rotgier closed 3 months ago
We can only make 50 requests to AccuWeather API per day. Currently the integration uses 36 requests per day for current weather conditions (updated every 40 minutes) and 4 requests for daily forecast (updated every 6 hours). The remaining 10 requests are needed in case of Home Assistant restarts (every restart needs 2 requests). Adding hourly forecast updated every 6 hours will reduce the number of possible HA restarts or reduce the frequency of fetching daily forecast data and current conditions. IMO both options are bad. This is the main blocker in this case :) If you have an idea how to solve it, there are no other contraindications to implement hourly forecast.
Ok, I see :)
Hmm and what about allowing a second, optional api key for hourly forecast in the home assistant integration configuration. If somebody will provide it, than we can fetch hourly forecast every 40 min. using this second optional API key 😎 .
I need to have a reliable weather forecast that allows me to manage charging and discharging battery of my hybrid inverter. It's not doable without hourly forecast.
Maybe you know about other hourly forecast HA integrations that are reliable for Poland. I thought about implementing HA component for https://www.pogodairadar.pl/ (web scraping as they have no API) - as it is the most accurate from my perspective.
But it seems that Accuweather is also quite solid ... hence the need for hourly weather forecast ☀️
what about allowing a second, optional api key for hourly forecast in the home assistant integration configuration
This would be a violation of AccuWeather's terms of use, so we can't do it in the official integration... but it is doable if you turn it into a custom integration.
I've prepared a custom integration by modifying your code: https://github.com/rotgier/home-assistant-accuweather/pull/1/files
Could you take a look at this PR and provide your feedback?
I was not sure if I need a separate websession for AccuWeatherHourlyForecastDataUpdateCoordinator (probably not).
Also I've noticed that when I try to fetch more than 12 hours of hourly forecast then I get an API error. Is this expected from your experience?
Otherwise, it seems to be working just fine 😎
Also I've noticed that when I try to fetch more than 12 hours of hourly forecast then I get an API error. Is this expected from your experience?
For free API keys only 12h forecast is available
I was not sure if I need a separate websession for AccuWeatherHourlyForecastDataUpdateCoordinator (probably not).
No
Thanks! :)
I will change the PR as I've suggested in the comments
The PR is ready steady: https://github.com/rotgier/home-assistant-accuweather/pull/1/commits
Let me know if there are no issues and I can merge it.
I would like to prepare a similar integration with (wetter-online.de) pogodairadar.pl .
Since I'm new to HA development (and python in general 🤠 ) it would be great if you could review the code. If so let me know how I can contact you, other then creating issue in your repo :). If needed you can reach me via my email: rotgier@gmail.com
I also wonder ... when you will be pushing updates to the official Accuweather integration, what would be the easiest way of propagating them to the custom integration 🤔
@bieniu Thanks for reviewing https://github.com/rotgier/home-assistant-accuweather/pull/1/ - I've fixed all comments and I'm merging this.
As mentioned before, I've prepared integration for wetteronline.de (pogodairadar.pl).
I've used the code from your accuweather integration and adapted it for another weather forecast source :)
This is my first HA integration. If you could take a look and let me know If I've done any obvious mistakes, then I would be very grateful.
If you are too busy then maybe you could point me to a place where some HA devs could take a look at a first integration of a HA newcomer :)
If you are creating a new integration, I encourage you to try adding it to the HA core repository. This is definitely the best way to reach users. Of course, it requires a bit more work, but the HA developer community is happy to help, and you can count on me too. Unfortunately, if your integration is based on web scraping, it cannot be added to the core. In my opinion, it is a waste of time to play with scraping, in a month they will rework the site and you will have to start over. I see that the site is based on some API, and that is the direction I would go.
Hello,
@bieniu I was not sure how to reach you so I've created this issue.
I see that this project has the ability to fetch hourly forecast from Accuweather API.
However the hourly forecast is not present in the home assistant integration: https://github.com/home-assistant/core/tree/dev/homeassistant/components/accuweather (you are also the author of this integration)
I thought that I could tackle adding hourly forecast into /homeassistant/components/accuweather . Are there any obstacles for this that I should be aware of? It seems to be quite easy and I can prepare a PR for this. However maybe there are some problems and you have intentionally avoided adding hourly forecast into /homeassistant/components/accuweather .
Please let me know :)
Marek