Hi All
**Decided to create a new thread taking one issue at a time **
So I finally got the new Sonos setup working, but I still need a little help fixing a couple of things!
First the ground configuration:
script:
sonos_say:
alias: "Sonos TTS script"
sequence:
- service: sonos.snapshot
data_template:
entity_id: "{{ sonos_entity }}"
- service: sonos.unjoin
data_template:
entity_id: "{{ sonos_entity }}"
- service: media_player.volume_set
data_template:
entity_id: "{{ sonos_entity }}"
volume_level: "{{ volume }}"
- service: tts.google_say
data_template:
entity_id: "{{ sonos_entity }}"
message: "{{ message }}"
- delay: "{{ delay }}"
- service: sonos.restore
data_template:
entity_id: "{{ sonos_entity }}"
Then the scripts for the Group, Ungrouping and sound level (They also work, individually)
sonos_group_all:
alias: "Sonos group all"
sequence:
- service: sonos.join
data:
master: media_player.sonos_koekken
entity_id:
- media_player.sonos_sovevaerelse
- media_player.sonos_thomas
- media_player.sonos_victoria
sonos_ungroup_all:
alias: "Sonos ungroup all"
sequence:
- service: sonos.unjoin
entity_id: all
sonos_set_volume:
alias: "Sonos set volume"
sequence:
- service: media_player.volume_set
entity_id:
- media_player.sonos_koekken
- media_player.sonos_sovevaerelse
- media_player.sonos_thomas
- media_player.sonos_victoria
data:
volume_level: 0.20
Now how to combine the above scripts:
1. script.sonos_ungroup_all - Clear existing groups are in place
2. script.sonos_group_all - Group my speakers **
3. script.sonos_set_volume - Set volume for all speakers
I would like to include my google mini speaker: media_player.stue but sofar that breaks my sonos setup
**** in the below automation: which works but need the actions of the scripts****
automation: # Time is now 18:00 from Sun to Fri on Sonos - alias: Spisetid klokken er 18:00 Sonos hide_entity: false trigger: - platform: time at: '18:00:00' condition: - condition: and conditions: - condition: time weekday: - sun - mon - tue - wed - thu - fri # Betingelse en af vores børn skal være hjemme - condition: and conditions: - condition: state entity_id: sensor.victoria_presence state: 'home' - condition: or conditions: - condition: state entity_id: sensor.thomas_presence state: 'home' action: - service: script.sonos_say data_template: # group.sonos_players ? sonos_entity: media_player.sonos_koekken, media_player.stue, media_player.sonos_thomas, media_player.sonos_victoria volume: 0.5 message: "Victoria og Thomas Nu er det spisetid klokken er {{ now().strftime('%H %M') }}" delay: '00:00:05'
Another and last issue is how to include the TTS in a card in lovelace like I had it before?
input_text:
announce_sonos:
name: Sonos TTS
initial: Some Text
automation: (THIS DOESN'T WORK...)
# Announce TTS input over Sonos
- alias: Announce TTS Input Over Sonos
hide_entity: true
trigger:
- platform: state
entity_id: input_text.announce_sonos
action:
- service: script.sonos_say
data_template:
sonos_entity: media_player.sonos_koekken
volume: 0.5
message: "{{ states.input_text.announce_sonos.state }}"
delay: '00:00:05'
This worked before but with the new syntax I cant get it working (Above work in progress).
This is actually already there hidden as a standard under the configuration “group.sonos_players” :
But how to get that on the dashboard in a card?
Hope someone can share some light on this?
Maybee even a simpler way of doing this?
Best regards
Casperse