Automation delay not reliable

Hi there,

I am using a timer “Add delay” in an automation to ait for 3 minutes before next action is launched, but I do it either wrong, or either this is nor reliable.
See example below, I see in the Automation execution that the timer is launched, but next action is never launched although the 3 minutes are elapsed.
Is it a known issue ?

      - service: persistent_notification.create
        data:
          message: browser_mod est lancé, je lance timer 3 minutes avant de remettre
            sur 30
          title: Dahua_VTO
      - delay:
          hours: 0
          minutes: 3
          seconds: 0
          milliseconds: 0
      - service: persistent_notification.create
        data:
          message: Timer terminé, je remets sur 30
          title: Dahua_VTO
      - service: number.set_value
        data:
          value: '30'
        target:
          entity_id: number.lenovo_tab_m10_plus_3rd_gen_screen_off_timer

First notification is sent, then timer is launched (3 minutes), but after the 3 minutes, the next notification is not coming.
I am sharing my full automation just in case … as you can see I have set a persistant notification at each step to debug.

- id: 4cf62087-4164-4685-be6d-2ede8401d5fa
  alias: Dahua VTO
  trigger:
  - platform: event
    event_type: dahua_vto
    event_data:
      Code: BackKeyLight
  action:
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ trigger.event.data.Data.State | int in [1, 2] }}'
      sequence:
      - service: persistent_notification.create
        data:
          title: '{{ ''Doorbell Ring'' if trigger.event.data.Data.State | int in [1,
            2] else ''Doorbell No Ring'' }}'
          message: '{{ trigger.event.data }}'
      - service: switch.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: switch.lenovo_tab_m10_plus_3rd_gen_screen
      - service: persistent_notification.create
        data:
          title: Dahua_VTO
          message: Allumé l'écran ... je démarre la musique
      - service: media_player.play_media
        target:
          entity_id: media_player.lenovo_tab_m10_plus_3rd_gen
        data:
          media_content_type: music
          media_content_id: http://xxx.be:8123/local/Lili25.mp3
      - service: persistent_notification.create
        data:
          title: Dahua_VTO
          message: Musique démarrée, je mets sur 300
      - service: number.set_value
        data:
          value: '300'
        target:
          entity_id: number.lenovo_tab_m10_plus_3rd_gen_screen_off_timer
        enabled: true
      - service: persistent_notification.create
        data:
          title: Dahua_VTO
          message: Mis sur 300, je lance browser_mod
      - service: browser_mod.popup
        data:
          title: Caméra Extérieure
          dismissable: false
          content:
            camera_view: live
            type: picture-glance
            entities: []
            camera_image: camera.192_168_1_110
          timeout: 120000
          size: fullscreen
          browser_id:
          - Lenovo-tablette
          right_button: Raccrocher
          right_button_action:
            service: media_player.media_stop
            data:
              entity_id: media_player.lenovo_tab_m10_plus_3rd_gen
          left_button: Laisser vidéo 5m
          left_button_action:
            service: browser_mod.sequence
            data:
              sequence:
              - service: browser_mod.popup
                data:
                  title: Caméra Extérieure
                  dismissable: true
                  content:
                    camera_view: live
                    type: picture-glance
                    entities: []
                    camera_image: camera.192_168_1_110
                  timeout: 300000
                  size: fullscreen
                  browser_id:
                  - Lenovo-tablette
              - service: media_player.media_stop
                data:
                  entity_id: media_player.lenovo_tab_m10_plus_3rd_gen
      - service: persistent_notification.create
        data:
          message: browser_mod est lancé, je lance timer 3 minutes avant de remettre
            sur 30
          title: Dahua_VTO
      - delay:
          hours: 0
          minutes: 3
          seconds: 0
          milliseconds: 0
      - service: persistent_notification.create
        data:
          message: Timer terminé, je remets sur 30
          title: Dahua_VTO
      - service: number.set_value
        data:
          value: '30'
        target:
          entity_id: number.lenovo_tab_m10_plus_3rd_gen_screen_off_timer
      - service: persistent_notification.create
        data:
          title: Dahua_VTO
          message: Remis sur 30, tout est fini
  mode: restart

If the trigger occurs again it will interrupt the delay and restart the automation.

Thanks a lot, I have ahcnge my automation in this way, and seems ok now.
Please note I have also adapted the “condition” with a default section, and the queued parameter at the end of the automation, instead of the “restart

