Delay not working as expected

Using Phillips Dimmer - 324131137411 Legacy FALSE Hue Dimmer blueprint.

Setup device in Z2M - Legacy mode and the blueprint is working.

I want to do the following.

Press button

Light on

Wait 20 minutes

Light off

Using Delay for 20 minutes - this does not work. I have checked why not and I can’t quite get it. I have also tried 10 seconds for testing.

What am I missing - I can’t see it. Surely delay should “delay” the sequence…

Using HA

  • Core2024.5.5
  • Supervisor2024.05.1
  • Operating System12.3
  • Frontend20240501.1

Please follow the Community Guidelines and share the actual script or automation configuration you are using, as well as any other relevant information such as a direct link to the blueprint you are using…

alias: Scentsy Control 1
description: ""
use_blueprint:
  path: husnainali09/hue_dimmer_blueprint.yaml
  input:
    dimmer: sensor.scentsy_control_1_action
    button_1:
      - type: turn_on
        device_id: 6d7660806412cddf08f25bc22226a0a2
        entity_id: d0b189261b025fc1b3d23b9ed64189b7
        domain: switch
      - delay:
          hours: 2
          minutes: 0
          seconds: 0
          milliseconds: 0
      - type: turn_off
        device_id: 6d7660806412cddf08f25bc22226a0a2
        entity_id: d0b189261b025fc1b3d23b9ed64189b7
        domain: switch
    button_2:
      - type: turn_on
        device_id: c731f485415edf65a1c74c7760b83f25
        entity_id: 9a36444d80c2344499dfa051949a61b5
        domain: switch
      - wait_for_trigger: []
        timeout:
          hours: 2
          minutes: 0
          seconds: 0
          milliseconds: 0
      - type: turn_off
        device_id: c731f485415edf65a1c74c7760b83f25
        entity_id: 9a36444d80c2344499dfa051949a61b5
        domain: switch
    button_6:
      - type: turn_off
        device_id: c731f485415edf65a1c74c7760b83f25
        entity_id: 9a36444d80c2344499dfa051949a61b5
        domain: switch
    button_4:
      - type: turn_on
        device_id: 52060d2e7145ed1e3254f1a5f06ac0a0
        entity_id: b23c66d9a370c316fff346f78ecc0cf1
        domain: switch
    button_3:
      - type: turn_on
        device_id: 0b02a70f2cd6b734da51cff8f2b36a1e
        entity_id: 64e3f6968ff21079dd6204f1e1567ae2
        domain: switch
      - wait_for_trigger:
          - platform: device
            type: turned_on
            device_id: 52060d2e7145ed1e3254f1a5f06ac0a0
            entity_id: b23c66d9a370c316fff346f78ecc0cf1
            domain: switch
            for:
              hours: 0
              minutes: 0
              seconds: 10
        timeout:
          hours: 0
          minutes: 0
          seconds: 0
          milliseconds: 0
      - type: turn_off
        device_id: 52060d2e7145ed1e3254f1a5f06ac0a0
        entity_id: b23c66d9a370c316fff346f78ecc0cf1
        domain: switch
    button_5:
      - type: turn_off
        device_id: 6d7660806412cddf08f25bc22226a0a2
        entity_id: d0b189261b025fc1b3d23b9ed64189b7
        domain: switch
    button_7:
      - type: turn_off
        device_id: 0b02a70f2cd6b734da51cff8f2b36a1e
        entity_id: 64e3f6968ff21079dd6204f1e1567ae2
        domain: switch
    button_8:
      - type: turn_off
        device_id: 52060d2e7145ed1e3254f1a5f06ac0a0
        entity_id: b23c66d9a370c316fff346f78ecc0cf1
        domain: switch

The top “button one” is one that it not working as expected. I have been playing with other options to try to get this to work.

Link to Blueprint - Zigbee2MQTT - Phillips Hue Dimmer 324131137411

Prolonged delays are usually a bad idea since they do not survive Home Assistant restart or reloading the automation configuration. That is being exacerbated in this case because the blueprint has set the mode to restart. That means if you use the button at all during the 2 hour delay, the “run” of the automation that is waiting will cancel itself and a new “run” will start for the more recent button press event.

A better method for the desired function would be to have the actions for button_1 turn on the light then start a 2 hour timer; and have a second automation that is triggered by the timer finishing which turns off the light.

That makes more sense. Thank you.