37 lines
872 B
YAML
37 lines
872 B
YAML
automation:
|
|
- alias: Toggle Sonos night mode
|
|
action:
|
|
- service: media_player.sonos_set_option
|
|
entity_id: media_player.den
|
|
data_template:
|
|
night_sound: >-
|
|
{{ now().hour > 22 }}
|
|
trigger:
|
|
- platform: time
|
|
at: '22:30:00'
|
|
- platform: time
|
|
at: '08:00:00'
|
|
binary_sensor:
|
|
- platform: template
|
|
sensors:
|
|
den_night_mode:
|
|
friendly_name: Sonos Den Night Mode
|
|
value_template: >-
|
|
{{ state_attr('media_player.den', 'night_sound') }}
|
|
|
|
group:
|
|
Sonos:
|
|
view: yes
|
|
icon: mdi:speaker
|
|
entities:
|
|
- binary_sensor.den_night_mode
|
|
- group.sonos_players
|
|
- group.sonos_automations
|
|
sonos_players:
|
|
name: Sonos
|
|
entities:
|
|
- media_player.den
|
|
sonos_automations:
|
|
name: Automations
|
|
entities:
|
|
- automation.toggle_sonos_night_mode
|