2018-06-14 03:09:49 +00:00
|
|
|
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') }}
|
2018-06-14 23:10:11 +00:00
|
|
|
script:
|
|
|
|
sonos_tts:
|
|
|
|
alias: "Sonos TTS"
|
|
|
|
sequence:
|
|
|
|
- service: media_player.sonos_snapshot
|
|
|
|
data_template:
|
|
|
|
entity_id: "{{ sonos_entity|default('media_player.den') }}"
|
|
|
|
- service: media_player.sonos_unjoin
|
|
|
|
data_template:
|
|
|
|
entity_id: "{{ sonos_entity|default('media_player.den') }}"
|
|
|
|
- service: media_player.volume_set
|
|
|
|
data_template:
|
|
|
|
entity_id: "{{ sonos_entity|default('media_player.den') }}"
|
|
|
|
volume_level: "{{ volume|default(0.5) }}"
|
|
|
|
- service: media_player.play_media
|
|
|
|
data:
|
|
|
|
entity_id: media_player.den
|
|
|
|
media_content_id: https://hass.phoenixinquis.is-a-geek.org/local/chime.ogg
|
|
|
|
media_content_type: music
|
|
|
|
- delay: '00:00:03'
|
|
|
|
- service: tts.amazon_polly_say
|
|
|
|
data_template:
|
|
|
|
entity_id: "{{ sonos_entity|default('media_player.den') }}"
|
|
|
|
message: "{{ message }}"
|
|
|
|
- delay: "{{ delay|default('00:00:00') }}"
|
|
|
|
- wait_template: "{{ is_state(sonos_entity|default('media_player.den'), 'playing') }}"
|
|
|
|
timeout: '00:00:05'
|
|
|
|
- wait_template: "{{ not is_state(sonos_entity|default('media_player.den'), 'playing') }}"
|
|
|
|
timeout: '00:02:00'
|
|
|
|
- service: media_player.sonos_restore
|
|
|
|
data_template:
|
|
|
|
entity_id: "{{ sonos_entity|default('media_player.den') }}"
|
2018-06-14 03:09:49 +00:00
|
|
|
|
2018-06-14 20:38:20 +00:00
|
|
|
group:
|
|
|
|
Sonos:
|
|
|
|
view: yes
|
|
|
|
icon: mdi:speaker
|
|
|
|
entities:
|
|
|
|
- binary_sensor.den_night_mode
|
|
|
|
- group.sonos_players
|
|
|
|
- group.sonos_automations
|
2018-06-14 23:10:11 +00:00
|
|
|
- group.sonos_scripts
|
2018-06-14 20:38:20 +00:00
|
|
|
sonos_players:
|
|
|
|
name: Sonos
|
|
|
|
entities:
|
|
|
|
- media_player.den
|
|
|
|
sonos_automations:
|
|
|
|
name: Automations
|
|
|
|
entities:
|
|
|
|
- automation.toggle_sonos_night_mode
|
2018-06-14 23:10:11 +00:00
|
|
|
sonos_scripts:
|
|
|
|
name: Scripts
|
|
|
|
entities:
|
|
|
|
- script.sonos_tts
|