Repeate phone notification

Edited:

Hi,

I want to repeate a notification 3 times, with a 3 second delay. The trigger is a dorr button. I’m not good at programming, so I need help shown in my code (I got it from a video …). This code works for one time:

alias: Dörrklocka2
description: ""
triggers:
  - domain: mqtt
    device_id: 994d13e42d14f05fddf40af1b1f1cb47
    type: action
    subtype: single
    trigger: device
conditions: []
actions:
  - action: notify.mobile_app_moto_g35_5g
    metadata: {}
    data:
      message: TTS
      data:
        tts_text: det ringer på dörren
        media_stream: alarm_stream
mode: single

Hello Ralph Utbult,

Can you please fix the code formatting?

Fixed! Didn’t know that I had to use preformatted text …

1 Like

OK, I can understand that.
I assume you would want some kind of time delay between the 3 notifications?

Personally I would switch from a device trigger to a state trigger, then have 3 triggers.

  triggers:
    trigger: state
    entity_id: domain.WhatEverItIs
    to: "on"

    trigger: state
    entity_id: domain.WhatEverItIs
    to: "on"
    for:
      minutes: 2

    trigger: state
    entity_id: domain.WhatEverItIs
    to: "on"
    for:
      minutes: 10

I’m sorry but I don’t understand that code at all. Where do I put my code into that?

You have to determine the entiry_id of the switch and replace the domain.WhatEverItIs placeholder I put in there, then replace the triggers: you have with this triggers: I wrote.

You can and probably should do all that in the UI editor though.

Sorry but that didn’t help at all. Where do I put all my code in your example?

Mainly this:

  • action: notify.mobile_app_moto_g35_5g
    metadata: {}
    data:
    message: TTS
    data:
    tts_text: det ringer på dörren
    media_stream: alarm_stream

Some of you may not like this :slight_smile: I solved it by using delay ‘time’ and repeating the notification code. Not pretty, but it works.

actions:
  - action: notify.mobile_app_moto_g35_5g
    metadata: {}
    data:
      message: TTS
      data:
        tts_text: det ringer på dörren
        media_stream: alarm_stream
  - delay: "00:00:03"
  - action: notify.mobile_app_moto_g35_5g
    metadata: {}
    data:
      message: TTS
      data:
        tts_text: det ringer på dörren
        media_stream: alarm_stream
  - delay: "00:00:03"
  - action: notify.mobile_app_moto_g35_5g
    metadata: {}
    data:
      message: TTS
      data:
        tts_text: det ringer på dörren
        media_stream: alarm_stream
mode: single