Dutch precipitation forecast based on buienradar.nl

I did a pip3 install buienradar in the virtual environment.
Now I get the following errors:

File “/usr/lib/python3.4/asyncio/tasks.py”, line 235, in _step result = coro.send(value) File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/sensor/buienradar.py”, line 242, in async_update longitude=self.coordinates[CONF_LONGITUDE]) TypeError: parse_data() missing 1 required positional argument: ‘raincontent’ 2017-06-26 15:17:49 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved Traceback (most recent call last):

After a $ pip3 install asyncio in the virtual enviroment it is working

The buienradar sensor is working, but the buienrader weather the easy component does not give any data

@Koen01

I am working on it; I have a version running locally, which includes your solution as well

It will return all monitored_conditions it does now (these are from the weatherstation closed to your location)
AND
it will load forecasted precipitation data based on your actual gps location.

it will add a new monitored_condition called ‘precipitation_forecast

preview:

2 Likes

@Seth_Daemen

You can install the external lib manually, but if you do, please make sure you install the correct version (I might have pushed a newer version, that might not be compattible with the HA-buienradar code…)

so do (check the version in buienradar.py for the sensor component):

pip3 install buienradar=<version in buienradar source code>

and not

pip3 install buienradar

With regards to the issue you are experiencing with the buienradar weather component:

Please scroll up in this forum, there is a fix mentioned there for this (you need to modify the buienrader.py for the weather component (add a line with REQUIREMENTS) ; see above)

This issue will get fixed in the next release of the buienradar weather component…

Its no so stable now I get

WARNING (MainThread) [buienradar.buienradar] Missing section in Buienradar xmldata (weerstation).Can happen 00:00-01:00 CE(S)T

@Seth_Daemen
That is good news; this message is to be expected, as it says, between 0000 and 0100 dutch times.
You should not see this normally outside those times ; if you do there is an issue with the buienradar service
If you look in your logs, you should see the message disappears during the day

For some reason, between those times all weather station data is missing from the buienradar api.
I am able to download the xml for the buienradar sensor, but it will contain no weatherstations and therefore no weather data. I have observed this to happen every night from 00:00 to about 00:45… I do not know why

So if within that mentioned time-frame it is OK/to be expected. if it is outside those times, there might be an issue with their service, or we might be dealing (in the future) with a changed xml format…

Yess it is between 0000 and 0100

but sometimes data is missing outside these hours

I am trying to get this to work as well. Am running HA 0.47.1 and getting the following (I presume buienradar.nl related) errors:

