From 4c33a1bacf2ad0a576783b18c666439458f7af85 Mon Sep 17 00:00:00 2001 From: Glenn Waters Date: Wed, 19 Feb 2025 16:09:19 -0500 Subject: [PATCH] Update environment_canada.markdown (#37541) --- .../_integrations/environment_canada.markdown | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/source/_integrations/environment_canada.markdown b/source/_integrations/environment_canada.markdown index bd450f2e51e..906692d07e8 100644 --- a/source/_integrations/environment_canada.markdown +++ b/source/_integrations/environment_canada.markdown @@ -132,9 +132,46 @@ template: {% endraw %} +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. + +{% raw %} + +```yaml +- 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.ottawa_kanata_orleans_forecast + response_variable: forecasts + sensor: + - name: Weather Forecast Daily + unique_id: weather_forecast_daily + state: "{{ states('weather.ottawa_kanata_orleans_forecast') }}" + attributes: + daily: "{{ forecasts['weather.ottawa_kanata_orleans_forecast']['daily_forecast'] }}" + hourly: "{{ forecasts['weather.ottawa_kanata_orleans_forecast']['hourly_forecast'] }}" + summary: "{{ forecasts['weather.ottawa_kanata_orleans_forecast']['daily_forecast'][0]['text_summary'] }}" + temperature_unit: "{{ state_attr('weather.ottawa_kanata_orleans_forecast', 'temperature_unit') }}" +``` + +{% endraw %} ## 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.