- id: 4cf62087-4164-4685-be6d-2ede8401d5fa
  alias: Dahua VTO
  trigger:
  - platform: event
    event_type: dahua_vto
    event_data:
      Code: BackKeyLight
  action:
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ trigger.event.data.Data.State | int in [1, 2] }}'
      sequence:
      - service: persistent_notification.create
        data:
          title: '{{ ''Doorbell Ring'' if trigger.event.data.Data.State | int in [1,
            2] else ''Doorbell No Ring'' }}'
          message: '{{ trigger.event.data }}'
      - service: switch.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: switch.lenovo_tab_m10_plus_3rd_gen_screen
      - service: persistent_notification.create
        data:
          title: Dahua_VTO
          message: Allumé l'écran ... je démarre un timer de 3 secondes
      - delay:
          hours: 0
          minutes: 0
          seconds: 3
          milliseconds: 0
      - service: persistent_notification.create
        data:
          title: Dahua_VTO
          message: Timer terminé, je lance la musique
      - service: media_player.play_media
        target:
          entity_id: media_player.lenovo_tab_m10_plus_3rd_gen
        data:
          media_content_type: music
          media_content_id: http://cedricdelecole.be:8123/local/Lili25.mp3
      - service: persistent_notification.create
        data:
          title: Dahua_VTO
          message: Musique démarrée, je mets sur 300
      - service: number.set_value
        data:
          value: '300'
        target:
          entity_id: number.lenovo_tab_m10_plus_3rd_gen_screen_off_timer
        enabled: true
      - service: persistent_notification.create
        data:
          title: Dahua_VTO
          message: Mis sur 300, je démarre popup
      - service: browser_mod.popup
        data:
          title: Caméra Extérieure
          dismissable: false
          content:
            camera_view: live
            type: picture-glance
            entities: []
            camera_image: camera.192_168_1_110
          timeout: 120000
          size: fullscreen
          browser_id:
          - Lenovo-tablette
          right_button: Raccrocher
          right_button_action:
            service: media_player.media_stop
            data:
              entity_id: media_player.lenovo_tab_m10_plus_3rd_gen
          left_button: Laisser vidéo 5m
          left_button_action:
            service: browser_mod.sequence
            data:
              sequence:
              - service: browser_mod.popup
                data:
                  title: Caméra Extérieure
                  dismissable: true
                  content:
                    camera_view: live
                    type: picture-glance
                    entities: []
                    camera_image: camera.192_168_1_110
                  timeout: 300000
                  size: fullscreen
                  browser_id:
                  - Lenovo-tablette
              - service: media_player.media_stop
                data:
                  entity_id: media_player.lenovo_tab_m10_plus_3rd_gen
      - service: persistent_notification.create
        data:
          message: browser_mod est lancé, je lance timer 3 minutes avant de remettre
            sur 30
          title: Dahua_VTO
      - delay:
          hours: 0
          minutes: 3
          seconds: 0
          milliseconds: 0
      - service: persistent_notification.create
        data:
          message: Timer terminé, je remets sur 30
          title: Dahua_VTO
      - service: number.set_value
        data:
          value: '30'
        target:
          entity_id: number.lenovo_tab_m10_plus_3rd_gen_screen_off_timer
      - service: persistent_notification.create
        data:
          title: Dahua_VTO
          message: Remis sur 30, tout est fini
    - conditions:
      - condition: template
        value_template: '{{ trigger.event.data.Data.State | int == 6 }}

          '
      sequence:
      - service: persistent_notification.create
        data:
          title: Dahua_VTO - Not answered - type 6
          message: '{{ trigger.event.data }}'
    default:
    - service: persistent_notification.create
      data:
        title: Unknown state {{ trigger.event.data.Data.State | int }}
        message: '{{ trigger.event.data }}'
  mode: queued

What kind of integration are you using to make your Lenovo tablet into a media player?

I assume you are using browser_mod for that purpose.

Title updated from “Automation timer not reliable” as this isn’t a timer issue.

No, I think it is using Fully Kiosk Browser :

 - service: media_player.play_media
        target:
          entity_id: media_player.lenovo_tab_m10_plus_3rd_gen
        data:
          media_content_type: music
          media_content_id: http://cedricdelecole.be:8123/local/Lili25.mp3

That’s interesting because browser_mod can also create a media_player entity:

I saw this message in your automation and assumed that you were also using browser_mod’s media_player.

no no
:slight_smile:

This post has been solved as issue was the automation “restart” / “queue” / … parameter issue.
Thank you !