> 2017-06-28 14:34:28 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
> Traceback (most recent call last):
>   File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step
>     result = next(coro)
>   File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 368, in async_process_entity
>     new_entity, self, update_before_add=update_before_add
>   File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 202, in async_add_entity
>     object_id = entity.name or DEVICE_DEFAULT_NAME
>   File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/weather/buienradar.py", line 78, in name
>     return self._stationname or 'BR {}'.format(self._data.stationname
>   File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/sensor/buienradar.py", line 269, in stationname
>     from buienradar.buienradar import STATIONNAME
> ImportError: No module named 'buienradar'
> 2017-06-28 14:34:59 ERROR (Thread-10) [plexapi] http://192.168.1.9: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
> 2017-06-28 14:35:28 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
> Traceback (most recent call last):
>   File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step
>     result = next(coro)
>   File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/sensor/buienradar.py", line 232, in async_update
>     from buienradar.buienradar import (parse_data, CONTENT,
> ImportError: No module named 'buienradar'

I use this in my configuration.yaml:

weather:
platform: buienradar

I tried the fix of adding “yield from” as above but that did not change anything. Anyone that can help me get this working?

@jeroenterheerdt
Please scroll up in this page, This is an issue in the buienradar weather component, you have to manually add one line of code into the weather/buienradar.py

You can find the description of the change needed above this this thread…
This issue will be fixed in the next update…

for now there are 2 ways out:

  • manually edit the mentioned file
  • also configure the buienradar sensor,
    • that will trigger the external library to get installed
    • you might need to restart ha twice for this to work:
      • once to trigger the lib to get installed and activate the sensor
      • the second time if you observe that the weather component does not work (ie it was started before the external lib was installed)

Good luck!

@Seth_Daemen
I noticed that as well;

Although I have not yet caught this in the logging, so cause is still unknown;
I have added more detailed logging in my scripts to see what this is caused by, but since then I have not observed it yet

I have observed some values to be 0 (in the new version i am testing), which should never have that value, such as pressure. I have added more logging to see the source data in the logfile, but it has not yet reoccurred since then

Thanks, what do you mean add a line? I read it as a line change. Also: What do you mean when saying configuring the sensor? Sorry for the newbie questions.

Jeroen,

you are right; there are two things to change (I thought it was mentioned here already… but apparently only one has been mentioned before, here…

This issue mentioned before (see above):

The second issue (also in weather/buienradar.py, directly after the last import statement at the top of the file). there you need to add (before the line defining the logger):

REQUIREMENTS = ['buienradar==0.5']
_LOGGER = logging.getLogger(__name__)

.
Both of these issues require you to modify the python source code of the buienradar weather component. If you do not feel comfortable doing that, please do not attempt it; making a mistake here could cause homeassistant to break and no longer start…

it that case, please wait for the next update of this component…

1 Like

The other solution is to add the buienradar sensor to your config.yaml, see here how to do that:

If you do this, you will get a sensor for weather conditions as well, but by adding the sensor, the missing external library will get installed into homeassistant

you still need to modify the other fix, though (i.e. add ‘yield from’…)

I am fine making the changes but I missed the REQUIREMENTS line that needed to be added. The error seems gone, here is hoping it works. For the record, I did not do the sensor addition to config.yaml - using weather only. Thanks for your help! Bedankt :slight_smile:

I re-imaged my RPI, now with the all-in-one installer, but buienradar does not come up. It is enabled as weather in my config. I tried also including it as sensor but that did not change anything with regards to the error. Also I made the two code changes as mentioned. here is the error now (something with parse_data):

2017-06-29 10:09:14 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.4/asyncio/tasks.py”, line 237, in _step
result = next(coro)
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/sensor/buienradar.py”, line 232, in async_update
from buienradar.buienradar import (parse_data, CONTENT,
ImportError: cannot import name ‘parse_data’

Any ideas?

Can u share the codes of this sensor? I would like to add it to HA, but i can make it working.

As of late, i am getting these “no location selected” while i do have the gps coordinates in there, and it used to work. Anybody else seeing that?

@mjj4791, Can you share your Chart code for '‘komende uur’ rainchart? I like it, but i can’t get it to fix it like you have.

@rmdejonge
Best thing to do; to prevent all issues about code modification mentioned in the thread above:

  • Start by upgrading homeassistant to version 0.49

    • all issues about the weather component are fixed in this version; no need to modify code files any more
  • then activate the buienrador sensor, as documented here: https://home-assistant.io/components/sensor.buienradar/

  • for the forcasted rain to work, add one or both of these monitored_conditions:

    • precipitation_forecast_average
    • precipitation_forecast_total
  • by default, this will look ahead 60 minutes, but you can change this by setting the timeframe option to a different value.

  • then, if you want to change the names of the buienradar sensors, use this to change the display names to something understandable: https://home-assistant.io/docs/configuration/customizing-devices/

    • for example:
      customize:
      • sensor.thuis_precipitation_forecast_average:
        • friendly_name: Voorspelde regen
      • sensor.thuis_precipitation_forecast_total:
        • friendly_name: Totaal voorspelde regen

I have set timeframe to 30 minutes at the moment, this is what it shows for me:

1 Like

@riemers:
I do not see these errors…
I used to run on 0.47.1 and just upgraded to 0.49.0; in both cases I do not see these…

I personally specify a different location in the sensor configuration (to force a different weatherstation to be used; the nearest weatherstation is too close to the sea for me), but even without specifying gps locations inside the sensor config, it should select the closest weatherstation regardless… (just tested to re-confirm on 0.49.0)

Do you see this all the time, or just sometimes?
If you see this regularly, maybe you can catch it in the log, try this logging setting to catch it:

  • logger:
    • default: warning (or error)
    • logs:
      • homeassistant.components.sensor.buienradar: debug
      • homeassistant.components.weather.buienradar: debug
      • buienradar.buienradar: debug