forked from arsaboo/homeassistant-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
intent_script.yaml
executable file
·149 lines (141 loc) · 5.39 KB
/
intent_script.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
GetInfofromHASS:
speech:
text: >
{%- if SensorType.lower() == "temperature" -%}
Temperature in the living room is {{ states('sensor.downstairs_temperature') }} degrees and upstairs temperature is {{ states('sensor.upstairs_temperature') }}.
{%- elif SensorType.lower() == "humidity" -%}
Humidity in the living room is {{ states.sensor.downstairs_humidity.state }} degrees and upstairs humidity is {{ states.sensor.upstairs_humidity.state }}.
{%- elif SensorType.lower() == "traffic" or SensorType.lower() == "commute" -%}
The fastest route to office takes about {{ states("sensor.morning_commute") }} minutes.
{%- elif SensorType.lower() in ["evening traffic", "evening commute", "traffic to home"] -%}
The fastest route to home takes about {{ states("sensor.alok_to_home") }} minutes.
{%- endif -%}
card:
type: simple
title: Get {{ SensorType }} information
content: Ask Home Assistant about {{ SensorType }}
LocateIntent:
speech:
text: >
{%- if User.lower() == "alok" -%}
Alok is at {{ states.device_tracker.meta_alok.state.replace('_', ' ') }}.
{%- elif User.lower() == "rashmi" -%}
Rashmi is at {{ states.device_tracker.meta_rashmi.state.replace('_', ' ') }}.
{%- else -%}
I am sorry, I do not know where {{ User }} is.
{%- endif -%}
card:
type: simple
title: Location queried
content: Ask Home Assistant about user location
WhereAreWeIntent:
speech:
text: >
{%- if is_state('device_tracker.meta_alok', 'home') and
is_state('device_tracker.meta_rashmi', 'home') -%}
You are both home, you silly
{%- else -%}
Rashmi is at {{ states.device_tracker.meta_rashmi.state.replace('_', ' ') }} and Alok is at {{ states.device_tracker.meta_alok.state.replace('_', ' ') }}.
{% endif %}
card:
type: simple
title: Where are We?
content: Ask Home Assistant about where everyone is
RunScriptIntent:
action:
service: script.turn_on
data_template:
entity_id: script.{{ Script | replace(" ", "_") }}
speech:
type: plain
text: OK
card:
type: simple
title: Run Script
content: Ask Home Assistant to run {{ Script }}.
PlayRadioIntent:
action:
service: script.playradio
data_template:
station: "{{ Station | lower | replace(' ', '_') }}"
speech:
type: plain
text: OK
card:
type: simple
title: Play Music
content: Ask Home Assistant to play music.
TurnLights:
speech:
text: Turning {{ Room }} lights {{ OnOff }}
card:
type: simple
title: Turn lights {{ OnOff }}
content: Ask Home Assistant to turn {{ Room }} lights {{ OnOff }}
action:
- service_template: >
{%- if OnOff == 'on' -%}
homeassistant.turn_on
{%- else -%}
homeassistant.turn_off
{%- endif -%}
data_template:
entity_id: >
{%- if Room.lower() in ['kitchen', 'living room'] -%}
light.
{%- elif Room.lower() in ['driveway', 'porch'] -%}
switch.
{%- endif -%}
{%- if Room.lower() in ['kitchen', 'living room'] -%}
ge_kitchen_lights
{%- elif Room.lower() in ['driveway'] -%}
driveway
{%- elif Room.lower() in ['porch'] -%}
wemoporch
{%- endif -%}
TurnDeviceIntent:
speech:
text: Turning {{ Devices }} {{ OnOff }}
card:
type: simple
title: Turn {{ Devices }} {{ OnOff }}
content: Ask Home Assistant to turn {{ Devices }} {{ OnOff }}
action:
- service: remote.turn_on
data_template:
entity_id: remote.livingroom
activity: >
{%- if Devices.lower() in ['television', 'plex', 'shield', 'tv', 'kodi'] and OnOff == 'on'-%}
18032761
{%- elif Devices.lower() in ['apple tv'] and OnOff == 'on' -%}
23043915
{%- elif Devices.lower() in ['fire tv', 'amazon fire', 'amazon fire tv'] and OnOff == 'on' -%}
17230861
{%- elif OnOff == 'off' -%}
-1
{%- endif -%}
GarageDoorIntent:
speech:
text: >
{%- if OpenClose.lower() == "open" and is_state("binary_sensor.garage_door", "off") -%}
OK, opening the garage door.
{%- elif OpenClose.lower() == "open" and is_state("binary_sensor.garage_door", "on") -%}
The garage door is already open.
{%- elif OpenClose.lower() == "close" and is_state("binary_sensor.garage_door", "on") -%}
OK, closing the garage door.
{%- elif OpenClose.lower() == "close" and is_state("binary_sensor.garage_door", "off") -%}
The garage door is already closed.
{%- endif -%}
card:
type: simple
title: Garage door {{ OpenClose }}
content: Ask Home Assistant to {{ OpenClose }} garage door.
action:
- service_template: >
{%- if OpenClose.lower() == "open" and is_state("binary_sensor.garage_door", "off") -%}
switch.turn_on
{%- elif OpenClose.lower() == "close" and is_state("binary_sensor.garage_door", "on") -%}
switch.turn_on
{%- endif -%}
data_template:
entity_id: switch.shelly_garage