#Script behaving differently under different conditions

1 messages · Page 1 of 1 (latest)

mint gust
#

I have a script to automate my reminders. Now, if I run it in the dev tools, the 2 second gap is just right. But when I run it as part of an automation, there's a large gap of about 6 seconds between the sound playing and the announcement being spoken. Can anyone give me a hint what's going on there?

sequence:
  - action: media_player.play_media
    data:
      media:
        media_content_id: media-source://media_source/local/attention_signal.mp3
        media_content_type: audio/mpeg
    target:
      entity_id:
        - media_player.arbeitszimmer
        - media_player.wohnzimmer
        - media_player.kuche
        - media_player.oberer_flur
        - media_player.badezimmer
        - media_player.waschkuche
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - action: tts.speak
    target:
      entity_id: tts.home_assistant_cloud
    data:
      media_player_entity_id:
        - media_player.arbeitszimmer
        - media_player.kuche
        - media_player.wohnzimmer
        - media_player.oberer_flur
        - media_player.badezimmer
        - media_player.waschkuche
      message: "{{ message }}"
fields:
  message:
    selector:
      text: null
    name: message
    required: true
alias: do_annoucement
description: ""

tawdry cliff
#

If the response 'message' is different, it has to send it to the cloud and generate it and it come back to bw played. If you ask the same message over and over like in a test it probably comes from cache, and only the first one is slower.

mint gust
#

How long does that cache live? It basically makes the same announcement every 20 minutes, and I've not noticed it getting any faster.

mint gust
#

Also, I've found a cache setting in media_player.play_media (which I enabled), but I couldn't find anything similar in tts.speak. Have I overlooked it or does it simply not exist?

sterile bison
#

Like this :

              - data:
                  message: " {{ msg_text }} "
                  language: fr_FR
                  options:
                    voice: fr_FR-siwis-medium
                  cache: false
                  media_player_entity_id: "{{ mediaplayer }}"
                target:
                  entity_id: tts.piper
                action: tts.speak
mint gust
#

Hm, interesting. Looks like we found a little UI bug.
Here's what that looks like in yaml mode:

action: tts.speak
target:
  entity_id: tts.home_assistant_cloud
data:
  media_player_entity_id:
    - media_player.arbeitszimmer
    - media_player.kuche
    - media_player.wohnzimmer
    - media_player.oberer_flur
    - media_player.badezimmer
    - media_player.waschkuche
  message: "{{ message }}"

And here it is in UI mode:

#

Let me put that in and see if it changes anything.

#

Or is it just that cache: true is the default behavior? That'd actually be somewhat strange...

mint gust
#

Ok, I've tested it intensely, and I can't see any pattern. On the one hand, there's one announcement that still uses the old voice from before I reconfigured it, on the other hand, no change was observed since I've added cache: true to all of my routines. There's one sentence it's said every twenty minutes since 9am today, and it's still laggy af.