Support for Environment Canada platforms

I tried removing the entities via GUI and restarting,

image

The weather card is showing OK.
Very strange.

Here’s my configuration

....
sun:

weather:
  - platform: environment_canada
.....
sensor:

  # uses system-level lat-long coordinates to determine the closest station
  - platform: environment_canada

  - platform: season
    type: astronomical

...

I’m using HA on docker, in RPi4.

System Health
Version 	core-2021.10.2
Installation Type 	Home Assistant Container
Development 	false
Supervisor 	false
Docker 	true
User 	root
Virtual Environment 	false
Python Version 	3.9.7

The integration is loaded, I can see that in the info panel

Are there any errors in the logs when the system is starting?

I have had this same issue since the Environment Canada integration was released in core. I’ve looked into it a few times and have never been able to figure out what was going wrong.

If I only configured the sensor platform, I got the sensors and they worked fine. If I configured just the sensors, start HA, then add the weather entities and restart everything works until the next restart. Then boom - all the sensors are gone, but the weather entities were still present and working. I’ve tried setting it up with default location, with long/lat, and station and a mix of them. Deleting it all, restarting. and reconfiguring, always with the same reproducible results.

I’ve set the following logs and saw nothing, no errors. The EC sensor platform seems like it just isn’t set up for some reason.

homeassistant.components.environment_canada: debug
homeassistant.components.sensor: debug
homeassistant.components.weather: debug

Anyway, the good news is the 2021.11 beta has resolved the issue for me. I deleted the integration the reinstalled it with the new config flow. Works a treat. The prefix on the sensors is nice.

What is the difference between the “current” weather entity and the normal forecast? I haven’t had a chance to look at it closely yet. Also, the air quality index sensor is gone after the update. Other than that working great now.

No errors at all, the addon shows as loaded, but the entities did not get re-created when I removed them from the UI, I tried multiple restarts, removing the station ID, changing/checking the lat/long coordinates in the system etc.
I ended up removing the sensor component, and extracting datapoints I wanted from the weather component attributes. I’ll try the sensor again after the new GUI-based version gets merged

An update on what is going on with the integration. I’m glad that you are trying the beta and the UI config! We’ve had to split up the work to update the integration. Much of the work will land in 2021.11. Unfortunately, most likely because of Hacktoberfest, we could not get all the changes onto the .11 release, they will likely land in .12.

AQHI is one of those changes that is coming. The other thing coming with the sensors is, and beware, these changes have not been accepted by the HA team, so they may change:

  • The alerts will be an integer count of the number active. The attributes will be the text/time of the alert.
  • There is no timestamp attribute on the sensors any longer. There is an observation timestamp sensor which will make it easier for automations to know when the sensors have a new observation point.

The two open pull requests with these changes are: Add SensorEntityClass support for Environment Canada integration by gwww · Pull Request #58615 · home-assistant/core · GitHub and Use _attr_ and add radar_type service for Environment Canada by gwww · Pull Request #58657 · home-assistant/core · GitHub. The pull request for AQHI is not created yet and is waiting for the two PRs listed here.

@jazzyisj Your question, what is the difference between current entity and normal forecast… say more, what are you referring to when you say current entity?

2 Likes

I have weather template that is very similarly named to the way the EC integration names the entities now. It came up when I did a quick filter in devtools to check out the new sensors and like I said I hadn’t had time to look closely at it. So I just did. Ignore me…lol.

BTW I was able to add a second station with no issues with the new config flow.

Looking forward to the additional changes. :slight_smile:

I do have one comment about the alert sensors. One reason I still have Dark Sky installed is the additional alert description text and alert expiry time provided for Environment Canada alerts. Any chance this data can be added as attributes to the EC integration warning sensors?

I’ll leave that to @michaeldavie. He is focusing on the base library that interacts with Environment Canada while I’ve been focusing on the HA integration piece.

I would love to have the alert descriptions too. Unfortunately, I haven’t found a way to get this information without web scraping, which HA doesn’t allow. I’ll keep looking into it though, and see if I can come up with something.

1 Like

Now that 2021.11 has been released, @gwww and I have decided to close off this topic (after almost 2.5 years!) and start up a new one to mark the major update. Please join us at the link below to continue the discussion.