#Weather Forecast

1 messages · Page 1 of 1 (latest)

rain sedge
#

not sure what im doing wrong here but this doesnt seem to be working, just would like to ask Assist what the weather forecast is for the rest of the week. what am i missing here?

conversation:
  intents:
    GetWeatherForecast:
      - "What's the weather forecast for the next couple of days?"
      - "Tell me the weather forecast for the next few days."
      - "How will the weather be in the coming days?"
      - "Give me the forecast for the next couple of days."
      - "What should I expect from the weather in the next days?"

intent_script:
  GetWeatherForecast:
    action:
      - action: weather.get_forecasts
        target:
          entity_id: weather.openweathermap
        data:
          type: daily
        response_variable: result 
      - stop: ""
        response_variable: result
    speech:
      text: >
        {% set forecasts = action_response['weather.openweathermap'].forecast %}
        {% if forecasts is defined and forecasts|length > 1 %}
          The forecast for the next couple of days is:
          {% for day in forecasts[:2] %}
            On {{ (day.datetime | as_datetime).strftime('%A') }},
            the temperature will be around {{ day.temperature }} degrees,
            with {{ day.condition }} expected.
          {% endfor %}
        {% else %}
          I'm sorry, I couldn't retrieve the forecast right now.
        {% endif %}
river basin
#

What isn't working?

rain sedge
#

Hey the intent is not matching, I deleted all this above and just used the example off HA example. I wasn’t able to get that to go either


conversation:
  intents:
    EventCountToday:
      - "How many meetings do I have today?"

intent_script:
  EventCountToday:
    action:
      - action: calendar.get_events
        target:
          entity_id: calendar.my_calendar
        data_template:
          start_date_time: "{{ today_at('00:00') }}"
          duration: { "hours": 24 }
        response_variable: result                     # get action response
      - stop: ""
        response_variable: result                     # and return it
    speech:
      text: "{{ action_response['calendar.my_calendar'].events | length }}"   # use the action's response

the debug on the voice assist say error no match

#

It’s probably something stupid I’m missing

river basin
#

Where is this yaml located?

#

Normally you would add the sentences into the custom_sentences/en folder in their own yaml, and the intent script technically goes into the configuration.yaml, though there's ways to map other yaml files into it for better organization

rain sedge
#

I have them split as you indicated custom_sentence/en/ and configuration.yaml for the intent_script

river basin
#

Based on the above I'm not sure it's structured quite right

#

Here's an example of a yaml in my custom sentences:

rain sedge
#

Thanks for that still no luck

river basin
#

Did you reload/restart home Assistant after adding it?

#

And is your configuration.yaml modified from using the defaults?

rain sedge
#

Figured it out it didn’t like the ? In the sentence

#

Thanks for your assistance

river basin
#

Aah yeah didn't then notice that. Generally you want to avoid punctuation and capital letters. Think some punctuations are part of the sentence templating.

rain sedge
#

Thank you one other question when updating this yaml do I need to do a restart or can I do the quick reload of the yaml

river basin
#

You can reload from dev tools

#

Sentences are reloaded by reloading Conversation

#

Intents are reloaded via intent script reload

rain sedge
#

perfect well i have that working looks like there is an issue with my intent_script mind taking a look? it fires but just respondes with ...

#
GetWeatherForecast:
  action:
    - action: weather.get_forecasts
      target:
        entity_id: weather.openweathermap
      data:
        type: daily
      response_variable: forecast
  speech:
      text: >
        {% set data = context.variables.forecast['weather.openweathermap']['forecast'] %}
        {% if data %}
          {% for day in data %}
            On {{ day.datetime | as_timestamp | timestamp_custom('%A, %B %d') }},
            the weather will be {{ day.condition }},
            with a high of {{ day.temperature }}° and a low of {{ day.templow }}°.
          {% endfor %}
        {% else %}
          Weather forecast is currently unavailable.
        {% endif %}
#

was doing some testing and was able to get this script to work with a persistant notification

alias: Test Weather Forecast
sequence:
  - target:
      entity_id: weather.openweathermap
    data:
      type: daily
    response_variable: forecast
    action: weather.get_forecasts
  - data:
      title: Weather Forecast Debug
      message: |
        {{ forecast }}
    action: persistent_notification.create