MeteoAlarm

Hi

Anyone aware of any updated API of MeteoAlarm, or recent issues?
I noticed, now that we have severe weather warnings in Europe (wind), the MeteoAlarm integration stopped working.

When I restart my Home Assistant, this is what I see in the error logs:

2022-02-18 11:10:09 ERROR (MainThread) [homeassistant.components.binary_sensor] meteoalarm: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 709, in async_device_update
    await task
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/meteoalarm/binary_sensor.py", line 82, in update
    if alert := self._api.get_alert():
  File "/usr/local/lib/python3.9/site-packages/meteoalertapi/meteoalertapi.py", line 63, in get_alert
    alert_data = xmltodict.parse(text)
  File "/usr/local/lib/python3.9/site-packages/xmltodict.py", line 327, in parse
    parser.Parse(xml_input, True)
xml.parsers.expat.ExpatError: syntax error: line 1, column 0

My configuration:

binary_sensor:
  - platform: meteoalarm
    country: "belgium"
    province: "Antwerp"
    language: "nl-BE"

I noticed in the previous logs that it mentioned a peer connection reset, and in fact the MeteoAlarm website was not functioning properly as well. But that seems to be resolved now, however the sensor is still broken.

It was working fine about a week ago, so I know my configuration (unless the integration changed) should be correct.

This was the error before (connection reset by peer)

Logger: homeassistant.helpers.entity
Source: components/meteoalarm/binary_sensor.py:82
First occurred: 17 februari 2022 13:52:51 (1 occurrences)
Last logged: 17 februari 2022 13:52:51
Update for binary_sensor.meteoalarm failsTraceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 449, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 444, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.9/http/client.py", line 1371, in getresponse
    response.begin()
  File "/usr/local/lib/python3.9/http/client.py", line 319, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.9/http/client.py", line 280, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.9/socket.py", line 704, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/lib/python3.9/ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/lib/python3.9/ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
ConnectionResetError: [Errno 104] Connection reset by peer

update
I also checked release notes of more recent HA core releases, but none mention a breaking change on the Meteolarm platform.

Same problem here :pensive: I checked the URL and they provide information but it’s not processing. I tried multiple countries also.

If I use the Zuid-Holland it’s not working but if I use the example configuration it’s working.

Groningen

https://feeds.meteoalarm.org/feeds/meteoalarm-legacy-atom-netherlands

I have the same problem as Johann. When I use “Groningen” everything works fine.
When I use “Zuid Holland” I got this error in the log:

Logger: homeassistant.components.binary_sensor
Source: components/meteoalarm/binary_sensor.py:82
Integration: Binary sensor (documentation, issues)
First occurred: 15:27:45 (1 occurrences)
Last logged: 15:27:45

meteoalarm: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 718, in async_device_update
    await task
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/meteoalarm/binary_sensor.py", line 82, in update
    if alert := self._api.get_alert():
  File "/usr/local/lib/python3.9/site-packages/meteoalertapi/meteoalertapi.py", line 63, in get_alert
    alert_data = xmltodict.parse(text)
  File "/usr/local/lib/python3.9/site-packages/xmltodict.py", line 327, in parse
    parser.Parse(xml_input, True)
xml.parsers.expat.ExpatError: syntax error: line 1, column 0

Update to 2022.2.9 doesn’t make any change :pensive:

BTW on GitHub there is also an issue.

Meanwhile I checked if it’s the Home Assistant integration, or the underlying Meteoalarm Python API wrapper, but that seems to be working fine.

from meteoalertapi import Meteoalert

country = "belgium"
province = "Antwerp"
language = "nl-BE"

data = Meteoalert(country, province, language)
print(data.get_alert())

UPDATE
Not sure if it was due to the update to 2022.2.9, or the fact that Home Assistant restarts after the update but my sensor is working again.

So seems to be a temporarily issue with the Meteoalarm API endpoint.

1 Like

Update
Since 2022.2.9 the sensor works again. I can use “Zuid-Holland” and I get the right information

language: nl-NL
category: Met
event: Moderate wind warning
responseType: Monitor
urgency: Future
severity: Moderate
certainty: Likely
effective: 2022-02-19T07:20:43+01:00
onset: 2022-02-20T16:00:00+01:00
expires: 2022-02-21T06:00:00+01:00
senderName: KNMI Koninklijk Nederlands Meteorologisch Instituut
headline: Windstoten - Waarschuwingen voor Zuid-Holland - Nederland
description: Kans op zware windstoten van 75-90 km/uur.
Zondagavond kunnen er tijdelijk (zeer) zware windstoten voorkomen van 90-110 km/uur.
Kans op windstoten.
Verkeer en buitenactiviteiten kunnen hinder ondervinden.
Volg weerberichten en waarschuwingen.
web: http://meteoalarm.eu/ne_NL/0/0/NL009-Zuid-Holland.html
contact: [email protected]
awareness_type: 1; Wind
awareness_level: 2; yellow; Moderate
attribution: Information provided by MeteoAlarm
device_class: safety
friendly_name: meteoalarm

Here it’s working again. I guess it has to do with the levels?