Voice Assistant Intents for WRAL Weather.
HA has a few built-in intents for weather that can be used as is. For example, using a wral weather entity with friendly name “wral” one can say:
- “What is the weather like”
- “What is the wral weather like”
- “What is the weather for wral”
These built-in intent will get the wral weather entity’s state and temperature.
However I wanted to expand on this, and I came up with a few custom intents (which I’m still playing around with):
- Ask about the current weather and get the current temperature and humidity
- Ask about today’s weather forecast and get not only the current temperature and humidity but also the day’s forecast from the
detailed_description
where WRAL provides a lot of textual information.
To get at the forecast data, one has to use the action weather.get_forecasts
, so I use a Sentence Trigger to customize the intents:
alias: Weather Sentence Trigger
description: Weather Sentence Trigger
triggers:
- trigger: conversation
command:
- what is [today's|the] weather [forecast] [for today]
- what is [today's|the] forecast [for today's weather]
id: weather_today
- trigger: conversation
command:
- what is the current weather
id: weather_current
conditions: []
actions:
- action: weather.get_forecasts
data:
type: daily
target:
entity_id: weather.wral_weather
response_variable: forecast_data
- set_conversation_response: >-
Currently it is {{ states("weather.wral_weather") }} with a temperature
of {{state_attr("weather.wral_weather","temperature") }} degrees
and humidity of {{state_attr("weather.wral_weather","humidity") }}
percent.
{% if trigger.id == 'weather_today' %}
The forecast. {% set forecast =
forecast_data['weather.wral_weather'].forecast[0] %} {{
forecast['detailed_description'] }}
{% endif %}
mode: single