#AI-refined forecast

1 messages · Page 1 of 1 (latest)

west bloom
#

Here's your clues:

#
  1. Create helper Text. I named it Human Forecast. Max length 255.
#
  1. Here's Markdown card:
type: markdown
content: '{{ states("input_text.human_forecast") }}'
title: Forecast from AI
#
  1. Here's script to change that input_text value:
alias: Get weather forecast (text helper)
sequence:
  - data:
      type: daily
    target:
      entity_id: weather.forecast_home
    response_variable: w
    action: weather.get_forecasts
  - variables:
      result:
        unrefined: >-
          {% set next = w['weather.forecast_home'].forecast[0] %} {% if
          (next.precipitation) < 2 %} {% set rain_chance = ', with no rain
          expected.'%} {% elif (next.precipitation) < 10 %} {% set rain_chance =
          ', with tiny chance of rain.'%} {% elif (next.precipitation) < 50 %}
          {% set rain_chance = ', with a good chance of rain.'%} {% else %} {%
          set rain_chance = '. Most probably it will be raining. Don\'t forget
          your umbrella!'%} {% endif %} {% set day_words = 'today in Port
          Coquitlam  will be' %} {{ day_words }} {{ next.condition }}{{
          iif(next.wind_speed |int > 33, ' and windy', '') }} weather with high
          of {{ next.temperature | int }} degrees Celsius and a low of {{
          next.templow | int }} degrees Celsius{{ rain_chance }}
  - data:
      text: >-
        Rephrase following text to sound like JARVIS from Iron Man movie. Omit
        precipitation information, if there will be no rain. Don't use word
        "sir". Here's the input: {{ result.unrefined }}
      agent_id: conversation.google_generative_ai
    response_variable: rephrased
    action: conversation.process
  - action: input_text.set_value
    target:
      entity_id: input_text.human_forecast
    data:
      value: "{{ rephrased.response.speech.plain.speech }}"
mode: single
icon: mdi:weather-cloudy-clock
fields: {}
description: ""
#

Then just create automation, that will call this script every day or every 8 hours or manually call it or whatever.

paper anchor
#

Thank you so much! You're appreciated 💛

pure sonnet
#

@west bloom as you've gone deeper down the rabbit hole here, where should something like this live long term? intents?

#

feel like a lot of these need to be out-of-the-box