- parallel:
- alias: call chatgpt
sequence:
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 100
- service: chatgpt.chat
data:
messages:
- role: user
content: "{{message.replace('$style', styles | random)}}"
callback_id: "{{this.context.id}}"
- alias: call tts
sequence:
- wait_for_trigger:
- platform: event
event_type: return_value
event_data:
callback_id: "{{this.context.id}}"
timeout:
hours: 0
minutes: 0
seconds: 60
milliseconds: 0
continue_on_timeout: false
- service: tts.google_translate_say
data:
language: en-au
entity_id: media_player.living_room
message: "{{wait.trigger.event.data.content | trim | replace('\"','')}}"
variables:
styles:
- happy
- upbeat
- motivational
- funny
- epic
- dark humor
- polite
message: Give me a $style weatherforecast for today based on: Condition {{states("weather.knmi_spijkenisse")}} Temperature min:{{state_attr("weather.knmi_spijkenisse","forecast")[1].templow|round}}. Temperature max:{{state_attr("weather.knmi_spijkenisse","forecast")[1].temperature|round}} degrees. Percent change on sun {{state_attr("weather.knmi_spijkenisse","forecast")[1].sun_chance|round}} Percent change on rain {{state_attr("weather.knmi_spijkenisse","forecast")[1].precipitation_probability|round}} {% if state_attr("weather.knmi_spijkenisse","forecast")[1].wind_bearing == "null" -%} Wind bearing {{state_attr("weather.knmi_spijkenisse","forecast")[1].wind_bearing|round}} {%- else -%} Wind bearing: 0 {%- endif %} Wind speed {{state_attr("weather.knmi_spijkenisse","forecast")[1].wind_speed|round}} km/hr. Visibility {{state_attr("weather.knmi_spijkenisse","visibility")|round}} km. Start with goodmorning/day/afternoon/evening when it is now {{now().strftime('%H:%M')}}
Gives me 7 different styles randomly based on the context provided by knmi for today’s forecast
Thanks go to @jjbankert for the random idea