Weatherbit.io - Current Weather and Forecast data

Thank you for your great work! I think for now it’s probably better if you leave the single sensor per day and if people want they can create their own forecast sensors. More flexible, but a little more upfront work! Thanks again!

Hi All,
This took a bit longer than I expected, but handling dates and timezones, is more complicated than I thought. In the end I had to actually read the Developer Docs :grinning: and this Integration now conforms to the way HA expects it to. The Weather Entity always expects a DateTime entry in UTC, where as I had to convert the time for the Sensor to be Location Aware as this is not handled by Home Assistant.

I have done numerous tests, and in the end it boils down to the Timezone you have set on your Computer, if the Days are displayed correctly. So if you add a Weather Entity for the same Timezone as your Computer is set to, it should display correct, but if it is a location in a different Timezone, the days might not be correct for parts of the day.

Let me know how this goes.

Release 0.12

  • Weather Entity now reports datetime as UTC Date time in RFC 3339 format, which is what the Lovelace Weathercard expects.
  • Sensor Entity now reports datetime as Location aware Date time in RFC 3339 format.
  • Bumped weatherpypi to 0.13
2 Likes

Agree. And unless I get massive requests, I will leave it as is.

I “think” there is a bug with visibility. Mine always shows 3 miles and I’ve seen similar in other posts. Here is a screenshot:

weatherbit

I can’t really verify if it’s a bug in the python code or an issue with the API (as I can’t easily see the underlying data).

I just tested 8 different locations spread across the Globe, and unfortunately they all report 3mi or 5km. So I must conclude that the raw data we get from weatherbit always include that number. Maybe it would help if this was reported to weatherbit?

@briis Dates are working now! Thanks for figuring all that out! I agree with your decision on the sensors, but could I ask you to make just one more? There is a text description field in the current API:

"weather":{"icon":"c02d","code":"801","description":"Few clouds"}

and it would be great to have that text string (e.g.“Few clouds”) for a custom weather card.

My current visibility is 5 if I look at the API data as well.

@ffeingol If you want to see the raw weather data, you can look at the API data yourself. The documentation for the API is here: https://www.weatherbit.io/api. Scroll down and click on the green Documentation button for whichever data you are interested in. For example, if you choose Current Weather, and scroll down the page a bit, it gives an example API call:

https://api.weatherbit.io/v2.0/current?city=Raleigh,NC&key=API_KEY

Replace Raleigh,NC with your city and API_KEY with your API key, and paste that link into a browser. It will return the data is JSON format. If your city doesn’t work, you could also use latitude and longitude with

https://api.weatherbit.io/v2.0/current?lat=XXXX&lon=YYYY&key=API_KEY

1 Like

I’ll be happy to do that. I know it’s really outside the scope of this, but if you can give me an example of how to call the API via curl I could report it a lot easier. If not, I totally understand. Just read the next post and that was all I needed.

2 Likes

This is an all round brilliant alternative to Dark Sky. Thanks for your work on this!

1 Like

I will add that sensor as soon as possible.

1 Like

I wonder if you could give me a list of all the possible forecasts, i.e cloudy, sunny, rainy etc?
It would be a big help for my lovelace UI.

https://www.weatherbit.io/api/codes

Thank you. But I need to know the exact wording of what appears in the sensors. For instance, in the link you supplied, although there are ‘few clouds’, ‘broken clouds’ etc there is no ‘cloudy’, which is what appears in the sensors.

Also, to clarify, is sensor.weatherbit_forecast_day_1 today’s conditions or tomorrow’s?

And finally, is the precipitation in the forecast sensors the % probability of rain or the mm of rain forecast?

@mattvolp Some of your questions are answered in the API documentation as I mentioned in this post. Day 1 is today. Precipitation is mm/inches. I don’t see a list of possible conditions in the documentation, but I haven’t looked very hard. So far I have seen “rainy”, “partlycloudy”, “cloudy”, “lightning-rainy”. I’ve been working today on changes to the Dark Sky animated weather card so it will work with Weatherbit - I don’t know JS so I’m just hacking away to make something for my own personal use :grin:

Thanks for this.

I guess the info i’m after are all of the conditions outlined here: https://www.home-assistant.io/integrations/weather/ as they are the only ones the weather platform understands.

You are right Matt. What I do, is that I take the code from the API

weather: {

}
and map that to the condition you see in the Weather entity. The Weather Entity is somewhat limited compared to what Weatherbit delivers, so some conditions are mapped to more than one code. See a complete list of Weatherbit Icon codes here: Weatherbit API Icons / Condition Codes as @klogg already pointed out.

1 Like

Severe Weather Alerts

I have prepped the API Engine to handle the Weather Alerts we can get from Weatherbit, but before I just add that blindly, I want to ask the community how this should be presented.

  1. As Weatherbit does not deliver ONE file with Raw data, every new function requires an additional call to the Weatherbit API, and as such it will hit your daily 500 calls limit. So would people prefer to have this as an option that can be de-selected when setting up the Integration, or should I retrieve the data together with the Forecast ?

  2. My current thinking is to add this as ONE additional sensor, where the state displays the number of alerts for the location, and the data is then stored in the Attributes. These Attributes can then be retrieved in Automations, Notifications etc. Any other suggestions?

I’m currently hitting 280 calls a day (2 locations). I’m not using the individual sensor option and at this time not interested in Alerts. Would your change put me at/over the limit? .

No - with the Update Interval you have set now, you will not hit the limit. This will add another call pr location per forecast update interval. So if this is set to every 30 minutes it will another 96 calls per day.

2 Likes