Weatherbit.io - Current Weather and Forecast data

Lat and Lon works for me too

Not now I can’t but I’ve been playing with a few weather services recently and I am pretty sure one (maybe weatherbit) gives unlimited access to all endpoints for 30 days.

I did try the other ones and they would work with my API key, but not 5 day / 3 hour Forecast

That might be the reason why some of you can get the data, and I cannot. My key is a bit older than that. The only place Air Quality data is mentioned in the pricing sheet on Weatherbit.io is under the Advanced Option where you get access to:

Includes:

  • Daily forecasts
  • Current weather data
  • Hourly forecasts
  • Historical data (10 years)
  • Air Quality / Energy / Climate / Agweather API access
  • Commercial Use License

Just seen this:

Do you offer a trial period?

Yes! Sign up for the “Free” Weather API tier! The Free plan is free for non-commercial use. Some features of the “Free” plan are only available on a trial basis for 30 days after enrollment. After the trial period, these features will be disabled.

If anyone have used this weather plug to trigger lights to turn on at sunset, can you share your code? I have found this code snippet, but it is for Dark sky. I guess I would need to know the exact wording use in the value_template.

I just noticed an alert:


But it doesn’t show up:

None

Below the code I fount somewhere:

card:
  content: >
    ## <font color= red>
    {{state_attr('binary_sensor.weatherbit_alert','Title')}}</font>

    <font color= green> **Severity:**</font> <font color= grey>
    {{state_attr('binary_sensor.weatherbit_alert','Severity')}} </font>

    <font color= green> **Description:**</font>

    <font color= grey>
    {{state_attr('binary_sensor.weatherbit_alert','Description')}} </font>

    <font color= green>
    {{state_attr('sensor.weatherbit_weather_alerts','attribution')}}</font>
  type: markdown
conditions:
  - entity: binary_sensor.weatherbit_alert
    state: 'on'
type: conditional

What can be wrong here?

probably you didn’t create the binary_sensor I made, and which I use in the code you copied of my post :wink:

Ah yes, it’s the code I copied from your post, I didn’t remember anymore. :wink:
Do you parhaps want to post the code to create the binary_sensor? :slight_smile:

you know you can simply search the community, using a bit of that code? It will find it immediately, only a few posts above… Weatherbit.io - Current Weather and Forecast data

What, exactly, are you trying to do? That code uses the sun entity (which is built in based on your lat/lon) and then modifies it based off the weather conditions. If you just want to do it off the sunset, just remove the condition.

Yes, I want the lights to turn on base on the current weather as well. Since the condition is set for the Dark sky plugin, I figure it will not work for the Weatherbit plugin.

    value_template: >
      {{ trigger.offset.total_seconds()/60 == -20 or
         state_attr('weather.dark_sky', 'forecast')[0].condition
         in ('cloudy', 'partlycloudy', 'rainy') }}

Just substitute in the name of your weather entity and check the attributes are reported the same.

I get this error since yesterday

2020-06-29 06:25:58 ERROR (MainThread) [homeassistant.components.weather] Error while setting up weatherbit platform for weather
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 186, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 292, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 443, in _async_add_entity
    entity.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 297, in async_write_ha_state
    self._async_write_ha_state()  # type: ignore
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 324, in _async_write_ha_state
    attr.update(self.device_state_attributes or {})
  File "/config/custom_components/weatherbit/weather.py", line 241, in device_state_attributes
    ATTR_WEATHERBIT_UPDATED: getattr(self._current, "obs_time_local"),
  File "/usr/local/lib/python3.7/site-packages/weatherbitpypi/data_classes.py", line 229, in obs_time_local
    return get_timezone_date(self.ob_time, self._timezone, "%Y-%m-%d %H:%M")
  File "/usr/local/lib/python3.7/site-packages/weatherbitpypi/data_classes.py", line 313, in get_timezone_date
    val_date = dt.strptime(value, time_format)
  File "/usr/local/lib/python3.7/_strptime.py", line 577, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/local/lib/python3.7/_strptime.py", line 359, in _strptime
    (data_string, format))
ValueError: time data '06-29-2020 05:58' does not match format '%Y-%m-%d %H:%M'

{{ state_attr('weather.weatherbit', 'forecast')[0].condition }}

returns cloudy in the template editor for me today

Can you tell me if you are using a specific country code in Weatherbit? And if yes what it is?
It seems that you get the datetime in DD-MM-YYYY format and not YYYY-MM-DD, which is what is expected.

Here are my options.
I haven’t changed a thing since yesterday.

grafik

Strange - Just tried to run with the German setup and I don’t get any errors.
Unless you made a lot of renaming of the sensors, could you try and remove the Integration and add it again, with the same options?

I changed the option to EN and restarted ha, but it didn’t changed a thing.
I will try to readd the integration.

As writen, the change to EN didn’t help.
I deleted the integration and restarted ha, afterwards I added the integration again and restarted again :slight_smile:
But I got the same error.


I tried it again. Deleted the integration --> Restart. Add the integration (Language EN) --> Restart
grafik

Same error…