home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.06k stars 29.72k forks source link

MeteoAlarm Sensor not activating #24255

Closed dedepene closed 5 years ago

dedepene commented 5 years ago

Home Assistant release with the issue:

Home Assistant 0.93.2

Last working Home Assistant release (if known):

Operating environment (Hass.io/Docker/Windows/etc.):

hass.io in vmware VM Component/platform:

https://www.home-assistant.io/components/meteoalarm/

Description of problem: The binary sensor is not reporting correctly. Right now there's a bunch of severe weather alerts issued for my region but the sensor stays "off" with "safe" payload. There are no error messages in the log.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

binary_sensor:
  - platform: meteoalarm
    country: 'BG'
    province: 'SOFIA'
    language: 'bu'

Traceback (if applicable):

Additional information:

ghost commented 5 years ago

Hey there @rolfberkenbosch, mind taking a look at this issue as its been labeled with a integration (meteoalarm) you are listed as a codeowner for? Thanks!

This is a automatic comment generated by codeowners-mention to help ensure issues and pull requests are seen by the right people.

rolfberkenbosch commented 5 years ago

I'm investigate this issue.

dedepene commented 5 years ago

I'm investigate this issue.

Also, if you get a chance, could you please fix the "language" parameter description. At first it says "4 digits" code, but then goes on to list two letter codes. It's a bit confusing.

rolfberkenbosch commented 5 years ago

Can you change you code as follows:

binary_sensor:
  - platform: meteoalarm
    country: "BG"
    province: "SOFIA"
    language: 'bu'

The above code is working, with the new changes. I also add your country and province to the unittest of the pypi library without any errors.

dedepene commented 5 years ago

Not working, Rolf :(

I literally copied and pasted the code above into my configuration.yaml, restarted hass.io, and the binary sensor disappeared altogether from the list of entities. Changed the quotation marks around the language code from single '' to double "" - the sensor was missing again. Commented out the language parameter and the sensor is back but since there are no active alerts for my region I can't tell if it's actually working.

Not sure if it's related but the meteoalarm.eu website itself has not been loading for me for the past couple of days for the most part. Every now and then it will load but more than often my HTTP request times out.

dedepene commented 5 years ago

OK, as of today I'm getting error messages in the HA log.

binary_sensor:
  - platform: meteoalarm
    country: "BG"
    province: "SOFIA"
    #language: "bu"
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/urllib/request.py", line 1317, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/local/lib/python3.7/http/client.py", line 1229, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1275, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1224, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1016, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.7/http/client.py", line 956, in send
    self.connect()
  File "/usr/local/lib/python3.7/http/client.py", line 928, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/local/lib/python3.7/socket.py", line 727, in create_connection
    raise err
  File "/usr/local/lib/python3.7/socket.py", line 716, in create_connection
    sock.connect(sa)
TimeoutError: [Errno 110] Operation timed out

During handling of the above exception, another exception occurred:

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')
  File "/usr/local/lib/python3.7/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/lib/python3.7/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/local/lib/python3.7/urllib/request.py", line 543, in _open
    '_open', req)
  File "/usr/local/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.7/urllib/request.py", line 1345, in http_open
    return self.do_open(http.client.HTTPConnection, req)
  File "/usr/local/lib/python3.7/urllib/request.py", line 1319, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 110] Operation timed out>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 220, in async_update_ha_state
    await self.async_device_update()
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 377, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/meteoalarm/binary_sensor.py", line 93, in update
    alert = self._api.get_alert()
  File "/usr/local/lib/python3.7/site-packages/meteoalertapi/meteoalertapi.py", line 39, in get_alert
    raise(WrongCountry())
meteoalertapi.meteoalertapi.WrongCountry
ArnoutVerbeken commented 5 years ago

Meteoalarm.eu was down over the weekend. Should be OK now. Just restart your HASS. I have not restarted myself though. Will update here once done.

Update: Nope, still not working. I got same error as above.

dedepene commented 5 years ago

Not working here either. No error messages in the log, but state stays "off" even though I set up for a region with active alerts. :(

ArnoutVerbeken commented 5 years ago

Mine works fine now, after another reboot. Still think it is related to the downtime they had this weekend.

ercsey commented 5 years ago

I have this problem too. Home Assistant version 0.94.1. binary_sensor not created. I have tried with the sample config