What's the Weather? Local Home Assistant Voice
Continuing my escape from Amazon-powered voice with local weather forecasts using Home Assistant automations and templates.
As part of my Home Assistant Local Voice crusade, I have to replace the features of Alexa with my own Home Assistant version. By frequency, the most common question we ask is "What's the weather?" or even "Ask Big Sky for the weather," since this app has a lot more weather details.
By default, if you ask Home Assistant for the weather, it will tell you "It's 84 degrees and sunny."
Not good enough. Here's the Big Sky version I'm used to with my mega-corp human-soul-crushing voice assistant:
"It's currently 84 degrees. Today's high will be 88 degrees at 3PM. Today's low was 69. Humidity is 88%. No rain is expected. Winds are from the North-Northwest at 3 miles per hour, with gusts up to 10 miles per hour. Sunrise was at 6:33AM, and Sunset will be at 8:03PM."
I'll admit, I don't need ALL of that, but I like knowing it. How do I replicate that with Home Assistant? Let's find out!
The Weather Integration
I'm using Tomorrow.io inside Home Assistant to expose a weather entity and the forecast data.
I have daily data, as well as some hourly details.

The problem is that this sort of forecast is not exposed to Home Assistant in the voice pipeline.
The Helper Setup
I have created a few input helpers and an automation to update those helpers periodically. We'll use these helper values in our voice request later.

input_number.today_forecast_high
input_number.today_forecast_low
input_number.today_forecast_precipitation
I created each of these self-explanatory helper entities manually in the Home Assistant GUI under "Helpers".
I went into the developer tools to get the state of the weather forecast to see what data was really available to me.

This looks pretty close to all of the data I was getting before. I could get sunrise and sunset from some other entities - but I really don't want those when I ask about the weather. I could ask for them separately.
The Automation Polling the Forecast
Now, I'll just have Home Assistant take the forecast numbers and stick them into the helper values periodically. This is done with an automation that runs every 8 hours. I figure this is frequently enough.
I use helpers because I don't want to go parse the weather data each time directly. This ALSO lets me manipulate the data before putting it into the helper, if needed. Additionally, the forecast values currently require a weather.get_forecasts call, and I can't access that from inside the voice template. It's a nice pattern to use in Home Assistant. Pull and manipulate values in one step. Get those values from voice in another step.

Here's the YAML version of that automation, pulled from automations.yaml:
- id: 'my-id-number'
alias: 'Update Today Forecast '
description: Fetch and store today's forecast high, low, precip every 8 hours
triggers:
- trigger: time_pattern
hours: /8
actions:
- action: weather.get_forecasts
target:
entity_id: weather.tomorrow_io_livingstone_place_daily
data:
type: daily
response_variable: forecast
- action: input_number.set_value
target:
entity_id: input_number.today_forecast_high
data:
value: '{{ forecast[''weather.tomorrow_io_livingstone_place_daily''].forecast[0].temperature
}}'
- action: input_number.set_value
target:
entity_id: input_number.today_forecast_low
data:
value: '{{ forecast[''weather.tomorrow_io_livingstone_place_daily''].forecast[0].templow
}}'
- action: input_number.set_value
target:
entity_id: input_number.today_forecast_precipitation
data:
value: '{{ forecast[''weather.tomorrow_io_livingstone_place_daily''].forecast[0].precipitation_probability
}}'
mode: single
The Voice Conversation Response
To tie it all together, I'll create an automation that has voice sentence triggers, and then a template for the conversation response when those sentences are heard. You can see the template pulls the values from the input helpers set earlier.

Here's the YAML version of the Weather Report voice automation from automations.yaml.
- id: 'my-id-number'
alias: Weather Report
description: ''
triggers:
- trigger: conversation
command:
- What's the weather
- What is the weather
- what's the temperature
- weather report
conditions: []
actions:
- set_conversation_response: 'It is {{ state_attr(''weather.tomorrow_io_livingstone_place_daily'',
''temperature'') | default(0) | int }} degrees and {{ states(''weather.tomorrow_io_livingstone_place_daily'')
| replace(''_'', '' '') }},
with a high of {{ states(''input_number.today_forecast_high'') | default(0)
| int }} and a low of {{ states(''input_number.today_forecast_low'') | default(0)
| int }},
and a {{ states(''input_number.today_forecast_precipitation'') | default(0)
| int }} percent chance of rain.
Humidity is {{ state_attr(''weather.tomorrow_io_livingstone_place_daily'', ''humidity'')
| default(0) | int }} percent,
wind at {{ state_attr(''weather.tomorrow_io_livingstone_place_daily'', ''wind_speed'')
| default(0) | int }} miles per hour,
and visibility is {{ state_attr(''weather.tomorrow_io_livingstone_place_daily'',
''visibility'') | default(0) | int }} miles.'
mode: single
The Result
Now when I say:
- What's the weather
- What is the weather
- What's the temperature
- Weather report
I'll get back a voice response like:
It is 84 degrees and sunny, with a high of 88 and a low of 69 and a 0 percent chance of rain. Humidity is 88 percent, wind at 3 miles-per-hour, and visibility is 9 miles.
No calls to Amazon were made in the process. It used my local voice pipe line and the data collected from my Tomorrow.io integration in Home Assistant.