-
-
Notifications
You must be signed in to change notification settings - Fork 505
/
amp_settings.yaml
executable file
·60 lines (56 loc) · 2.25 KB
/
amp_settings.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
#-------------------------------------------
# AMP Settings Standardization Script
# Description: This script standardizes the settings for audio amplifiers
# across various media players in the home.
#
# For more information and updates, visit:
# https://www.vcloudinfo.com/click-here
#
# Original Repository: https://github.com/CCOSTAN/Home-AssistantConfig
#-------------------------------------------
# Set the AMP settings
amp_settings:
# Define the sequence of actions to be performed
sequence:
# Set the volume for the specified media players
- service: media_player.volume_set
data:
# Set the entity ID for the media players to be controlled
# If the "media_player" variable is not defined, set it to a list of media player entities
# If the "media_player" variable is a list, convert it to a comma-separated string
entity_id: >-
{% if media_player | length == 0 %}
{% set media_player = [
'media_player.livingroomcc',
'media_player.alarm_clock',
'media_player.bedroom_alarm_panel'
] %}
{% endif %}
{% if media_player is not string and media_player is sequence %}
{% set media_player = media_player|join(', ') %}
{% endif %}
{{ media_player }}
# Set the volume level for the media players
# If the "volume_level" variable is not defined, set it based on the current time of day
# Otherwise, use the value of the "volume_level" variable
volume_level: >-
{% if volume_level is none %}
{% if now().strftime('%H')|int < 12 and now().strftime('%H')|int > 6 %}
0.3
{% elif now().strftime('%H')|int > 12 and now().strftime('%H')|int < 20 %}
0.5
{% else %}
0.3
{% endif %}
{% endif %}
{{volume_level}}
# If the "switch.lr_amp" switch is off and the "group.bed" group is off, turn on the "switch.lr_amp" switch
- condition: state
entity_id: switch.lr_amp
state: 'off'
- condition: state
entity_id: group.bed
state: 'off'
- service: switch.turn_on
data:
entity_id: switch.lr_amp