-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutilitarian-automation.yaml
More file actions
52 lines (52 loc) · 1.66 KB
/
utilitarian-automation.yaml
File metadata and controls
52 lines (52 loc) · 1.66 KB
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
alias: The Internet Desk - Utilitarian
description: The Internet as it was meant to be (if you are in a rush).
triggers:
- trigger: state
entity_id:
- sensor.the_internet_desk_the_internet_desk_tag
conditions: []
actions:
- choose:
- conditions:
- condition: template
value_template: >-
{{ trigger.to_state.state != '' and trigger.to_state.state in
device_map }}
sequence:
- target:
entity_id: "{{ device_map[trigger.to_state.state] }}"
action: switch.turn_on
- data:
rgb_color:
- 0
- 255
- 0
target:
entity_id: light.<your_light_id>
action: light.turn_on
- conditions:
- condition: template
value_template: >
{% set new_state = trigger.to_state.state %} {% set old_state =
trigger.from_state.state %} {{ new_state == '' and old_state !=
'' and old_state in device_map }}
sequence:
- target:
entity_id: "{{ device_map.values() | list }}"
action: switch.turn_off
- target:
entity_id: light.<your_light_id>
data:
rgb_color:
- 255
- 0
- 0
brightness_pct: 90
action: light.turn_on
mode: restart
variables:
# The device_map is {"An NFC Tag ID to be scanned": "A switch in HA that when set to On allows internet access, and when Off will disable it"}
device_map: |
{{ {
"<your_nfc_tag_id>": "switch.<your_switch_id>",
} }}