Speed up automation

Thank you both @Dolores and @WallyR for your contribution! Really appreciate it!

I managed to get the responstime down by removing the delay and moving most of it to “Scripts”.
Furthermore, I added “unjoin” (best practice) but not sure that contributed to a speedier process :slight_smile:

Here is what I ended up with:

doorbell:
  alias: "Sonos doorbell 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: media_player.play_media
     data:
       entity_id: "{{ sonos_entity }}"
       media_content_id: http://192.168.1.48:8123/local/Ringklokke01.mp3
       media_content_type: music
   - delay: "{{ delay }}"
   - service: media_player.volume_set
     data_template:
       entity_id: "{{ sonos_entity }}"
       volume_level: 0.15
   - service: sonos.restore
     data_template:
       entity_id: "{{ sonos_entity }}"
1 Like