Support for Environment Canada platforms

Do you see anything in the log?

Here is the log from when I started HA after the update to 0.99.3 last night. My sensors updated at some point, but the values of the sensors haven’t been updated since yesterday. It says the outside temperature right now is 22, humidex of 32, which it most certainly isn’t.

2019-10-01 16:36:40 WARNING (MainThread) [homeassistant.components.sensor] Setup of platform environment_canada is taking over 10 seconds.
2019-10-01 16:47:07 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.temperature is taking over 10 seconds
2019-10-01 16:47:24 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.watches is taking over 10 seconds
2019-10-01 17:07:09 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.advisories is taking over 10 seconds
2019-10-01 17:07:10 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.advisories fails
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/urllib3/connectionpool.py", line 387, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/srv/homeassistant/lib/python3.7/site-packages/urllib3/connectionpool.py", line 383, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.7/http/client.py", line 1321, in getresponse
    response.begin()
  File "/usr/lib/python3.7/http/client.py", line 296, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.7/http/client.py", line 257, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.7/socket.py", line 589, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/srv/homeassistant/lib/python3.7/site-packages/urllib3/connectionpool.py", line 641, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/srv/homeassistant/lib/python3.7/site-packages/urllib3/util/retry.py", line 368, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/srv/homeassistant/lib/python3.7/site-packages/urllib3/packages/six.py", line 686, in reraise
    raise value
  File "/srv/homeassistant/lib/python3.7/site-packages/urllib3/connectionpool.py", line 603, in urlopen
    chunked=chunked)
  File "/srv/homeassistant/lib/python3.7/site-packages/urllib3/connectionpool.py", line 389, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/srv/homeassistant/lib/python3.7/site-packages/urllib3/connectionpool.py", line 307, in _raise_timeout
    raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='dd.weatheroffice.ec.gc.ca', port=80): Read timed out. (read timeout=10)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 441, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/environment_canada/sensor.py", line 116, in update
    self.ec_data.update()
  File "/srv/homeassistant/lib/python3.7/site-packages/env_canada/ec_data.py", line 13, in res
    return fun(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/ratelimit/decorators.py", line 80, in wrapper
    return func(*args, **kargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/env_canada/ec_data.py", line 225, in update
    timeout=10)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests/adapters.py", line 529, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='dd.weatheroffice.ec.gc.ca', port=80): Read timed out. (read timeout=10)

I’m also seeing multiple messages saying:

2019-10-02 19:49:36 WARNING (MainThread) [homeassistant.components.sensor] Updating environment_canada sensor took longer than the scheduled update interval 00:10:100:```

For some reason, the forum isn’t letting me post the time interval from the log. It keeps changing it. That should say 10 minutes.

My config file for this sensor looks like this:

  - platform: environment_canada
    station: ON/s0000458

Are you using a custom component, or the latest version in build 0.99?

At one point, I did try replacing the files in hA with some newer ones from your Github, but that should have been over written by the updates shouldn’t it?
The dates on the environment canada files in HA are October 1, when I ran the latest update.

That might be part of the problem. I haven’t pushed anything new, so the files in the main Home Assistant fork are the right ones. Is it possible that you still have an old version in the custom_components folder? That would override the one from the main install.

Hi,
I don’t have any custom components folder in my HA home directory. I just uninstalled and reinstalled HA, so we’ll see what that does.

I have also issue with forecast not updating. Installed through HACS on Hassio 0.99.3. Current temperature and conditions are up to date.

Here is the log

Update for weather.kitchener_waterloo fails

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 421, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 416, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.7/http/client.py", line 1336, in getresponse
    response.begin()
  File "/usr/local/lib/python3.7/http/client.py", line 306, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.7/http/client.py", line 267, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.7/socket.py", line 589, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 400, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.7/site-packages/urllib3/packages/six.py", line 735, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
    chunked=chunked,
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 423, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 331, in _raise_timeout
    self, url, "Read timed out. (read timeout=%s)" % timeout_value
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='dd.weatheroffice.ec.gc.ca', port=80): Read timed out. (read timeout=10)

During handling of the above exception, another exception occurred:


Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 441, 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/src/homeassistant/homeassistant/components/environment_canada/weather.py", line 173, in update
    self.ec_data.update()
  File "/usr/local/lib/python3.7/site-packages/env_canada/ec_data.py", line 13, in res
    return fun(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/ratelimit/decorators.py", line 80, in wrapper
    return func(*args, **kargs)
  File "/usr/local/lib/python3.7/site-packages/env_canada/ec_data.py", line 225, in update
    timeout=10)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 529, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='dd.weatheroffice.ec.gc.ca', port=80): Read timed out. (read timeout=10)

I’m not familiar with Hassio or HACS, but it seems that HACS is for custom components. Why did you install it this way rather than use the version included with Home Assistant?

I should have noted. I use the animated version of the weather card. The reason I use the HACS is the update feature. Like TheFourDees, the forecast does not update regularly.
before: eg.Monday forecast is few days old compare to the Env.Canada widget.

after HA restart: forecast is correct

Sorry, I was confused. I patched this issue three weeks ago, but it has’t been pushed out yet. The fix should be in 0.100.

1 Like

I’ve started getting certificate verify failed errors for all three of the components. Is anyone else seeing this?

Yes, on 100.2, started last night, seeing max retries exceeded as well.

I reverted back to 0.99.2 and everything came back. I’ll see if I can figure out the cause.

I’m seeing the same error too.

Suddenly today the EV component is preventing HA from restarting.

I made some changes to a few yaml files this morning and restarted HA. HA did not come back up.
When I checked the log there was nearly 1200 entries. I reverted the changes I made but HA would not start when the HA Docker container was stop/started.

I started looking for something in the log and I noticed that Environment Canada elements were listed frequently. I commented out the weather: entry in my configuration.yaml and HA started up just fine.

I’m running HA .100.3 on Docker.

Edit:

I just tried to recreate the issue to grab the entries from the log file but HA restarted just fine. These were the only entry in the now much smaller log file on restart:

 File "/usr/src/homeassistant/homeassistant/components/environment_canada/weather.py", line 11, in <module>
    from env_canada import ECData
  File "/usr/local/lib/python3.7/site-packages/env_canada/__init__.py", line 2, in <module>
    from .ec_radar import *
  File "/usr/local/lib/python3.7/site-packages/env_canada/ec_radar.py", line 20, in <module>

There are no Environment Canada anything showing up in ‘States’ and the Weather radar camera reports “entity not available”

1 Like

Yes, it seems something changed with 0.100. I’ve reverted to 0.99 and it’s working, and I’ve pushed a fix for 0.101 which should be released tomorrow. Sorry for the trouble.

The weirdness is that everything was fine until today. Now I’ve only been running .100.3 for 4 days but why suddenly death?

Yes I had the same thing and threw me for a loop why did it just stop working?

This issue is tracking it. The root cause is that the tool I used to get the radar site coordinates from Wikipedia is unavailable. I’m working on a fix.

I see the issue has been resolved.
How do we get the new component? I actually don’t think I’ve ever thought about how components get installed, updated, or removed…