MeteoAlarm not changing state to 'off'

Hi,

First off all. Thank you for adding this component. Much appreciated.

I’ve added this component to my Hassio setup and it kinda works. When a weather alarm occurs, the binary sensor changes to ‘on’ and I get the alarm with the text from the website. In that feed I can also see that he alarm will expire at a certain time, but even when it is past that time, or when MeteoAlarm remove the weather alert from the web page my sensor doesn’t change sits state to off.

This means, when it gets triggered the first time, it will stay ‘on’, until next alert and simply only change text.

Anyone else seeing this?

1 Like

Just to chime in, I have the same issue.

I configured Node-RED to send me an alert for my region whenever the sensor switches from off to on but this was triggered only once. Now the sensor remains in the same state.

Screenshot taken today, 15th of June, while the alert should’ve expired on the 7th

The strange thing is (if this is using the meteoalarm python “thing”), if I directly check the XMLs I notice two things:

  1. http://meteoalarm.eu/ATOM/BE.xml - an alert is issued for “Antwerpen / Anvers” (my region) but it’s not the wind warning I get to see in HA but a “moderate rain warning”.

  2. This is also shown in the xml file for my region. http://meteoalarm.eu/CAP/POLY/BE_15062019_157242498.cap.xml which the Python library normally extracts from the XML feed above.

  3. If I click the link to the HTML version of the alert the following message is shown “No special awareness required

So for me, not only is the sensor status not being updated, the whole weather alert itself isn’t updating as well. I did some testing myself with the mentioned python library.

from meteoalertapi import Meteoalert
meteo = Meteoalert('BE', 'Antwerpen / Anvers', 'nl-NL')
print(str(meteo.get_alert()))

And this does return the correct alert (the most recent one)

❯ python3 meteo_alert.py

{'language': 'nl-NL', 'category': 'Met', 'event': 'Geel Regen Waarschuwingen', 'responseType': 'Prepare', 'urgency': 'Immediate', 'severity': 'Moderate', 'certainty': 'Likely', 'effective': '2019-06-15T00:00:00+00:00', 'onset': '2019-06-15T00:00:00+00:00', 'expires': '2019-06-15T08:59:59+00:00', 'senderName': 'Royal Meteorological Institute of Belgium', 'description': 'Vrijdagavond en -nacht trekt een actieve frontale golf over ons land met soms intense regen of buien die op sommige plaatsen voor grote neerslaghoeveelheden in korte tijd kunnen zorgen. Mogelijk kan er van 10 tot 30 mm in 6 uren tijd vallen. \nEr is ook kans op onweer.', 'instruction': 'Kans op overlast door regen en/of buien.\nVerkeer en buitenactiviteiten kunnen hinder ondervinden.\nVolg weerberichten en waarschuwingen.', 'web': 'http://meteoalarm.eu/ne_NL/0/0/BE002.html', 'awareness_level': '2; yellow; Moderate', 'awareness_type': '10; Rain'}

This is my sensor configuration in HA.

/Volumes/config/setup/binary_sensors
❯ cat meteoalarm.yaml 
- platform: meteoalarm
  name: Meteo Alarm
  country: 'BE'
  province: 'Antwerpen / Anvers'
  language: 'nl-NL'

I’m using nl-NL because alerts for Belgium are only available in Dutch or French. Otherwise it never returns alerts.

Update
Further looking into this issue, I do notice these lines in the home-assistant.log file.

2019-06-05 08:27:14 WARNING (MainThread) [homeassistant.helpers.entity] Update of binary_sensor.meteo_alarm is taking over 10 seconds

2019-06-05 08:29:15 ERROR (MainThread) [homeassistant.helpers.entity] Update for binary_sensor.meteo_alarm fails

TimeoutError: [Errno 110] Operation timed out

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/meteoalertapi/meteoalertapi.py", line 35, in get_alert
    file = urlopen('http://meteoalarm.eu/ATOM/'+ country +'.xml')

urllib.error.URLError: <urlopen error [Errno 110] Operation timed out>
During handling of the above exception, another exception occurred:

File "/usr/local/lib/python3.7/site-packages/meteoalertapi/meteoalertapi.py", line 39, in get_alert
    raise(WrongCountry())
meteoalertapi.meteoalertapi.WrongCountry

But I think that last error WrongCountry is only due to the fact that it’s unable to resolve the URL. Because it did work to fetch the first weather alert.