-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.yaml
72 lines (72 loc) · 2.03 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
everything_off:
alias: Turn everything off in the house
mode: single
fields:
exclude_entity_ids:
name: Exclude
description: entities to exclude
selector:
entity:
filter:
- domain: fan
- domain: light
- domain: media_player
multiple: true
variables:
exclude_ids: >
{{ exclude_entity_ids | default([]) }}
fans: >
{{
states.fan
| selectattr('state', 'eq', 'on')
| rejectattr('entity_id', 'in', ['fan.air_purifier', 'fan.mechanische_ventilatie_ventilatie'])
| rejectattr('entity_id', 'in', exclude_ids)
| map(attribute='entity_id')
| join(', ')
}}
media_players: >
{{
states.media_player
| rejectattr('state', 'in', ['off', 'unavailable'])
| rejectattr('entity_id', 'in', ['media_player.mediabox_homekit'])
| rejectattr('entity_id', 'in',
integration_entities("jellyfin")
| select("match", "media_player.")
| list
)
| rejectattr('entity_id', 'in', exclude_ids)
| map(attribute='entity_id')
| join(', ')
}}
lights: >
{{
states.light
| selectattr('state', 'eq', 'on')
| rejectattr('attributes.is_hue_group', 'defined')
| rejectattr('attributes.entity_id', 'defined')
| rejectattr('entity_id', 'in', exclude_ids)
| map(attribute='entity_id')
| join(', ')
}}
sequence:
- if:
- "{{ fans != '' }}"
then:
- alias: Turn off all fans
action: fan.turn_off
target:
entity_id: "{{ fans }}"
- if:
- "{{ media_players != '' }}"
then:
- alias: Turn off all media players
action: media_player.turn_off
target:
entity_id: "{{ media_players }}"
- if:
- "{{ lights != '' }}"
then:
- alias: Turn off all lights
action: light.turn_off
target:
entity_id: "{{ lights }}"