Weatherbit.io - Current Weather and Forecast data

Introduction

As many people are aware of, DarSky was bought by Apple, and they immediatly discontinued the option for new users to get an API Key and also announced that the service for existing users will stop working by the end of 2021.

I, as many others, started to look for alternatives to get weather data in to Home Assistant, and there are allready a lot of great Weather components available for Home Assistant. Never the less, I decided to see what else was out there, that had a Global precense for data, and I stumbled on Weatherbit.io. It has a Free Tier API Key and a Global precense, so I decided to write a Home Assistant Integration to support it.

There is currently support for the following device types within Home Assistant:

  • Weather
  • Sensor

There is only support for daily forecasts, as the hourly forecast requires a paid API Key.

Installation

HACS Installation

This Integration is part of the default HACS store, so search for Weatherbit in HACS.

For further installation options, please see the README.md on Github

Configuration

The Weatherbit weather service is free under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Generic License. Weather data will be pulled once every 30 minutes.

To add Weatherbit weather forecast to your installation, go to the Integrations page inside the configuration panel and add a location by providing the API Key for Weatherbit and longitude/latitude of your location.

If the location is configured in Home Assistant, it will be selected as the default location. After that, you can add additional locations.

During setup you will have the option of installing Individual sensors for each of the Current Day values plus the next seven days of Forecast. This will be setup by default, but you can opt not to install them by deselecting the checkbox. If you deselect, and later want the sensors installed, you will have to remove the Integration and then set it up again.

You can only add locations through the integrations page, not in configuration files.

API Key for Weatherbit

This integration requires an API Key that can be retrieved for free from the Weatherbit Webpage. Please go here to apply for your personal key.
This key allows you to make 500 calls pr. day, and as this Integration uses 4 calls per hour (96 pr day), you can add a maximum of 5 locations to your setup, without exceeding the limit per day.

Support

Use this post in the forum to ask myself and other users questions, and if you find an issue, please report it on the Issues section on Github

10 Likes

Release 0.9: Adding Sensors

BREAKING If you upgrade a current installation, you must remove the current Integration first (Go to the Integration Page, click the 3 dots in bottom right, and select delete), restart Home Assistant, and then add the Integration again. Failure to do so, will result in an error during setup of the Integration.

This release adds current weather data and forecast for 7 days, as sensors. This is very similar to the way DarkSky is able to show both a Weather Card and individual sensors. This is the first release of the sensors so let me know if it is working and they give valuable information.

For individuals who do NOT want the sensors added to Home Assistant, you are given the option during setup, to not install sensors. If you later decide you want the sensors, you will need to remove the Integration, and set it up again.

1 Like

I’m trying to install this upgrade.

I had the previous version so I went through the uninstall and then re-added it via HACS.
However I cannot see it as an integration anywhere.

I went through the process twice and did copious restarts :wink:
What could I have done wrong?

Thanks.


Successfully installed in HACS
image

Not available in the Configuration, Integrations page
image

You did restart Home Assistant after the Installation?
Could you check in HACS what version you have installed? It should be 0.9.

I just double checked the source that is pulled down, and it is fine. I tried on two different HA installations, and I see the Integration on both of them.

Ok, so I have several more restart this morning and I checked again and it now appears as an available integration.

For the record yes I had done a restart after installing it, in fact as I said, copious restarts throughout the process, especially the second time I tried.

Anyway, I’m all good now.
Thanks.

Very strange, but glad it works now.

Great integration, thanks a lot! Would it be possible to make the polling interval configurable? I’m using the solar radiaton sensor to decide whether my motion sensors should turn on the lights, so a little shorter polling interval would be handy.

Just got the same question on Github also :grinning: Yes it is possible. I assume that you would be happy if you could update Current data more frequently, and then leave the forecast data to every 30 min?

That’s exactly what I would need :slight_smile:

Sensors are a great addition, thanks. It makes it much easier to break out the information and use it for automations. Is there any chance you could add severe weather alerts? There is an API available for it as well from weatherbit. Thanks for your work, a new weather service was sorley needed. Any plans to add this to core?

Glad you liked it. I am almost done with adding the Current Data update Interval, so that should go out later today.
I already made some of the core work for the Severe Weather Alerts, so that is definitely possible. My biggest issue here is that I live in area were I almost never get these alerts, so if anyone lives in area were you have more severe weather please post an area I could test on.

I live in the US and it’s springtime, so we have severe storms about every 2 weeks. I’d be happy to give you feedback. I currently scrape the National Weather Service RSS feed, so it would be interesting to see what the delay is with weatherbit in the middle.

You can find current active alerts for testing here: https://alerts.weather.gov/cap/us.php?x=1

Perfect, thanks Brian. I will work on this, once I am done with the Update Interval.

RELEASE 0.10: Update Intervals can now be specified

With this release you can now specify update intervals for both Current Data and for Forecast data. For Current Data there is range between 4 and 60 minutes for updates and for forecast Data it is between 30 and 120 min.

The reason for the 4 minutes on the Current Data, is that if you go below that, there is a very high probability that you will exceed your daily limit of 500 requests.

You can update from V0.9 without problems, but you will have to remove and re-add the Integration to specify the update intervals. That should not break your current setup.

Remember to restart Home Assistant after the upgrade.

As you can see from this thread, this was done very fast, so testing has been limited - but it works fine on my installations of HA.

2 Likes

First, thank you for the work. So far this look great. Secondly, this may be helpful for people: https://www.weatherbit.io/api/meta It’s way to download a file (I used the CSV) to correctly find the city you want. When I put the lat/lon in (which I’m quite sure is correct) it was finding a city 2 suburbs away. I was able to get what weatherbit.io ‘thinks’ is my city and use that for the override lat/lon.

2 Likes

Is there any way to verify the polling intervals? I reinstalled the integration and set the update interval to 4 minutes, but the data I’m getting is still old:

attribution: Data provided by Weatherbit.io
updated: '2020-05-30 05:30'
unit_of_measurement: '%'
friendly_name: Weatherbit Cloud Coverage
icon: 'mdi:cloud-outline'

I suspect that weatherbit.io don’t update the data more often, but I would like to verify this.

Ask them then.

When adding the update interval, I did not actually check the API for how often THEY update the data, and it is not in the documentation anywhere. In their Forum I found a post from 2018 that says:

(3) ~40,000 stations report hourly, or subhourly. While ~120,000 stations report at least once per day.

I am not sure if that is still accurate. But I will run some tests to see if the data changes more often, and hopefully some of you could keep an you on your Current data also.

Thanks for this integration, I appreciate your work on it! I just started using it last night. I am also seeing that the update interval is pretty slow. I configured mine for 15 minute updates on current data, but this is when my current temperature data updated over the last 12 hours (these are all AM times):

12:23, 2:38, 3:23, 4:08, 6:23, 7:08, 8:38, 9:23, 10:08, 10:53, 11:35 am

wbit graph

The integration doesn’t work properly for me with the built -in weather card - it’s taking the forecast day 1 data to be the current day’s data:

wbit weather card2

The current temperature is correct, but what it’s showing as Saturday (today) is really Sunday’s data, and so on down the line. As far as I can tell, there is no forecast high/low for the current day in the API (which I will miss, since Dark Sky has it). Actually, it is in the API, and it would be great if we could get that data into HA.

This is correct. The first day of the Forecast is the next day - this was my personal preference. But if people would rather have current day, it is an easy fix.?