-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.yaml
108 lines (105 loc) · 3.72 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
lounge_flash_lounge_lights_red:
alias: "Living Room: Flash Lights Red"
sequence:
- action: scene.create
data:
scene_id: current_lounge_lights
snapshot_entities:
- light.living_room_lamp_left
- light.living_room_lamp_right
- action: scene.turn_on
target:
entity_id: scene.living_room_lights_red
data:
transition: 0
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 500
- action: scene.turn_on
target:
entity_id: scene.current_lounge_lights
mode: single
icon: mdi:lamp
nfc_bedroom_right:
alias: NFC Bedroom Right
sequence:
- action: script.send_to_home_log
data:
message: Turning everything off.
- action: script.turn_everything_off
mode: single
icon: mdi:nfc
downstairs_random_light:
alias: Downstairs Random Light
sequence:
- action: homeassistant.toggle
data:
entity_id:
"{% set group_id = 'light.downstairs_random_lights' %} {% set max_on
= 3 %} {% set lights_on_count = expand(group_id) | selectattr('state',
'eq', 'on')| list | length %} {% if lights_on_count > max_on %}\n {% set
lights_on_entities = expand(group_id) | selectattr('state', 'eq', 'on')| map(attribute='entity_id')
| list %}\n {{ lights_on_entities | random }}\n{% else %}\n {% set group_lights_entities
= expand(group_id) | map(attribute='entity_id') | list %}\n {{ group_lights_entities
| random }}\n{% endif %}"
mode: single
icon: mdi:lightbulb-group
upstairs_random_lights:
alias: Upstairs Random Lights
sequence:
- action: homeassistant.toggle
data:
entity_id:
"{% set group_id = 'light.upstairs_random_lights' %} {% set max_on
= 1 %} {% set lights_on_count = expand(group_id) | selectattr('state',
'eq', 'on')| list | length %} {% if lights_on_count > max_on %}\n {% set
lights_on_entities = expand(group_id) | selectattr('state', 'eq', 'on')| map(attribute='entity_id')
| list %}\n {{ lights_on_entities | random }}\n{% else %}\n {% set group_lights_entities
= expand(group_id) | map(attribute='entity_id') | list %}\n {{ group_lights_entities
| random }}\n{% endif %}"
mode: single
icon: mdi:lightbulb-group
update_travel_time_by_car:
alias: Update Travel Time By Car
sequence:
- parallel:
- action: homeassistant.update_entity
data: {}
target:
entity_id: sensor.google_travel_time_by_car
- action: script.send_to_home_log
data:
message:
"Updating.\nOrigin: {{ states('sensor.origin_address') }} \nDestination:
{{ states('sensor.destination_address') }}"
title: ":world_map: Travel Time By Car"
mode: single
icon: mdi:car
test:
alias: Test Calendar
sequence:
- action: calendar.get_events
target:
entity_id:
- calendar.tsang_children
- calendar.family
data:
start_date_time: "2024-06-08 11:25:00"
duration:
hours: 1
minutes: 0
seconds: 0
response_variable: calendars
- action: script.send_to_home_log
data:
message: >-
{%- for event in calendars['calendar.tsang_children'].events -%}
Name: {{ calendars['calendar.tsang_children'].events[0].summary }}
Location: {{ calendars['calendar.tsang_children'].events[0].location|default('N/A',true) }}
Start Time: {{ calendars['calendar.tsang_children'].events[0].start }}
End Time: {{ calendars['calendar.tsang_children'].events[0].end }}
{%- endfor -%}
log_level: "Normal"
mode: single