-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAI_weather_automation.yaml
66 lines (66 loc) · 2.5 KB
/
AI_weather_automation.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
alias: AI Weather
description: ChatGPT reads weather report, based on timeframe in the conversation prompt
trigger:
- platform: conversation
command:
- What is the weather {my_timeframe}
- Tell me {my_timeframe} weather
- What is {my_timeframe} weather
- Weather {my_timeframe}
- "{my_timeframe} weather"
condition: []
action:
- if:
- condition: or
conditions:
- condition: template
value_template: "{{ 'today' in trigger.slots.my_timeframe }}"
- condition: template
value_template: "{{ 'watermelon' in trigger.slots.my_timeframe }}"
- condition: template
value_template: "{{ 'overnight' in trigger.slots.my_timeframe }}"
- condition: template
value_template: "{{ 'tonight' in trigger.slots.my_timeframe }}"
- condition: template
value_template: "{{ 'tomorrow' in trigger.slots.my_timeframe }}"
- condition: template
value_template: "{{ 'the' in trigger.slots.my_timeframe }}"
then:
- service: weather.get_forecasts
target:
entity_id: weather.forecast_home
data:
type: hourly
response_variable: my_weather_time
else:
- service: weather.get_forecasts
target:
entity_id: weather.forecast_home
data:
type: daily
response_variable: my_weather_time
- service: conversation.process
metadata: {}
data:
agent_id: conversation.openai_conversation
text: >-
You are using Home Assistant and the met integration for weather data.
The weather data is: {{ my_weather_time }}. Provide a natural language
forecast for {{ trigger.slots.my_timeframe }} indicating trends over the
day or night rather than an hourly listing of conditions. Include the
temperature, humidity, and precipitation. Convert the precipitation
decimal value into a percentage. State any times in AM or PM, omitting
minutes. This wil be spoken aloud with text-to-speech so avoid visual
formatting like bullets or tables, but speak in a friendly,
conversational style.
response_variable: chatgpt_response
- service: notify.persistent_notification
metadata: {}
data:
title: Test
data: {}
message: "{{ chatgpt_response.response.speech.plain.speech }}"
enabled: false
- set_conversation_response: "{{ chatgpt_response.response.speech.plain.speech }}"
enabled: true
mode: single