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

On the host, my config folder is located at ~/home-assistant. In the container, this is mapped to /config, i.e. it’s right off the root of the container file system. This folder is where the custom_components subfolder should be, and there isn’t a config subfolder below this.

It doesn’t matter where the sensor file is on the host (or what it’s called), but it needs to be mapped into /usr/src/app/homeassistant/components/sensor/environment_canada.py in the container, because the weather component relies on it being there.

I realize that this is a bit clunky, and I have a plan of how to address it, but haven’t been able to yet. Let me know if you’re still stuck.

Sorry I’m about 90% there on fully understanding this and it’s driving me in circles,

So you have ~/home-assistant/custom_components?

As long as it works I don’t mind the clunky :slight_smile: I just want to get it working…

That’s right, I have
~/home-assistant/custom_components/weather/environment_canada.py

So I used portainer and added the bind for the volume:

/home/bert/hassio/ec_sensor.py to /components/sensor/environment_canada.py

So in HA I now have a Weather Alerts card but I am also getting:

Entity not found: camera.franktown_radar
No state available for weather.weather

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 (https://github.com/michaeldavie/env_canada), 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”: “camera.name” }

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

@michaeldavie
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