Reviewers needed: Environment Canada component with weather, sensor, and camera (radar) platforms

That actually sounds promising. If you check your entities list, you should see the camera and weather entities named for your location. If you update your configuration to look for those, you should be all set.

I’ve got a new version ready for testing! This one has moved the functionality of interacting with Environment Canada resources to a separate library (, which makes the component code simpler. It also solves the problem of the weather component depending on the sensor one.

A couple other changes / fixes:

  • Support for multiple warnings / alerts - They’re concatenated into a single string, whereas previously only one would show up. I might still break each alert into its own sensor.
  • Support for selecting rain or snow radar images - The default is rain from April to October, and snow otherwise. You can override this using precip_type: RAIN or precip_type: SNOW in the camera configuration.

Here’s how to install it:

  • Install the env_canada library as follows:
    – For Docker: docker exec [container name] pip install env_canada==0.0.3 --target /config/deps/lib/python3.6/site-packages
    – Otherwise: pip install env_canada==0.0.3 --target [config folder]/deps/lib/python3.6/site-packages
  • Place the folders and files from the zip file below in the [config folder]/custom_components folder

The configurations above remain valid, though I’ll make a couple tweaks there too.

Thanks again for your help, and let me know if you have any questions, problems, or suggestions. Thanks!

Just installed your new version and it’s working well.

Note for Docker users, restart your container… :slight_smile:

1 Like

Thanks @michaeldavie for building this. I’ve installed your component and looks to be working good. I’m located in Northern ON and using in a Docker container as well.

1 Like

Hi. I’ve been using it for the past couple days as well, and would like to say thanks!

How do you typically expect the radar to be used, though? I find that I need to go and update it manually, but maybe that’s just me as I haven’t really had any cameras in HA, yet.

That’s odd, it should update on its own. The default behaviour is to pull the last 12 static images and to build an animated GIF out of them. Are you seeing something different?

Yeah, it definitely gets the images on start and makes the animated GIF, but it currently only updates when I call homeassistant.update_entity { “entity_id”: “” }

It will only update once every 10 minutes, since that’s how often new radar images are published. If you’re leaving the UI open you may need to refresh the page, but that should do it. Let me know if that helps.

Hm. No. Currently still displaying the radar from when I updated it manually an hour ago, and no page refreshes change that. I’ll add some logging tomorrow and determine if I can figure something out for more information than this.

I’m seeing the same thing here. I have the radar loop of the ‘storm’ from 1850 - 2040 UTC2019-02-20.
No amount of refreshing the page will change it.

From a previous attempt of showing the weather radar in HA, I have from the same radar station the most current image (static image) and it is the 1450 UTC 2019-02-21 one and it updates on a page refresh.

Update, now the weather radar is updating

Question about functionality, I noticed that in your screenshot there is a windchill badge, I don’t have a badge but we also don’t have a windchill today.
So question is, for the items warning, humidex, windchill. and chance of precip, will the only appear if there is a value assigned to them?

Yes, exactly. If there’s no value present for a given sensor its hidden flag is set to true. If you’d like them to show up anyway, you should be able to override this flag in your customize.yaml.

I’m seeing this updating issue too, for both the radar and the sensors. It must be an issue with the latest version; I’ll look into it.

Okay, I think I’ve fixed the update issues for both the sensors and the radar. I’ve also switched to the new, simpler file structure that was adopted in 0.87, so the files will now be grouped in custom_components/environment_canada and named according to their parent component. There’s no change to the env_canada library.

Thanks to everyone for your help!

No I like this feature. I’d actually like to have a larger card show up for Statements, watches, and Warnings

I fixed another bug: sensor values were not being reset to None when they disappeared from the data, e.g. when there was a wind chill value at one point, but there was no value later on. This required a change to the env_canada library, which has been bumped to 0.0.4.

To update your installation:

  • Install the updated env_canada library:

    • For Docker: docker exec [container name] pip install env_canada==0.0.4 --target /config/deps/lib/python3.6/site-packages --upgrade

    • Otherwise: pip install env_canada==0.0.4 --target [config folder]/deps/lib/python3.6/site-packages --upgrade

  • Place the files from the link below in a folder at [config folder]/custom_components/environment_canada/

Thanks for the great work on this platform @michaeldavie . Hopefully your PR can get reviewed soon and merged into HA. I have been running the weather platform as a custom component and it has been working without error so far. The only thing I have noticed is that the icons are not correct for the forecast, and the highs/lows seem to be off by one.

In the attached screenshots, notice the Wed and Fri icons are night time icons. Also notice that the day’s low temperature is coming from the previous day’s night value. Is this expected behaviour?

Is there a way to strip specific details from the alerts for the sensor.ec_warning?

I’ve been attempting to have a conditional card appear when the sensor.ec_warning is triggered.
Unfortunately there are so many permutations of warnings that the task is nearly impossible. I didn’t even look in to watches.

I’d love to have just Special Weather Statement, Watch, and Warning appear, then have a conditional card populate with a weblink to the Environment Canada warning page for my location.

Unless there is another way to to trigger a conditional card with the current sensor output.

@davidbb - No, that’s definitely a bug. Thanks for the screen capture, it’ll help with troubleshooting.
Update: I think this error may have been caused by the “abnormal temperature trend”, which didn’t work with the (poor) test I was using. I’ve fixed this, and updated the file at the Dropbox link above.

@rlongfield - I haven’t switched over to Lovelace yet, so I’m not too sure about the conditional cards.

I’m also not sure how best to handle the alerts. Concatenating the titles together in the state of a single sensor is a so-so workaround, but I think I’d prefer to break them out. However, it doesn’t seem like I can create sensors on the fly. One thought I had was to create 3 placeholder sensors to handle alerts, and to assign states to them (and unhide them) as needed. What do you think?