-
Notifications
You must be signed in to change notification settings - Fork 0
/
scripts.yaml
95 lines (88 loc) · 2.67 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
sonos_volume:
sequence:
- service: media_player.volume_set
data:
entity_id: "media_player.living_room"
# volume_level: 0.2
data_template:
volume_level: >-
{% set vol = ([states.media_player.bedroom.attributes.volume_level, states.media_player.bathroom.attributes.volume_level] | min | string) %}
{{ vol }}
say:
alias: Sonos TTS
sequence:
- service: media_player.sonos_snapshot
data_template:
entity_id: "{{ 'media_player.' ~ where }}"
- service: tts.microsoft_say
data_template:
entity_id: "{{ 'media_player.' ~ where }}"
message: "{{ what }}"
- delay:
seconds: 1
- delay: >-
{% set duration = states.media_player[where].attributes.media_duration %}
{% if duration > 0 %}
{% set duration = duration - 1 %}
{% endif %}
{% set seconds = duration % 60 %}
{% set minutes = (duration / 60)|int % 60 %}
{% set hours = (duration / 3600)|int %}
{{ [hours, minutes, seconds]|join(':') }}
- service: media_player.sonos_restore
data_template:
entity_id: "{{ 'media_player.' ~ where }}"
aeg_test:
alias: Azure Event Grid Test
sequence:
- service: azure_event_grid.publish_message
data_template:
name: update_notify
subject: "homeassistant.update"
eventtype: "update_available"
dataversion: 1.0.0
payload: "{ 'message': 'test' }"
restart_ha:
alias: Restart Home Assistant
sequence:
- service: homeassistant.restart
reload_ha:
alias: Reload Configs
sequence:
- service: automation.reload
- service: script.reload
- service: homeassistant.reload_core_config
- service: frontend.reload_themes
fan_full:
alias: Set fan to full
sequence:
- service: light.turn_on
entity_id: light.fan_level
data:
brightness_pct: 80
fan_background:
alias: Set fan to background
sequence:
- service: light.turn_on
entity_id: light.fan_level
data:
brightness_pct: 40
fan_off:
alias: Turn fan off
sequence:
- service: light.turn_off
entity_id: light.fan_level
media_on:
alias: Turn on Multimedia
sequence:
- service: media_player.turn_on
data:
entity_id: media_player.tv
- service: media_player.turn_on
data:
entity_id: media_player.xbox
# - delay: '00:01:00'
# - service: media_player.select_source
# data:
# entity_id: media_player.xbox
# source: "Plex"