-
Notifications
You must be signed in to change notification settings - Fork 1
/
rest_post_command_without_Nodered.txt
239 lines (233 loc) · 6.73 KB
/
rest_post_command_without_Nodered.txt
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
##### TO DO
##### example
#rest:
# resource: http://192.168.1.170/Option.htm
# authentication: basic
# username: admin
# password: '01234'
# scan_interval: 60
# sensor:
# - name: "Option"
# value_template: "{{ value.split('name=')[3].split(' ')[0].replace('\"','') }} {{ value.split('name=')[3].split('value=')[1].split('/')[0].replace('\"','') }}"
#
#######
# stato senza trigger
sensor:
- platform: rest
resource: http://192.168.1.170/RemoteCtr.htm
name: ialarm_stato
authentication: basic
username: admin
password: 012345
scan_interval: 30
value_template: >-
{% set status = value.split('selected="selected">')[1].split('<')[0]%}
{% if status == "OFF centrale" %}
Disarmato
{% elif status == "ON Parziale" %}
Armato in casa
{% elif status == "ON Totale" %}
Armato
{% else %}
{{ status }}
{% endif %}
## Rest comandi
rest_command:
ialarm_disarm:
url: http://192.168.1.170/RemoteCtr.htm
method: POST
username: admin
password: 012345
payload: 'Ctrl=3 BypassNum=00 BypassOpt=0'
ialarm_arm:
url: http://192.168.1.170/RemoteCtr.htm
method: POST
username: admin
password: 012345
payload: 'Ctrl=1 BypassNum=00 BypassOpt=0'
ialarm_home:
url: http://192.168.1.170/RemoteCtr.htm
method: POST
username: admin
password: 012345
payload: 'Ctrl=2 BypassNum=00 BypassOpt=0'
ialarm_refresh:
url: http://192.168.1.170/RemoteCtr.htm
method: POST
username: admin
password: 012345
payload: 'Ctrl=4 BypassNum=00 BypassOpt=0'
ialarm_bypass1_on:
url: http://192.168.1.170/RemoteCtr.htm
method: POST
username: admin
password: 012345
payload: 'Ctrl=0&BypassNum=01&BypassOpt=1'
ialarm_bypass1_off:
url: http://192.168.1.170/RemoteCtr.htm
method: POST
username: admin
password: 012345
payload: 'Ctrl=0&BypassNum=01&BypassOpt=2'
ialarm_bypass2_on:
url: http://192.168.1.170/RemoteCtr.htm
method: POST
username: admin
password: 012345
payload: 'Ctrl=0&BypassNum=02&BypassOpt=1'
ialarm_bypass2_off:
url: http://192.168.1.170/RemoteCtr.htm
method: POST
username: admin
password: 012345
payload: 'Ctrl=0&BypassNum=02&BypassOpt=2'
ialarm_bypass3_on:
url: http://192.168.1.170/RemoteCtr.htm
method: POST
username: admin
password: 012345
payload: 'Ctrl=0&BypassNum=03&BypassOpt=1'
ialarm_bypass3_off:
url: http://192.168.1.170/RemoteCtr.htm
method: POST
username: admin
password: 012345
payload: 'Ctrl=0&BypassNum=03&BypassOpt=2'
ialarm_bypass4_on:
url: http://192.168.1.170/RemoteCtr.htm
method: POST
username: admin
password: 012345
payload: 'Ctrl=0&BypassNum=04&BypassOpt=1'
ialarm_bypass4_off:
url: http://192.168.1.170/RemoteCtr.htm
method: POST
username: admin
password: 012345
payload: 'Ctrl=0&BypassNum=04&BypassOpt=2'
ialarm_bypass5_on:
url: http://192.168.1.170/RemoteCtr.htm
method: POST
username: admin
password: 012345
payload: 'Ctrl=0&BypassNum=05&BypassOpt=1'
ialarm_bypass5_off:
url: http://192.168.1.170/RemoteCtr.htm
method: POST
username: admin
password: 012345
payload: 'Ctrl=0&BypassNum=05&BypassOpt=2'
ialarm_bypass6_on:
url: http://192.168.1.170/RemoteCtr.htm
method: POST
username: admin
password: 012345
payload: 'Ctrl=0&BypassNum=06&BypassOpt=1'
ialarm_bypass6_off:
url: http://192.168.1.170/RemoteCtr.htm
method: POST
username: admin
password: 012345
payload: 'Ctrl=0&BypassNum=06&BypassOpt=2'
## Arma disarma in casa
switch:
- platform: template
switches:
ialarm_disarma:
value_template: "off"
turn_on:
service: rest_command.ialarm_disarm
target:
entity_id: switch.ialarm_disarma
turn_off:
- platform: template
switches:
ialarm_arma:
value_template: "off"
turn_on:
service: rest_command.ialarm_arm
target:
entity_id: switch.ialarm_arma
turn_off:
- platform: template
switches:
ialarm_armaincasa:
value_template: "off"
turn_on:
service: rest_command.ialarm_home
target:
entity_id: switch.ialarm_armaincasa
turn_off:
## Bypass
- platform: template
switches:
bypass_camera_letto:
value_template: "{{ states.binary_sensor.camera_letto.attributes.bypass }}"
turn_on:
service: rest_command.ialarm_bypass1_on
target:
entity_id: switch.ialarm_bypass1
turn_off:
service: rest_command.ialarm_bypass1_off
target:
entity_id: switch.ialarm_bypass1
- platform: template
switches:
bypass_bagno:
value_template: "{{ states.binary_sensor.bagno.attributes.bypass }}"
turn_on:
service: rest_command.ialarm_bypass2_on
target:
entity_id: switch.ialarm_bypass2
turn_off:
service: rest_command.ialarm_bypass2_off
target:
entity_id: switch.ialarm_bypass2
- platform: template
switches:
bypass_cucina:
value_template: "{{ states.binary_sensor.cucina.attributes.bypass }}"
turn_on:
service: rest_command.ialarm_bypass3_on
target:
entity_id: switch.ialarm_bypass3
turn_off:
service: rest_command.ialarm_bypass3_off
target:
entity_id: switch.ialarm_bypass3
- platform: template
switches:
bypass_bagnetto:
value_template: "{{ states.binary_sensor.bagnetto.attributes.bypass }}"
turn_on:
service: rest_command.ialarm_bypass4_on
target:
entity_id: switch.ialarm_bypass4
turn_off:
service: rest_command.ialarm_bypass4_off
target:
entity_id: switch.ialarm_bypass4
- platform: template
switches:
bypass_studio:
value_template: "{{ states.binary_sensor.studio.attributes.bypass }}"
turn_on:
service: rest_command.ialarm_bypass5_on
target:
entity_id: switch.ialarm_bypass5
turn_off:
service: rest_command.ialarm_bypass5_off
target:
entity_id: switch.ialarm_bypass5
- platform: template
switches:
bypass_porta:
value_template: "{{ states.binary_sensor.porta.attributes.bypass }}"
turn_on:
service: rest_command.ialarm_bypass6_on
target:
entity_id: switch.ialarm_bypass6
turn_off:
service: rest_command.ialarm_bypass6_off
target:
entity_id: switch.ialarm_bypass6