-
Notifications
You must be signed in to change notification settings - Fork 26
/
scripts.yaml
182 lines (175 loc) · 5.92 KB
/
scripts.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# 这里是脚本,可以理解为一些组合命令。
# 不同于automation,不会自动触发。
# 虽然script也完全可以写到switch里,但有时候为了保持switch简单易读,就分离出来。
# https://www.home-assistant.io/integrations/script/
# amplifier ==============================
amplifier_volume_up_10_times:
alias: Amplifier Vol Up
sequence:
- service: switch.turn_on
entity_id: switch.amplifier_volume_up
- service: switch.turn_on
entity_id: switch.amplifier_volume_up
- service: switch.turn_on
entity_id: switch.amplifier_volume_up
- service: switch.turn_on
entity_id: switch.amplifier_volume_up
- service: switch.turn_on
entity_id: switch.amplifier_volume_up
- service: switch.turn_on
entity_id: switch.amplifier_volume_up
- service: switch.turn_on
entity_id: switch.amplifier_volume_up
- service: switch.turn_on
entity_id: switch.amplifier_volume_up
- service: switch.turn_on
entity_id: switch.amplifier_volume_up
- service: switch.turn_on
entity_id: switch.amplifier_volume_up
- delay: 00:00:00
amplifier_volume_down_10_times:
alias: Amplifier Vol Down
sequence:
- service: switch.turn_on
entity_id: switch.amplifier_volume_down
- service: switch.turn_on
entity_id: switch.amplifier_volume_down
- service: switch.turn_on
entity_id: switch.amplifier_volume_down
- service: switch.turn_on
entity_id: switch.amplifier_volume_down
- service: switch.turn_on
entity_id: switch.amplifier_volume_down
- service: switch.turn_on
entity_id: switch.amplifier_volume_down
- service: switch.turn_on
entity_id: switch.amplifier_volume_down
- service: switch.turn_on
entity_id: switch.amplifier_volume_down
- service: switch.turn_on
entity_id: switch.amplifier_volume_down
- service: switch.turn_on
entity_id: switch.amplifier_volume_down
- delay: 00:00:00
# 发送媒体键 shell command 无法被前端直接调用 套个壳
media_play_pause:
alias: Play Pause
sequence:
- service: shell_command.send_play_pause
media_previous:
alias: Previous
sequence:
- service: shell_command.send_previous_track
media_next:
alias: Next
sequence:
- service: shell_command.send_next_track
# theater mode ==============================
theater_mode_on:
alias: 'Theater Mode ON'
sequence:
# 状态记录器
- service: input_boolean.turn_on
entity_id: input_boolean.theater_mode
# 放下幕布 不灵敏多按几次
- service: switch.turn_on
entity_id: switch.screen
- service: switch.turn_on
entity_id: switch.screen
- service: switch.turn_on
entity_id: switch.screen
- service: switch.turn_on
entity_id: switch.screen
- service: switch.turn_on
entity_id: switch.screen
- delay: 00:00:10
# turn on amplifier
- service: switch.turn_on
entity_id: switch.amplifier_smart
# 打开投影仪 为了保险多按几次
- service: switch.turn_on
entity_id: switch.projector_power
- service: switch.turn_on
entity_id: switch.projector_power
- service: switch.turn_on
entity_id: switch.projector_power
- delay: 00:00:20
# 关灯
- service: switch.turn_off
entity_id: group.light
- delay: 00:00:10
# 关电脑屏幕
- service: switch.turn_off
entity_id: switch.monitor
theater_mode_off:
alias: 'Theater Mode OFF'
sequence:
# 状态记录器
- service: input_boolean.turn_off
entity_id: input_boolean.theater_mode
# 关闭投影仪 为了保险多按几次
- service: switch.turn_off
entity_id: switch.projector_power
- delay: 00:00:01
- service: switch.turn_off
entity_id: switch.projector_power
- delay: 00:00:01
- service: switch.turn_off
entity_id: switch.projector_power
# 开灯 天亮的话就不开
- service_template: > # 太阳落山的话开灯
switch.turn_{% if is_state('sun.sun','below_horizon') %}on{% else %}off{% endif %}
entity_id:
- switch.light_3_smart
# 开电脑屏幕
- service: switch.turn_on
entity_id: switch.monitor
# 收起幕布 不灵敏多按几次
- service: switch.turn_off
entity_id: switch.screen
- service: switch.turn_off
entity_id: switch.screen
- service: switch.turn_off
entity_id: switch.screen
- service: switch.turn_off
entity_id: switch.screen
- service: switch.turn_off
entity_id: switch.screen
# return & leave home actions ==============================
home_return:
alias: 'Return Home'
sequence:
- service: input_boolean.turn_on # 状态记录器
entity_id: input_boolean.at_home
# template 如果没有else会导致异常并中断,就要放在最后。
- service_template: > # 太阳落山的话开灯
switch.turn_{% if is_state('sun.sun','below_horizon') %}on{% else %}off{% endif %}
entity_id:
- switch.light_2_smart
- switch.light_3_smart
- service: switch.turn_on
entity_id:
- switch.amplifier_smart # 开功放
- switch.monitor # 开显示器
- switch.aircon_smart
- switch.purifier
- service: shell_command.say_welcome_back # 欢迎问候
- service: shell_command.send_volume_up # wakeup screen
- service: shell_command.open_music_player # 打开播放器
- delay: 00:00:05
- service: shell_command.send_space # 播放(远程电脑上已开启的播放器)
home_leave:
alias: 'Leave Home'
sequence:
- service: input_boolean.turn_off # 状态记录器
entity_id: input_boolean.at_home
- service: shell_command.say_welcome_leave # 欢迎问候
- service: switch.turn_off
entity_id:
- switch.monitor
- switch.amplifier_smart
- switch.water_pump
- switch.aircon_smart
- switch.purifier
- group.light
- service: shell_command.screen_off # 息屏