Script repeat siren sound

Hello, I see several threads have already been opened for this but who can tell what is wrong with the script below? The sound does not repeat and stops after 8 seconds. Thanks.

You did not specify a duration for your time out, so it’s defaulting to 0 wait.

Thanks for your response. It still does not work after adding the duration of the time out. The script also stops after 1 playback.

Post the actual YAML text, not screenshots of YAML(see FAQ guideline 14).

Users can copy the YAML text, correct it, and post it back for your use. We can’t do that do that if you post a screenshot.

Check the script’s trace and it’ll show you why it behaves like it does.

Sorry I haven’t figured out exactly how that works yet. I can’t upload the trace report .json file that’s why I include screenshots. Perhaps you will notice the error right away.


Your repeat is designed to exit when the state of the alarm panel is disarmed. According to the “Step Details”, it got the value it wants (disarmed) after just one iteration of repeat.

ity_id/0
result: true
state: disarmed
wanted_state: disarmed

Having the complete trace file would be better. Just copy-paste it and ensure its formatting is maintained. Refer to FAQ Guideline 11 - Format it properly.

Is this going so well?

```{
  "trace": {
    "last_step": "sequence/1/repeat/sequence/1",
    "run_id": "4be6d99e87a9148696745a71dcf3875f",
    "state": "running",
    "script_execution": null,
    "timestamp": {
      "start": "2023-12-03T13:40:44.964623+00:00",
      "finish": null
    },
    "domain": "script",
    "item_id": "sirene",
    "trace": {
      "sequence/0": [
        {
          "path": "sequence/0",
          "timestamp": "2023-12-03T13:40:44.968683+00:00",
          "changed_variables": {
            "this": {
              "entity_id": "script.sirene",
              "state": "off",
              "attributes": {
                "last_triggered": "2023-12-03T13:34:58.547713+00:00",
                "mode": "single",
                "current": 0,
                "friendly_name": "Sirene kantoor"
              },
              "last_changed": "2023-12-03T13:40:28.915592+00:00",
              "last_updated": "2023-12-03T13:40:28.915592+00:00",
              "context": {
                "id": "01HGQYHD3KHJF6Y37Y6FQVQR0M",
                "parent_id": null,
                "user_id": null
              }
            },
            "context": {
              "id": "01HGQYHWS48JBNJHAJNNKY0PJC",
              "parent_id": null,
              "user_id": "6d6836e7eafb47e3827ac8eb3c9b4d02"
            }
          },
          "result": {
            "params": {
              "domain": "media_player",
              "service": "volume_set",
              "service_data": {
                "volume_level": 0.37,
                "entity_id": [
                  "media_player.kantoor"
                ]
              },
              "target": {
                "entity_id": [
                  "media_player.kantoor"
                ]
              }
            },
            "running_script": false
          }
        }
      ],
      "sequence/1": [
        {
          "path": "sequence/1",
          "timestamp": "2023-12-03T13:40:44.997088+00:00"
        }
      ],
      "sequence/1/repeat/sequence/0": [
        {
          "path": "sequence/1/repeat/sequence/0",
          "timestamp": "2023-12-03T13:40:44.998036+00:00",
          "changed_variables": {
            "repeat": {
              "first": true,
              "index": 1
            }
          },
          "result": {
            "params": {
              "domain": "media_player",
              "service": "play_media",
              "service_data": {
                "media_content_id": "media-source://media_source/local/mixkit-alert-alarm-1005.wav",
                "media_content_type": "audio/x-wav",
                "entity_id": [
                  "media_player.kantoor"
                ]
              },
              "target": {
                "entity_id": [
                  "media_player.kantoor"
                ]
              }
            },
            "running_script": false
          }
        }
      ],
      "sequence/1/repeat/sequence/1": [
        {
          "path": "sequence/1/repeat/sequence/1",
          "timestamp": "2023-12-03T13:40:45.063821+00:00",
          "result": {
            "wait": {
              "remaining": 8,
              "completed": false
            }
          }
        }
      ]
    },
    "config": {
      "alias": "Sirene kantoor",
      "sequence": [
        {
          "service": "media_player.volume_set",
          "data": {
            "volume_level": 0.37
          },
          "target": {
            "entity_id": "media_player.kantoor"
          }
        },
        {
          "repeat": {
            "sequence": [
              {
                "service": "media_player.play_media",
                "target": {
                  "entity_id": "media_player.kantoor"
                },
                "data": {
                  "media_content_id": "media-source://media_source/local/mixkit-alert-alarm-1005.wav",
                  "media_content_type": "audio/x-wav"
                },
                "metadata": {
                  "title": "mixkit-alert-alarm-1005.wav",
                  "thumbnail": null,
                  "media_class": "music",
                  "children_media_class": null,
                  "navigateIds": [
                    {},
                    {
                      "media_content_type": "app",
                      "media_content_id": "media-source://media_source"
                    }
                  ]
                }
              },
              {
                "wait_template": "{{ is_state(\"media_player.kantoor\", \"idle\") }} ",
                "continue_on_timeout": true,
                "enabled": true,
                "timeout": "8"
              }
            ],
            "until": [
              {
                "condition": "state",
                "entity_id": "alarm_control_panel.alarmo",
                "state": "disarmed"
              }
            ]
          },
          "enabled": true
        }
      ],
      "mode": "single"
    },
    "blueprint_inputs": null,
    "context": {
      "id": "01HGQYHWS48JBNJHAJNNKY0PJC",
      "parent_id": null,
      "user_id": "6d6836e7eafb47e3827ac8eb3c9b4d02"
    }
  },
  "logbookEntries": [
    {
      "when": 1701610844.965102,
      "state": "on",
      "entity_id": "script.sirene",
      "context_user_id": "6d6836e7eafb47e3827ac8eb3c9b4d02"
    },
    {
      "when": 1701610845.190402,
      "state": "playing",
      "entity_id": "media_player.kantoor",
      "context_user_id": "6d6836e7eafb47e3827ac8eb3c9b4d02",
      "context_state": "on",
      "context_entity_id": "script.sirene"
    }
  ]
}