Only title are available through the data supplied by Environment Canada. The details are only available on a web page. Home Assistant integrations are not allowed to scrape web pages.
Understood. No problem.
fyi, as a workaround I rely on the work of
domo-quebec/msp at main ¡ domo-quebec/domo-quebec ¡ GitHub (RSS to JSON) to build a set of sensors which I then reuse in my dashboard:
I use a state switch and when there is no alert, I replace the scrolling notification with the standard EC summary, therefore my ask to have the untruncated version =)
Looking for feedback⌠Iâm looking at addressing the text summary being truncated.
I have prototyped adding a new action (service) called environment_canada.get_forecast
that would return all the data that the env_canada library returns for the daily forecast. One of the attributes in that data is the text_summary - not truncated!
Just like the weather.get_forecasts
action you would have to setup a template sensor to have the data in a sensor. This is described here: Weather - Home Assistant
Here is the response from the proposed new action call. Note that the first entry is what is used in the existing truncated sensor. I would also propose deprecating the existing sensor after a 6 month warning period.
This is all prototype at the moment and subject to change. It also subject to Home Assistant develop review.
weather.ottawa_kanata_orleans_forecast:
forecast:
- period: Tuesday
text_summary: >-
A mix of sun and cloud with 40 percent chance of flurries. Wind
northwest 20 km/h gusting to 40. High minus 13. Wind chill near minus
25. UV index 2 or low.
icon_code: "08"
temperature: -13
temperature_class: high
precip_probability: 40
timestamp: "2025-02-18T16:00:00+00:00"
- period: Tuesday night
text_summary: >-
Mainly cloudy. Wind west 20 km/h gusting to 40 becoming light after
midnight. Low minus 19. Wind chill minus 22 this evening and minus 28
overnight. Risk of frostbite.
icon_code: "33"
temperature: -19
temperature_class: low
precip_probability: 0
timestamp: "2025-02-18T16:00:00+00:00"
- period: Wednesday
text_summary: >-
A mix of sun and cloud. Wind up to 15 km/h. High minus 10. Wind chill
minus 28 in the morning and minus 17 in the afternoon. Risk of
frostbite. UV index 2 or low.
icon_code: "02"
temperature: -10
temperature_class: high
precip_probability: 0
timestamp: "2025-02-19T16:00:00+00:00"
- period: Wednesday night
text_summary: Cloudy periods. Low minus 14.
icon_code: "32"
temperature: -14
temperature_class: low
precip_probability: 0
timestamp: "2025-02-19T16:00:00+00:00"
- period: Thursday
text_summary: Cloudy with 40 percent chance of flurries. High minus 7.
icon_code: "16"
temperature: -7
temperature_class: high
precip_probability: 40
timestamp: "2025-02-20T16:00:00+00:00"
- period: Thursday night
text_summary: Cloudy. Low minus 14.
icon_code: "10"
temperature: -14
temperature_class: low
precip_probability: 0
timestamp: "2025-02-20T16:00:00+00:00"
- period: Friday
text_summary: Sunny. High minus 7.
icon_code: "00"
temperature: -7
temperature_class: high
precip_probability: 0
timestamp: "2025-02-21T16:00:00+00:00"
- period: Friday night
text_summary: Clear. Low minus 14.
icon_code: "30"
temperature: -14
temperature_class: low
precip_probability: 0
timestamp: "2025-02-21T16:00:00+00:00"
- period: Saturday
text_summary: A mix of sun and cloud. High minus 3.
icon_code: "02"
temperature: -3
temperature_class: high
precip_probability: 0
timestamp: "2025-02-22T16:00:00+00:00"
- period: Saturday night
text_summary: Cloudy periods. Low minus 9.
icon_code: "32"
temperature: -9
temperature_class: low
precip_probability: 0
timestamp: "2025-02-22T16:00:00+00:00"
- period: Sunday
text_summary: A mix of sun and cloud. High minus 2.
icon_code: "02"
temperature: -2
temperature_class: high
precip_probability: 0
timestamp: "2025-02-23T16:00:00+00:00"
- period: Sunday night
text_summary: Cloudy with 40 percent chance of flurries. Low minus 7.
icon_code: "16"
temperature: -7
temperature_class: low
precip_probability: 40
timestamp: "2025-02-23T16:00:00+00:00"
- period: Monday
text_summary: Cloudy with 60 percent chance of flurries. High minus 1.
icon_code: "16"
temperature: -1
temperature_class: high
precip_probability: 60
timestamp: "2025-02-24T16:00:00+00:00"
Will have to experiment on my end but sounds good to me. Watching.
Iâm all for this idea.
Alright. New for 2025.3 will be a new action environment_canada.get_forecasts
. It returns the following (for brevity I removed some of the daily and hourly forecasts):
weather.ottawa_kanata_orleans_forecast:
daily_forecast:
- period: Wednesday night
text_summary: >-
Increasing cloudiness early this evening. Wind west 20 km/h becoming
light early this evening. Low minus 17. Wind chill minus 16 this evening
and minus 23 overnight.
icon_code: "33"
temperature: -17
temperature_class: low
precip_probability: 0
timestamp: "2025-02-19T20:30:00+00:00"
- period: Thursday
text_summary: >-
Mainly cloudy. Periods of light snow beginning near noon. Wind up to 15
km/h. High minus 7. Wind chill minus 23 in the morning and minus 13 in
the afternoon. UV index 2 or low.
icon_code: "16"
temperature: -7
temperature_class: high
precip_probability: 0
timestamp: "2025-02-20T20:30:00+00:00"
hourly_forecast:
- condition: Partly cloudy
temperature: -12
icon_code: "32"
precip_probability: 20
wind_speed: 10
wind_direction: W
timestamp: "2025-02-19T23:00:00+00:00"
- condition: Mainly cloudy
temperature: -13
icon_code: "33"
precip_probability: 20
wind_speed: 10
wind_direction: W
timestamp: "2025-02-20T00:00:00+00:00"
If you would like to get the data into a sensor, the following sensor template does that (change to use your appropriate weather entity):
- 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
unique_id: weather_forecast_xyzzy
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') }}"
If you want to âreplicateâ the existing summary sensor without the truncation then only the summary
attribute is needed from the template above.
The only thing I havenât figured out how to do is to change the forecast to +22C and make the weather follow that. For another millennium!
Enjoy!
Try harder, us landscapers are counting on you!
Nice work, I look forward to giving this a go next Wednesday.
Sorry havenât been keeping up but does this mean the current Summary sensor wonât work with 2025.3? Iâm using a few different weather cards so hopefully they work with this new actionâŚ
At the moment there is no change to the current summary sensor. I do think that it is reasonable to deprecate it, with deprecation period (not sure about what the HA standard is, but 3 or 6 months would be reasonable).
But for now, nothing has changed. If the sensor werenât âbrokenâ Iâd just leave it alone.
I am freaking in love with the results from this action, I can finally get a full non-truncated forecast from a voice TTS automation⌠and so much more potential.
Plus it was making me cringe to see âPartlycloudyâ on my dashboard, âPartly cloudyâ reads so much better.
One thing I noticed is that wind_direction: "N"
has the direction in double quotes and other directions do not, is this intended?
I suspect bad data. Whatâs your station. Iâll peek to see what is going on.
Gotcha, ON/s0000367. Pulls data from the Burlington Lift Bridge.
I just looked through the data and the code. I donât see anything that would cause extra quotes.
The next time you see can you grab this file: https://dd.weather.gc.ca/citypage_weather/xml/ON/s0000367_e.xml. Thatâs the file that is updated with forecast info. We pull it every ~15 minutes or so and its what drives all the data you see in the integration.
You can either search through it yourself (look for âdirectionâ), or, you can post here or send to me.
Thanks for the pointer, Iâll check it when the wind forecast turns ânorthâ again. I thought it might have been an oversight in how the info was being passed, but if youâre just reorganising XML into an object then itâs likely ECâs oversight. I appreciate your taking the time with such a minor issue, keep up the good work.
Finally got the wind to blow from the north, unfortunately the EC data looks good but the environment_canada.get_forecasts
data has the quotes surrounding âNâ. I refreshed both to ensure that the data was current and that timestamps were equal.
From ECâs XML:
<hourlyForecast dateTimeUTC="202503120300">
<condition>Clear</condition>
<iconCode format="png">30</iconCode>
<temperature unitType="metric" units="C">0</temperature>
<lop category="Nil" units="%">0</lop>
<windChill unitType="metric"/>
<humidex unitType="metric"/>
<wind>
<speed unitType="metric" units="km/h">10</speed>
<direction windDirFull="North">N</direction>
<gust unitType="metric" units="km/h"/>
</wind>
</hourlyForecast>
From Dev Tools > Actions environment_canada.get_forecasts
object:
- condition: Clear
temperature: 0
icon_code: "30"
precip_probability: 0
wind_speed: 10
wind_direction: "N"
timestamp: "2025-03-12T03:00:00+00:00"
Looking nowâŚ
Appears everything in the code is good. It appears that N
gets quoted to avoid some kind of confusion with it be a type other than a string. I suspect that the code that converts a dictionary to json does this. Iâll look at that one day when I back into the code.
Understood and thanks for taking the time. Iâm good with it regardless, just something I noticed; I can strip out the quotes in jinja when needed anyways.
Thanks aain for the updated action to this integration, Neural Jenny sounds much better reading me the forecast :).