core: Environment Canada integration error ValueError: invalid literal for int() with base 10

The problem

The Environment Canada integration is not starting up and throwing an error. It started post upgrade to 2023.7 but I’m unsure if it is related to the specific condition data being returned by Environment Canada for the location I am requesting or a change in 2023.7.

Station is NS/s0000084 if that matters.

What version of Home Assistant Core has the issue?

core-2023.7.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Environment Canada

Link to integration documentation on our website

https://www.home-assistant.io/integrations/environment_canada/

Diagnostics information

config_entry-environment_canada-a4c609fd85f31419c09f8b836dac9d9f.json.txt

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Unexpected error fetching environment_canada weather data: invalid literal for int() with base 10: 'Calm'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/environment_canada/__init__.py", line 117, in _async_update_data
    await self.ec_data.update()
  File "/usr/local/lib/python3.11/site-packages/env_canada/ec_weather.py", line 485, in update
    "wind_speed": int(f.findtext("./wind/speed") or 0),
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'Calm'

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 5
  • Comments: 15 (3 by maintainers)

Most upvoted comments

The fix for this issue was included in release 2023.7.3

PR to resolve is open

I am now getting this same error. Weather station is the one for Vancouver s0000141. I suffered an outage that lasted almost twelve hours and when I was able to fetch data from this integration I started getting this error.

Logger: homeassistant.components.environment_canada Source: components/environment_canada/init.py:117 Integration: Environment Canada (documentation, issues) First occurred: 6:20:23 AM (94 occurrences) Last logged: 2:05:59 PM

Unexpected error fetching environment_canada weather data: invalid literal for int() with base 10: ‘Calm’ Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py”, line 283, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/usr/src/homeassistant/homeassistant/components/environment_canada/init.py”, line 117, in _async_update_data await self.ec_data.update() File “/usr/local/lib/python3.11/site-packages/env_canada/ec_weather.py”, line 485, in update “wind_speed”: int(f.findtext(“./wind/speed”) or 0), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: ‘Calm’

It is in fact working intermittently. It appears to be triggered by specific weather conditions.