core icon indicating copy to clipboard operation
core copied to clipboard

Unable to setup Environment Canada integration

Open Jarboer opened this issue 1 year ago • 2 comments

The problem

I've been trying to set up the Environment Canada integration for my city but I'm unable to because I get a Cannot Connect error. I've tried giving no weather station id, giving one, removing the long and lat, etc. but no combination works for me. I entered the station id in all possible ways I can think of but as far as I'm aware this is the correct format for my location ON/s0000XXX where XXX is the 3 numbers for my location.

I feel like the error is implying that it's a connection issue but I have the integration working on another system, except now I can't add a new location to that system. The system that works is a VM on TrueNAS, and I tried setting up another VM on it but I can't add the integration to the new VM, and I also tried adding it on a new install of HAOS on an Intel system (non VM) but that doesn't work either.

I'm at a loss as to why I can't add the integration anymore, and I don't know what else to try because I can't get any logs when setting up the integration. I'm also experiencing an issue with the Environment Canada integration that is set up showing unavailable most of the time so maybe it's an issue with my internet (I'm going to do a separate issue report for this since trying to set up the integration on a new install of HA was part of my troubleshooting steps). But I don't know what the cause of that would be since connecting to the API works on my computer and I can do a curl with TrueNAS and get data when it wasn't working in Home Assistant.

What version of Home Assistant Core has the issue?

2023.5.4

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

Can't access the option to generate diagnostics

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Doesn't generate logs

Additional information

No response

Jarboer avatar Jun 05 '23 15:06 Jarboer

Hey there @gwww, @michaeldavie, mind taking a look at this issue as it has been labeled with an integration (environment_canada) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of environment_canada can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign environment_canada Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


environment_canada documentation environment_canada source (message by IssueLinks)

home-assistant[bot] avatar Jun 05 '23 15:06 home-assistant[bot]

Here's an image of what happens when setting up the integration: Link

Jarboer avatar Jun 05 '23 15:06 Jarboer

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

This is still an issue, could @gwww and/or @michaeldavie please look into this or give me some advice on what I could try to fix it? Thanks

Jarboer avatar Sep 04 '23 17:09 Jarboer

Do other integrations (particularly other weather ones) work correctly? I would recommend trying the different configuration options, but if none of them are working it seems to suggest a problem outside of the integration.

michaeldavie avatar Sep 04 '23 19:09 michaeldavie

Yes other weather integrations work, I installed pirate weather and it has no issues.

What other configuration options do you mean?

One thing I did discover while trying to get it working again was the configuration seems to only work at certain times, I think it must have issues connecting to the API/server because it only gets the weather information at certain times (then forgets it minutes later) and same with the configuration completing successfully.

I really don't get why the integration isn't working for me and some other users. Like I mentioned I tried setting up the integration on a fresh install of HA but it still would experience the same issues. Perhaps it's something to do with my location, ISP, DNS (I use cloudflare on my router), network configuration, etc. which would be really difficult to figure out especially since other traffic works just fine including a different weather integration like mentioned.

Jarboer avatar Sep 26 '23 00:09 Jarboer

Please ignore my mention above; I tagged this issue by mistake.

michaeldavie avatar Oct 05 '23 03:10 michaeldavie

Is there anything shown in the logs?

michaeldavie avatar Oct 12 '23 02:10 michaeldavie

@michaeldavie I also am having issues with this integration. I was working fine previously but somewhere in the most recent updates it stopped working (I am sorry I don't know which one).

In checking the logs I get this error:

Logger: homeassistant.components.environment_canada
Source: components/environment_canada/__init__.py:116
Integration: Environment Canada (documentation, issues)
First occurred: 3:05:21 AM (205 occurrences)
Last logged: 8:05:37 PM

Unexpected error fetching environment_canada weather data: Weather update failed; no timestamp found
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 290, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/environment_canada/__init__.py", line 116, in _async_update_data
    await self.ec_data.update()
  File "/usr/local/lib/python3.11/site-packages/env_canada/ec_weather.py", line 378, in update
    raise ECWeatherUpdateFailed("Weather update failed; no timestamp found")
env_canada.ec_weather.ECWeatherUpdateFailed: Weather update failed; no timestamp found

This error usually repeats itself throughout the log multiple times but I don't see any other errors. I turned on debugging and it gave a bit more information:

2023-10-18 20:10:37.394 DEBUG (MainThread) [homeassistant.components.environment_canada] Finished fetching environment_canada weather data in 0.114 seconds (success: False)
2023-10-18 20:15:35.096 DEBUG (MainThread) [env_canada.ec_aqhi] update(): aqhi_current 2 timestamp 2023-10-18 23:00:00+00:00
2023-10-18 20:15:35.211 DEBUG (MainThread) [homeassistant.components.environment_canada] Finished fetching environment_canada AQHI data in 0.215 seconds (success: True)
2023-10-18 20:15:37.280 DEBUG (MainThread) [env_canada.ec_weather] update(): station ON/s0000108 lat 44.500000 lon -80.240000
2023-10-18 20:15:37.387 ERROR (MainThread) [homeassistant.components.environment_canada] Unexpected error fetching environment_canada weather data: Weather update failed; no timestamp found
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 290, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/environment_canada/__init__.py", line 116, in _async_update_data
    await self.ec_data.update()
  File "/usr/local/lib/python3.11/site-packages/env_canada/ec_weather.py", line 378, in update
    raise ECWeatherUpdateFailed("Weather update failed; no timestamp found")
env_canada.ec_weather.ECWeatherUpdateFailed: Weather update failed; no timestamp found
2023-10-18 20:15:37.390 DEBUG (MainThread) [homeassistant.components.environment_canada] Finished fetching environment_canada weather data in 0.110 seconds (success: False)

Not sure if this is the same as @Jarboer error but hopefully this helps.

Sell24 avatar Oct 19 '23 00:10 Sell24

Hmmm, I just added ON/s0000108 and it updated with no issue. I'll leave it up and see if the problem recurs.

michaeldavie avatar Oct 19 '23 00:10 michaeldavie

I deleted the integration and rebooted HA. I tried to set it up again but whether I use the coordinates or the weather ID it gives me an "Unexpected Error". Maybe this is what the OP was taking about. Not sure what to do now...

Sell24 avatar Oct 19 '23 01:10 Sell24

Which version of HA are you running?

michaeldavie avatar Oct 19 '23 12:10 michaeldavie

Sorry should have mentioned that in the original post. I am running 2023.9.3. I usually like to wait until the end of the month to install the latest version, so that any critical bugs can be fixed.

Sell24 avatar Oct 19 '23 12:10 Sell24

Please try 2023.10.2 or later, as I made some changes in that version that may address this.

michaeldavie avatar Oct 19 '23 12:10 michaeldavie

Hi, just wanted to let you know that upgrading to 2023.10.3 worked. Thanks for the prompt replies and all your help.

Sell24 avatar Oct 19 '23 13:10 Sell24

@home-assistant close

michaeldavie avatar Oct 21 '23 03:10 michaeldavie