Support for Environment Canada platforms

Hi ! I added the camera platform in the configuration.yaml so now I have a sensor “camera” in my entities. I’m wondering how can I add it on my UI. I don’t have a camera card when I want to add a card.

Hi, it looks like at 4:00am in the day of Friday the forecast was shifted by one day in the future…
Fresh updated weather sensor vs Env.Can. website:

Screenshot from 2020-09-04 04-07-18

custom weather card as well as lovelace one are showing the same result

Will see in the morning of friday if the forecast shift back

I use picture-entity card

aspect_ratio: 0%
entity: camera.environment_canada_radar
type: picture-entity

Is there any way to debug when receiving “unavailable” for sensor readings? Was working for about 10 hours after I implemented it but since then all the sensor data like uv_index has just read “unavailable”. The weather data seems fine but I cannot get what I want from it (uv_index and other values used in some min_max calculations)

Only thing I see in the log is this but that’s for the weather component and not sensor and the weather data is working despite the error.

2020-09-06 10:07:45 WARNING (MainThread) [homeassistant.components.weather] Setup of weather platform environment_canada is taking over 10 seconds.

Also, I checked the Environment Canada service itself and it seems to be returning data (if I’m looking at the correct source), for example: https://dd.weather.gc.ca/citypage_weather/xml/BC/s0000547_e.xml

So not sure where the chain is broken.

Since I mostly need the UV Index right now (though I want some other data in the future) I used the Scrape platform to get the data directly myself. Total workaround but it suffices for now. Looking forward figuring the root of the “unavailable” issue though.

(replace <provinceCode> and <site code> with the appropriate values from here: https://dd.weather.gc.ca/citypage_weather/xml/siteList.xml

  - platform: scrape
    name: environment_canada_max_uv_scraped
    resource: https://dd.weather.gc.ca/citypage_weather/xml/<province>/<site code>.xml
    select: "uv > index"

My sensors are returning unknown when there is no value, I suspect that unavailable might happen when the sensor is failed somehow. Unfortunately, I’m not sure what could cause this.

Is there a way to enable extra logging to help track down root cause? Happy to do some digging if I know where to look.

Does it happen to all of the sensor devices at once? I’ve sometimes seen failures on startup, but it seems weird to me that a sensor could drop to unavailable once it’s been setup.

All sensors at once. Tried removing it from the config, rebooting, re-adding, rebooting but they’re still all unavailable. I suppose it’s possible something else in the config is interfering but I can’t imagine what. No errors when config checked or on start-up and all other devices function as expected.

Found it. It’s this configuration section that breaks the sensors. If I have both the environment_canada platforms (I use one for hourly and one for daily weather reports) it breaks all the sensors. If I remove one or the other the sensors work.

Do I have the syntax wrong? Am I breaking a rule?

weather:
  - platform: environment_canada
    name: environment_canada_hourly
    forecast: hourly

  - platform: environment_canada
    name: environment_canada_daily  
    forecast: daily

FYI both those weather entities work as expected. I can display both hourly and daily reports on my dashboard with no issues. It’s just the sensors that break.

@michaeldavie any suggestions on how to trace down the cause? Or am I using it wrong or are two instances not supported?

Sorry, I haven’t had time to look at this. You’re not using it wrong; to me the platforms should be independent from each other so I’m not sure why having two copies of the weather one would break the sensors. I’ll try to take a look at this use case once 0.115 comes out tomorrow.

1 Like

Thanks for taking the time :slight_smile:

@bverkron Unfortunately what you have found is not the only issue.

As previously stated, I do not have multiple weather platforms, I only have one, yet I’m experiencing exactly the same issue.

As nobody has yet acknowledged this failure mode, I opened bug 39597 for those affected by this bug but without multiple weather platforms instances.

Thanks, but I think these are two separate issues:

  1. Sensors stop updating after a period of time; and
  2. Sensors cannot be setup at all if two weather components are in place.

Have I got that right?

1 Like

Seems correct to me, two separate issues.

Submitted a GitHub issue so it can be properly tracked and worked on. https://github.com/home-assistant/core/issues/40084 Let me know there if there’s any further information I can provide or testing I can do :smiley:

Did anyone develop some YAML code to be able to display an icon of the current weather conditions that correspond to sensor.icon_code ? Can you please share?

Looks like Environment Canada platform is broken in 0.115? It was working fine on 0.114.4 until I updated to 0.115.1, HA does not start unless it is commented out. error:

Platform error camera.environment_canada - Requirements for environment_canada not found: [‘env_canada==0.2.0’]