-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathon-but1-press.yaml
33 lines (33 loc) · 1.1 KB
/
on-but1-press.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
# turn on the testbutton_led, switch REL1 on for 300ms and – depending
# on the global boolean variables - do Divera and ntfy HTTP request
# to trigger test alerts via their API
- logger.log:
format: "Button BUT1 pressed"
level: INFO
- output.turn_on: testbutton_led
# switch the relay off after 300ms
- output.turn_on: relay_1
- delay: ${relay_on_time}
- output.turn_off: relay_1
# only send alerts, when there is a wifi connection
- if:
condition:
wifi.connected:
then:
- lambda: 'id(global_alert_type_test) = true;'
- <<: !include {file: send-alerts.yaml,
vars:
{
divera_type: '${divera_type_test}',
ntfy_title: '${ntfy_title_test}',
ntfy_priority: '${ntfy_priority_test}',
ntfy_tags: '${ntfy_tags_test}',
ntfy_body: '${ntfy_body_test}'
}
}
else:
- lambda: 'id(global_alert_pending) = true;'
- lambda: 'id(global_pending_alert_type_test) = true;'
- logger.log:
format: "No wifi connection, testalert set to pending."
level: INFO