According to home assistant configuration and supervisor my installation is fully up to date. However as this component has neither an add-on or an integration that show up in the web front end, I have no idea how to check what version number.
Hello. I noticed over the last couple days my Environment Canada weather card won’t load up.
Logger: homeassistant.components.weather
Source: components/environment_canada/weather.py:164
Integration: Weather (documentation, issues)
First occurred: 3:57:32 PM (2 occurrences)
Last logged: 3:57:32 PM
- Error adding entities for domain weather with platform environment_canada
- Error while setting up environment_canada platform for weather
Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 322, in async_add_entities await asyncio.gather(*tasks) File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 514, in _async_add_entity await entity.add_to_platform_finish() File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 547, in add_to_platform_finish self.async_write_ha_state() File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 310, in async_write_ha_state self._async_write_ha_state() File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 334, in _async_write_ha_state sstate = self.state File “/usr/src/homeassistant/homeassistant/components/weather/init.py”, line 206, in state return self.condition File “/usr/src/homeassistant/homeassistant/components/environment_canada/weather.py”, line 164, in condition elif self.ec_data.hourly_forecasts[0].get(“icon_code”): IndexError: list index out of range
Any ideas?
Garry
I’m rebuilding my HA setup from the ground up and I am having problems getting the Environment Canada Radar setup.
If I specify a station with:
- platform: environment_canada
station: CASFT
I get the following error:
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 205, in _async_setup_platform
await asyncio.shield(task)
File “/usr/local/lib/python3.8/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/src/homeassistant/homeassistant/components/environment_canada/camera.py”, line 42, in setup_platform
radar_object = ECRadar(
File “/usr/local/lib/python3.8/site-packages/env_canada/ec_radar.py”, line 102, in init
coordinates = get_station_coords(station_id)
File “/usr/local/lib/python3.8/site-packages/env_canada/ec_radar.py”, line 38, in get_station_coords
return site_dict[station_id][“lat”], site_dict[station_id][“lon”]
KeyError: ‘CASFT’
It doesn’t matter what station values I enter, it’s the same error except the KeyError changes to reflect the station I enter.
If I leave out the station line I get the Radar entry but either it times out with a warning in the log, or the card doesn’t display the image. The only way I seem to be able to get the Radar image to work (when there is no warning in the log) is to edit the Dashboard and then close the Dashboard.
I am runinng Home Assistant 2021.4.6 in docker.
It looks like the radar_sites.json file in the component hasn’t been updated with that new radar station code even though the old one is now decommissioned. If you can edit the JSON you can try just updating the station code.
Otherwise opening an issue on his GitHub repo to update the radar code and the HA wiki page would be a good idea.
I’m no longer supporting the station codes (or at least not updating the list or adding new ones), since the map is now dynamically generated for any arbitrary location. If you specify a latitude and longitude you should be all set; the default is to use the HA server settings if no location is specified.
Either of these should work fine:
camera:
- platform: environment_canada
camera:
- platform: environment_canada
latitude: 50
longitude: -100
Let me know if you have any trouble.
Wanted to share how I managed my radar cards to have rain vs snow. The default of Nov - Apr is less and less relevant given the weather extremes we have.
I used a conditional card to show rain vs snow, but conditional cards need a state, which I didn’t seem to have. So i created a binary sensor in my config.yaml to determine if i could expect rain or snow.
binary_sensor:
- platform: template
sensors:
freezing_point:
friendly_name: freezing_point
value_template: >-
{% set F0 = states('sensor.temperature') | int %}
{% set F1 = states('sensor.low_temperature') | int %}
{% set FP = (F0 + F0 + F1) /3 | int %}
{% if FP < 2 %} on
{% else %} off
{% endif %}
This weights the current temp a bit more than the low, since the radar only goes 3 hours in advance. I’m not sure how well it will work when we get closer to winter but we shall see.
Then i created a conditional card to use my binary sensor.
type: vertical-stack
title: EC Ottawa Weather Radar
cards:
- type: conditional
conditions:
- entity: binary_sensor.freezing_point
state: 'on'
card:
type: picture-entity
entity: camera.radar_snow
- type: conditional
conditions:
- entity: binary_sensor.freezing_point
state: 'off'
card:
type: picture-entity
entity: camera.radar_rain
I have been using this integration for a number of months and haven’t knowingly updated so I’m not sure if my radar reflects the new changes that have been made. I’m using this in my config:
camera:
- platform: environment_canada
station: XFT
precip_type: RAIN
name: radar-rain
- platform: environment_canada
station: XFT
precip_type: SNOW
name: radar-snow
Would anyone mind sharing how they went about using the “custom component”? I’m a bit stumped on this one.
Is it best to just fork the repo and copy the relevant files to a custom_components folder?
Sorry if this is way off base but I’m a little shaky on the software side of things.
I found a tool to download the folder as a ZIP file. If you copy the environment_canada
folder from the ZIP file into the custom_components
folder, you should be all set.
GitZip: GitZip
Github Folder: home-assistant/homeassistant/components/environment_canada at env_canada_0-3-0 · michaeldavie/home-assistant · GitHub
Let me know if you have any trouble.
Awesome! Thank you! I’ll give it a shot.
Logger: homeassistant.components.weather
Source: components/environment_canada/weather.py:164
Integration: Weather (documentation, issues)
First occurred: 8:27:07 AM (2 occurrences)
Last logged: 8:27:07 AM
Error adding entities for domain weather with platform environment_canada
Error while setting up environment_canada platform for weather
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 383, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 588, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 615, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 368, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 402, in _async_write_ha_state
state = self._stringify_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 374, in _stringify_state
state = self.state
File "/usr/src/homeassistant/homeassistant/components/weather/__init__.py", line 206, in state
return self.condition
File "/usr/src/homeassistant/homeassistant/components/environment_canada/weather.py", line 164, in condition
elif self.ec_data.hourly_forecasts[0].get("icon_code"):
IndexError: list index out of range
It seems like the hourly_forecasts
list was either missing or empty because attempting to get its zeroth item resulted in failure. Perhaps the weather location you are using didn’t have hourly forecast data at the time it was polled.
I’ve only ever used daily
…
weather:
- platform: environment_canada
name: richmond
station: BC/s0000862
forecast: daily
I’ve tried removing station:
, forecast:
, name:
and after 8 or so reboots, it loaded weather.richmond once but that was just a fluke. Two restarts after that with no changes and it resumed failing again. It’s been failing for a couple of months now…
@dbrunt This configuration works fine for me in 2021.7.3:
Can you provide some more info on your setup? I suspect that the dependencies may have gotten out of sync and a reinstall / upgrade may resolve it.
I wasn’t sure how to reinstall / upgrade so I just commented out the weather:
items in configuration & sensors.yaml and restarted HA. Then I re-enabled them, restarted HA and I am back in business…
weather:
- platform: environment_canada
name: Vancouver
station: BC/s0000141
# name: Richmond
# station: BC/s0000862
forecast: daily
scan_interval: 600
sensors:
# Environment Canada
- platform: environment_canada
# Richmond
# station: BC/s0000862
# Vancouver
station: BC/s0000141
Thanks!
Hello, Do you know how to format the text contained in the forecast sensor? I tried a Markdown, but it doesn’t work.
How do you want to format it?
First, I’d like to align the text to the left. And also better presented.
I don’t know why it appears right-justified in your example. I created the following simple Markdown card and the content is rendered left-justified and simply wraps to the next line.
Does your Markdown card’s Content field contain the same template or something different?
Thanks to you, It works now. It’s a bit ridiculous of me, I forgot to put an s in the word states Hen i use a Markdown card.
sensor.temperature doesn’t update consistently. Sometimes it stays stuck for hours, restarting HA makes it update for a while and then it happens again
weather:
- platform: environment_canada
sensor:
- platform: environment_canada
scan_interval: 600