Weatherbit.io - Current Weather and Forecast data

Hi Marius,

Weatherbit is using Meteoalarm, see below the result of the API call.

https://api.weatherbit.io/v2.0/alerts?lat=51.xxxx&lon=4.xxxx&key=xxxxxx

country_code	"NL"
lon	4.xx
timezone	"Europe/Amsterdam"
lat	51.xx
alerts	
0	
regions	
0	"Hoek van Holland,NL"
ends_utc	"2021-04-06T17:26:35"
effective_local	"2021-04-06T07:26:00"
onset_utc	"2021-04-06T05:26:00"
expires_local	"2021-04-06T19:26:35"
expires_utc	"2021-04-06T17:26:35"
ends_local	"2021-04-06T19:26:35"
uri	"https://meteoalarm.org?geocode=EMMA_ID:NL802"
onset_local	"2021-04-06T07:26:00"
effective_utc	"2021-04-06T05:26:00"
severity	"Advisory"
title	"Wind"
description	"Nepali(ne-NL): noordwest 7 bft\nEnglish(en-GB): northwest 7 bft"
city_name	"xxxxxx"
state_code	"11"

You can temporary adjust the binary sensor of course: :wink:

              [0].description.split('Nepali(ne-NL):')[1].split('English')[0]}}

a yes, thanks.
how odd this has changed to something so incorrectā€¦ what on earth is ā€˜Nepaliā€™ā€¦other than Nepal, where we obviously are not, given the gps coordinates.

the full feedback changed though, because before we could filter on ā€˜nederlandsā€™ and ā€˜francaisā€™.

Ive changed the template for now to:

          Description: >
            {% if states('sensor.weatherbit_weather_alerts')|int > 0 %}
              {{state_attr('sensor.weatherbit_weather_alerts','alerts')
                [0].description.split('ne-NL):')[1].split('English(en-GB):')[0]}}
            {% else %} No alert
            {% endif %}

This helped me, thankyou :slight_smile:
I had assumed that the integration would pull the pollen count as entities, rather than having to request it through the API. Once I saw the link you had been struggling with, I realised what I had to do :smiley:

HI Bjarne,

since 2021.6, we are now offered the option of enable polling for updates in core integrations.

I would have hoped this to work for all integrations, but apparently not:

Is that something you could also implement in your custom integration? Not a first world issue, but would be nice to have. Please have a look?

cheers!

I saw that in the release notes for 2021.6. I will need to check up on how this is implemented, but I assume it can be done. Could you please create an issue on Github, so I donā€™t forget?

done :wink:

1 Like

Hello, Bjarne,

I have a similar location issue that another user posted early on: my exact lat/lon is set in HA, but the Weatherbit integration sets a location that is several miles away. Your instructions indicated that other locations can be added, but there were no further instructions as to how this is to be accomplished. Iā€™m a noob at this - can you elaborate what I need to modify to get one of the closer Weatherbit stations added to my integration?

Also, is ther a fix for the default 3 mi visibility issue?

Iā€™ve been playing with several of the weather integrations and so far, Weatherbit seems to be more accurate for my (approximate) location than several of the others.

Thank you,

Hello DBB1
It is WeatherBit that picks the station closest to your Latitude/Longitude and it might just be that this is several miles away.

But I am in the process of completely rewriting the Integration and its WeatherBit communication module, so I will look in to this issue while doing that, to see if there is an option to ensure the closest possible station.

I expect a beta of the new Integration within a week.

Thanks, Bjarne!

You can find a complete list of all the stations that WeatherBit uses and their Latitude/Longitude here: https://www.weatherbit.io/static/exports/stations_current.csv.gz. This is a CSV file, you can import into Numbers or Excel

hey @klogg is this still working fine for you? I tried your template but get the sensors as unavailable.

I use the integration now.
I canā€™t remember why I changed but it seems to have everything I need.

Can you please share your template sensors again if you have changed them?

Sorry, I donā€™t have them any more.
I moved completely to the integration

ah fair enough I missed that in your last message.

I was after the rain forecast per day, will try and check the integration out.

Hello all,

Hoping someone can give me a little guidance on the subject issue I am seeing within my home assistant.

Below is the information from my logs. Can you all think of what could be causing this?

To my knowledge I havenā€™t changed anything with my setup. Could multiple home assistant restarts cause this?

File "/usr/local/lib/python3.9/site-packages/pyweatherbitdata/api.py", line 103, in update_sensors
  File "/usr/local/lib/python3.9/site-packages/pyweatherbitdata/api.py", line 313, in _async_request
pyweatherbitdata.exceptions.InvalidApiKey: The API Key used is not valid. Try again with a new key.
2022-06-20 14:33:12 ERROR (MainThread) [custom_components.weatherbit] Unexpected error fetching weatherbit data: The API Key used is not valid. Try again with a new key.
  File "/config/custom_components/weatherbit/__init__.py", line 117, in async_update_forecast
    data: ForecastDescription = await weatherbitapi.update_forecast()
  File "/usr/local/lib/python3.9/site-packages/pyweatherbitdata/api.py", line 196, in update_forecast
  File "/usr/local/lib/python3.9/site-packages/pyweatherbitdata/api.py", line 313, in _async_request
pyweatherbitdata.exceptions.InvalidApiKey: The API Key used is not valid. Try again with a new key.
2022-06-20 14:33:13 ERROR (MainThread) [custom_components.weatherbit] Unexpected error fetching weatherbit data: The API Key used is not valid. Try again with a new key.
  File "/config/custom_components/weatherbit/__init__.py", line 108, in async_update_data
    data: ObservationDescription = await weatherbitapi.update_sensors()
  File "/usr/local/lib/python3.9/site-packages/pyweatherbitdata/api.py", line 103, in update_sensors
  File "/usr/local/lib/python3.9/site-packages/pyweatherbitdata/api.py", line 313, in _async_request
pyweatherbitdata.exceptions.InvalidApiKey: The API Key used is not valid. Try again with a new key.

About says it all.

Ahhh, I accidentally selected ā€œFree Business Trialā€ which had a 30 day caveat rather than ā€œFreeā€ when I signed up last month. Screenshot below for anyone accidentally doing the same thing as me in the future.

Thank you @nickrout

My Weatherbit integration was working normally for some time.
But yesterday I discovered that all entities had status unknown.

I since tried multiple times to remove the integration, restart HA, and re-add the integration.
This works every time but the integration only creates a device without any entities (see screenshot).

The logs show this error:

* Unable to prepare setup for platform weatherbit.weather: Platform not found (cannot import name 'ATTR_FORECAST_NATIVE_PRECIPITATION' from 'homeassistant.components.weather' (/usr/src/homeassistant/homeassistant/components/weather/__init__.py)).
* Unable to prepare setup for platform weatherbit.sensor: Platform not found (cannot import name 'ATTR_FORECAST_NATIVE_PRECIPITATION' from 'homeassistant.components.weather' (/usr/src/homeassistant/homeassistant/components/weather/__init__.py)).

Any ideas? Am I the only one? Is your integration still working as expected?

Hi Jƶrg,
Did you upgrade to 1.0.11? This version only works with Home Assistant 2022.7 and greater. I put that as a minimum version in HACS, but maybe you upgraded without using HACS.
Anyway, you can either downgrade to 1.0.10 again or wait until 2022.7 is released - I guess this Wednesday.

1 Like