Environment Canada

The Environment Canada integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] provides meteorological data for Canadian locations from Environment and Climate Change Canada.

Configuration

To add the Environment Canada integration to your Home Assistant instance, use this My button:

Manual configuration steps

If the above My button doesn’t work, you can also perform the following steps manually:

  • Browse to your Home Assistant instance.

  • Go to Settings > Devices & Services.

  • In the bottom right corner, select the Add Integration button.

  • From the list, select Environment Canada.

  • Follow the instructions on screen to complete the setup.

Location selection

The integration can automatically select the closest weather station for a specified latitude and longitude. By default, the coordinates configured for Home Assistant are used.

You can also choose a specific weather station by providing a station code of the form s0000123 or simply 123, based on those listed in this CSV file.

Entities

The integration will create the entities listed below.

Weather

  • Current conditions, daily forecast, and hourly forecast

Radar map (Camera)

  • Loop of radar imagery from the last 3 hours.
  • This entity is disabled by default can be enabled in the entry’s settings dialog.
  • By default, this entity uses the radar rain layer from 1 April to 30 November and the snow layer from 1 December to 31 March. The rain/snow layer can be changed using the action described below.

Sensors

Conditions and forecasts

  • Current condition
  • Forecast summary
  • Icon code of current condition
  • Barometric pressure
  • Pressure tendency
  • Humidity
  • Visibility
  • UV index
  • Air quality health index (AQHI)

Temperature

  • Temperature
  • Forecast high temperature
  • Forecast low temperature
  • Dewpoint
  • Wind chill (only at temperatures below 0ºC)
  • Humidex (only at temperatures above 19ºC)

Wind

  • Wind speed
  • Wind gust
  • Wind direction
  • Wind bearing

Precipitation

  • Probability of precipitation

Alerts

  • Warnings
  • Watches
  • Advisories
  • Statements
  • Endings

The alert sensors use the number of current alerts as their state, with an attribute containing the title of each alert.

Solving problems

The Environment Canada service is very stable and provides high-quality data. Here are some steps that you can take before opening a problem report or posting on the forum.

Service interruptions

Although infrequent, there have been some outages and instabilities of the Environment Canada service. If you see error messages in your logs similar to the one below, it is very unlikely to be a problem with this integration and is likely a problem with the Environment Canada service.

2022-10-05 12:25:08.619 ERROR (MainThread) [homeassistant.components.environment_canada] Timeout fetching environment_canada weather data

The first course of action should be to check if there are known problems with the service. Look for recent messages on the Environment Canada mailing list (example message). The next course of action is to post on the forum. The answers are usually already known by someone.

Sensor unavailable or unknown

Not all weather stations provide a complete set of weather/sensor data. The data that is retrieved by this integration can be found here. Browsing the XML data for your station will help you to understand what data is (un)available.

Template sensors

The configuration snippets below add template sensors. See the weather integration for additional examples.

Replace NAME with the weather entity used in your configuration.

Feels Like

A sensor that takes into account the humidex or wind chill for what the temperature feels like.

template:
  - sensor:
    - name: "Feels Like"
      device_class: temperature
      unit_of_measurement: "°C"
      state: >
        {% if not is_state('sensor.NAME_humidex', 'unknown') %}
          {{ states('sensor.NAME_humidex') }}
        {% elif not is_state('sensor.NAME_wind_chill', 'unknown') %}
          {{ states('sensor.NAME_wind_chill') }}
        {% else %}
          {{ states('sensor.NAME_temperature') | round(0) }}
        {% endif %}

Additional Forecast Data

The configuration snippet below adds a template sensor containing the current forecast information as attributes and the text summary of the forecast for the current day.

- trigger:
    - platform: time_pattern
      hours: "/4"
    - platform: homeassistant
      event: start
    - platform: event
      event_type: event_template_reloaded
  action:
    - service: environment_canada.get_forecasts
      target:
        entity_id: weather.NAME
      response_variable: forecasts
  sensor:
    - name: Weather Forecast Daily
      unique_id: weather_forecast_daily
      state: "{{ states('weather.NAME') }}"
      attributes:
        daily: "{{ forecasts['weather.NAME']['daily_forecast'] }}"
        hourly: "{{ forecasts['weather.NAME']['hourly_forecast'] }}"
        summary: "{{ forecasts['weather.NAME']['daily_forecast'][0]['text_summary'] }}"
        temperature_unit: "{{ state_attr('weather.NAME', 'temperature_unit') }}"

Actions

Action environment_canada.get_forecasts

Get the raw forecast data from Environment Canada. Returns both the daily_forecast and the hourly_forecast data.

Data attribute Optional Description
entity_id yes Weather entity to get forecast for.

Action environment_canada.set_radar_type

Sets the type of radar to retrieve for the camera.

Data attribute Optional Description
entity_id yes Camera to set the radar type for.
radar_type no One of “Auto”, “Rain”, or “Snow”.