Update environment_canada.markdown (#37541)

This commit is contained in:
Glenn Waters 2025-02-19 16:09:19 -05:00 committed by GitHub
parent 815c7085cf
commit 4c33a1bacf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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.