-
Notifications
You must be signed in to change notification settings - Fork 0
/
intent_script.yaml
executable file
·97 lines (93 loc) · 3.23 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
PoolTemperatureIntent:
speech:
type: ssml
text: >
<speak>
{%- if states("sensor.pool_temperature") =="unknown" -%}
The pool temperature is unknown right now - ask again in a few minutes
{%- else -%}
The pool temperature is
{{ states("sensor.pool_temperature") }}
degrees
<break strength="medium" />
{%- if states("sensor.pool_temperature") | float > 28.0 -%}
It's the perfect temperature for a swim!
{%- elif states("sensor.pool_temperature") | float > 26.0 -%}
Quite nice for a dip!
{%- else -%}
A bit too cool for swimming.
{%- endif -%}
{%- endif -%}
</speak>
StatusGarageDoorIntent:
speech:
type: ssml
text: >-
<speak>
{%- if is_state("binary_sensor.garage_closed_sensor", "on") -%}
The garage door is closed.
{%- elif is_state("binary_sensor.garage_open_sensor", "on") -%}
The garage door is open.
{%- else -%}
The garage door is stopped.
{%- endif -%}
</speak>
OpenGarageDoorIntent:
speech:
type: ssml
text: >-
<speak>
{%- if is_state("binary_sensor.garage_closed_sensor", "on") -%}
OK, opening the garage door.
{%- elif is_state("binary_sensor.garage_open_sensor", "on") -%}
The garage door is already open.
{%- else -%}
The garage door is stopped.
{%- endif -%}
</speak>
action:
service_template: >
{%- if is_state("binary_sensor.garage_closed_sensor", "on") -%}
switch.turn_on
{%- elif is_state("binary_sensor.garage_open_sensor", "off") and is_state("binary_sensor.garage_closed_sensor", "off")-%}
switch.turn_on
{%- endif -%}
data_template:
entity_id: switch.garage_door_relay
CloseGarageDoorIntent:
speech:
type: ssml
text: >-
<speak>
{%- if is_state("binary_sensor.garage_open_sensor", "on") -%}
OK, closing the garage door.
{%- elif is_state("binary_sensor.garage_closed_sensor", "on") -%}
The garage door is already closed.
{%- else -%}
The garage door is stopped.
{%- endif -%}
</speak>
action:
service_template: >
{%- if is_state("binary_sensor.garage_open_sensor", "on") -%}
switch.turn_on
{%- elif is_state("binary_sensor.garage_open_sensor", "off") and is_state("binary_sensor.garage_closed_sensor", "off")-%}
switch.turn_on
{%- endif -%}
data_template:
entity_id: switch.garage_door_relay
BusTimeIntent:
speech:
type: plain
text: >-
{% set time = states.sensor.bus_389_moncur.attributes.due %}
{% set minutes = (time % 60) | int %}
{% set hours = (time / 60) | int %}
The next bus is due in
{%- if hours > 0 -%}
{{ hours }} hour{%- if hours > 1 -%}s{%- endif -%}
{%- endif -%}
{%- if minutes > 0 -%}
{{ minutes }} minute{%- if minutes > 1 -%}s{%- endif -%}
{%- endif -%}
# The next bus is due in {{ states.sensor.bus_389_moncur.attributes.due }} minutes.