Environment Canada integration - 2021.11 onwards

The release of 2021.11 includes a major update to the Environment Canada integration, made possible by the generous support of @gwww. As the previous support thread was getting quite long, we thought it would be best to start a new one. Below is a summary of the changes.

Installation

  • Remove any references to environment_canada from your configuration YAML files, including the weather, sensor, and camera components.
  • Remove any versions manually installed in the custom_components directory.
  • Configure the integration via the GUI at Configuration ā†’ Integrations ā†’ + Add Integration

Improvements

  • Support for config flow, i.e. configuration via the Home Assistant GUI
  • Asynchronous updates
  • Shared data coordinator to pull data for weather and sensor entities

Known Issues

Future Work

Thanks for making use of this integration, and please use this topic if you have any questions or suggestions.

9 Likes

Sadly, although I keep getting reminded of this new capability, any attempt to configure the autodiscovered Environment Canada simply results in an ā€œAbortedā€ message. Maybe I need to edit out the entries in my current config.yaml, but I see not indication of that in the existing doc.

Thanks so much its been a long road! I am sure all the Canadian hass enthusiasts are really happy at how far this integration has come and I look forward to it telling me I have a blizzard on the way lol.

That being said with the new integration flow how can I stop this integration from pulling in an extra weather station that is in my area that I dont want?

I have always designated the station using the weather station code and this worked well for me but for some reason the integration also pulls in now where it didnā€™t before another unmanned less usefull weather station in my area that is not required. Iā€™m guessing because of hassos lat and long? I tried to designate the lat and long in my weather config for this integration but it keeps bringing the extra station that I dont want?

still a great integration though!

Double check your configuration.yaml file for any leftover weather or sensor entities (that used the Environment Canada platform).

I had removed a weather entity but overlooked to remove a sensor entity and so the new Environment Canada integration kept creating a second instance.

Sorry, we did a cutover from the old documentation to the new, without anything on transition. As @123 suggested, make sure to remove the environment_canada entries from your configuration.yaml file.

You should be able to specify the station by ID in the same way using the GUI. The lat/lon are auto-filled, but should be ignored if a station ID is specified. You should also be able to remove the lat/lon values if a station ID is specified.

A patch has been accepted into 2021.11.1 that should fix EC showing up as Discovered.

I no longer see two discovery entries, but it is still going into discovery mode every time I restart the server.

I click configure, then submit, I get the aborted dialog then the correct weather station shows as configured. 2021.11.1

I went through and removed references to sensor.air_quality_health_index which was removed in this version and I was using, still seeing this discovery issue on startup.

Update, I finally fixed this and found that I had environtment_canada in 3 seperate yaml files AND one dead entity to clean up in the GUI.

  1. In HA GUI go into entities and delete. sensor.air_quality_health_index it will likely show as broken.
  2. Remove the environtment_canada weather platform from configuration.yaml
  3. Remove the environtment_canada camera entry from camera.yaml if you were using the weather map on the old version
  4. remove the environtment_canada sensor from sensors.yaml if you where using the sensor.

So a total of 4 places to remove the old references assuming your yaml is broken up similar to mine.

1 Like

So Iā€™ve had intermittent issues in the past with the old integration - where some days it would just fail to connect to the EnvCanada servers (but then sometimes work).

I removed all entries in my config, rebooted HA and removed all of the old entities.
When adding the new integration in (specifying my weather station (MB/s0000193), rather than going by coordinates), I initially got the error ā€œfailed to connectā€ but hitting submit again worked (but I have been unable to replicate this).
Deleting the integration, rebooting, and trying again gives me a new error: ā€œunknown error has occurredā€ then ā€œabortedā€ if I click submit again; no errors noted in the log when this happens. I tried a different city, which did not work either.

This is the error on the configuration page from earlier when it did ā€œinstallā€

Retrying setup: Cannot connect to host geo.weather.gc.ca:443 ssl:default [Try again]

And the entry in the log:

2021-11-10 02:43:36 WARNING (MainThread) [homeassistant.config_entries] Config entry ā€˜Winnipegā€™ for environment_canada integration not ready yet: Cannot connect to host dd.weather.gc.ca:443 ssl:default [Try again]; Retrying in background

2021-11-10 02:54:45 WARNING (MainThread) [homeassistant.config_entries] Config entry ā€˜Winnipegā€™ for environment_canada integration not ready yet: Cannot connect to host geo.weather.gc.ca:443 ssl:default [Connect call failed (ā€˜205.189.10.51ā€™, 443)]; Retrying in background

I have rebooted the docker container several times, resulting in the same error.
Navigating to both https://dd.weather.gc.ca & https://geo.weather.gc.ca both work in my browser (205.189.10.51:443 points to https://api.weather.gc.ca, which also works)

I can only imagine that HA really cannot connect to EC. The code to connect is failing, which is not something that can be debugged beyond what the error message is.

Do you have stable internet? Is your DNS server responding? Since it is intermittent (if I understand correctly) that would suggest that a firewall is not blocking. I canā€™t think of any cause within the code for this to happen.

EC has been known to be flaky in the past, but that usually clears up in under an hour.

Iā€™ve had issues trying to set this up as well.
When selecting the integration from the GUI I get ā€œError: Config flow could not be loadedā€

Is there anything in the logs? Are you running the 2021.11.1 or higher release? The .0 release had a bug importing.

Nothing Iā€™m seeing in the logs.
I was running 2021.11.1 but just updated to 11.2 this morning.

I JUST figured it out though. At some point in time, the latest version was only available on github. So I had cloned the github repo into my custom_components folder and had been using that for a while. Removing that folder and rebooting let the config flow go through and everything is good now.

1 Like

Thanks for all the replies; Iā€™ve updated the initial post with installation instructions that should cover the issues encountered.

Thanks for your work on this!
Itā€™s terribly smokey here today and Iā€™d love to see the AQHI sensor re-added. How quickly we start to rely on some of these simple things to control our homes! Had to manually adjust my air-exchangerā€¦ :blush:

I suggest creating a bug. Make sure that it is tagged with the Environment Canada integration. No guarantees but Iā€™ll see if we can get it into a patch release. If not I will try to get into next monthly release. @michaeldavie and I will be notified when you create the bug report.

** Pull requests are R E A L L Y slow at the moment. No idea why. Patches are usually faster, so fingers crossed.

In the meantime I could probably whip up a custom component for just the AQHI sensor.

Thanks for the great work guys. I was getting 2 or 3 auto discovers, as I still had the manual config file going. Went through the update process at the beginning of this thread and rebooted, good to go!

Though I still have an air quality health index sensor, iā€™m not sure where this is coming from or if its just a place holder in the new version for when it eventually worksā€¦

1 Like

Hi, thanks for your work on this integration! Since the big update my radar is brokenā€¦ Iā€™ve followed @drewHA doc here: Support for Environment Canada platforms - #301 by drewHA

But I always have two new discovered entities, my guess is both camera snow and rainā€¦ So this has stopped workingā€¦ Is there anyway to make this work again or what would be the best way to do it now ?

Thanks, have a great day!

Iā€™ll keep this response simple for now since there is some investigation/discussion on radar support with Environment Canada. The integration is querying their ā€œdatabaseā€ too often. I would suspect calls are being rate limited. The path forward is being looked at and I donā€™t know when, if ever, this will be stable. As we learn more we can update this thread.