Zigbee "wait for trigger" fails

Hello, this is my first post here and I apologize if I am not providing enough information or the correct terminology for you to clearly understand my question/problem.

I’m still new to HA and have been using it for the better part of four months now. I set up a number of automations and they were working fine until this week when all that involved Zigbee devices started failing.
I could trace the problem to the “Wait for trigger” function in the automations. Even though the conditions are met, the automation does not continue past that point and just keeps waiting as if they weren’t.
(e.g. “Send message when dryer power draw goes to 0.” or “Close shutters when sensor reports less than 10 lux” etc.)

I did rename a lot of my devices recently in an attempt to unify my naming scheme in preparation for a bigger “roll-out”, but I have adjusted all the entities after that and they look ok to me.

Zigbee itself seems fine as well as all the sensors involved are constantly sending data and I can manually trigger every step as well as manage all my devices. (With the exception of a Zigbee dimmer switch that completely failed right around the same time but I assume that the hardware died in that case.)

I’m running the latest version of HA (and of all the plugins/integrations etc.) directly on an Odroid-C4 with plenty of RAM to spare and the data files on an external SSD; also with lots of space left.

Any help is appreciated, as I have now tried everything (I can think of) short of deleting the automations and starting over again completely.
If there’s any more information required, I’ll be happy to provide it.

Thank you!

Post the automation, in YAML format, that exhibits the problem. Ensure you format it properly.

1 Like
alias: Rollläden zu – Standard
description: Rollläden schließen abhängig von Sonnenuntergang und Helligkeit
trigger:
  - platform: sun
    event: sunset
    offset: "-01:00:00"
condition:
  - condition: state
    entity_id: input_boolean.urlaub
    state: "off"
action:
  - wait_for_trigger:
      - platform: numeric_state
        entity_id:
          - sensor.eg_eingang_zb_hue_sensor_beleuchtungsstarke
        below: 15
  - choose:
      - conditions:
          - type: is_temperature
            condition: device
            device_id: 4a91e9d25b1a22a3b3c7d749ad9efd1c
            entity_id: 1ede8abe62a56e31efbc86cba6920b08
            domain: sensor
            above: 10.1
        sequence:
          - parallel:
              - device_id: 2ff9398b81fe3d185f4ca740f50d5f7b
                domain: cover
                entity_id: b5ec7ba5628aa63f48c414ada92d3bee
                type: set_position
                position: 40
              - device_id: 4cc9d69df2dea1b00a9fea2b1e0334ca
                domain: cover
                entity_id: 6c58dc3b3a2c8a036324e8757394ef5d
                type: set_position
                position: 70
              - alias: Schließe Kinderzimmer
                device_id: 0443a659366fa5665f7c18cfe7c993cd
                domain: cover
                entity_id: eb1fd18d05385b71f44fbab2dc114655
                type: close
          - wait_for_trigger:
              - type: temperature
                platform: device
                device_id: 4a91e9d25b1a22a3b3c7d749ad9efd1c
                entity_id: 1ede8abe62a56e31efbc86cba6920b08
                domain: sensor
                below: 10
            continue_on_timeout: false
            timeout:
              hours: 14
              minutes: 0
              seconds: 0
              milliseconds: 0
          - parallel:
              - device_id: 4cc9d69df2dea1b00a9fea2b1e0334ca
                domain: cover
                entity_id: 6c58dc3b3a2c8a036324e8757394ef5d
                type: set_position
                position: 30
              - device_id: 2ff9398b81fe3d185f4ca740f50d5f7b
                domain: cover
                entity_id: b5ec7ba5628aa63f48c414ada92d3bee
                type: set_position
                position: 25
      - conditions:
          - type: is_temperature
            condition: device
            device_id: 4a91e9d25b1a22a3b3c7d749ad9efd1c
            entity_id: 1ede8abe62a56e31efbc86cba6920b08
            domain: sensor
            below: 10
        sequence:
          - parallel:
              - device_id: 2ff9398b81fe3d185f4ca740f50d5f7b
                domain: cover
                entity_id: b5ec7ba5628aa63f48c414ada92d3bee
                type: set_position
                position: 20
              - device_id: 4cc9d69df2dea1b00a9fea2b1e0334ca
                domain: cover
                entity_id: 6c58dc3b3a2c8a036324e8757394ef5d
                type: set_position
                position: 30
              - alias: Schließe Kinderzimmer
                device_id: 0443a659366fa5665f7c18cfe7c993cd
                domain: cover
                entity_id: ddf8044bfd1b8b3c77401bdcbe9d2afa
                type: close
mode: single

Thank you for taking an interest!
I hope, I did that right.
There’s quite a bit going on, but the “wait for trigger” is right near the top.

This worked really well until earlier this week. I’m still not sure if it was caused by my renaming of the sensors, which was my first guess, but I re-added all of them with the new names without fixing the problem.

A little bit of background as to what this automation is supposed to do:
I found that linking the closing of the shutters to sundown yielded non-optimal results as they would still be open when it was already really dark on rainy days. So I added a brightness sensor (Philips Hue outdoor motion detector) into the mix to cause the shutters to close whenever there were less than 15 Lux around sundown.

Similar automations with Zigbee sockets should inform me when the dryer (or washer) stopped drawing power signalling that the laundry was ready.

One issue with using a Wait for trigger in this way is that the illumination must go from >=15 to below 15 after the the sunset trigger. If the light level is below 15 when the sunset trigger fires and stays below 15, the automation sits in a wait indefinitely. Since the automation’s mode is set to single and there is no timeout on the wait, it could conceivably wait a whole day.

Using a Wait template would avoid this issue since the wait would finish immediately in the case described above.

If the light level is such a deciding factor, it may be more appropriate to remove the wait completely, add the light level as a trigger and mirror both triggers in the general condition block. Something like the following:

trigger:
  - platform: sun
    event: sunset
    offset: "-01:00:00"
  - platform: numeric_state
    entity_id:  sensor.eg_eingang_zb_hue_sensor_beleuchtungsstarke
    below: 15
condition:
  - condition: numeric_state
    entity_id: sun.sun
    attribute: elevation
    below: 8
  - condition: numeric_state
    entity_id: sensor.eg_eingang_zb_hue_sensor_beleuchtungsstarke
    below: 15
  - condition: state
    entity_id: input_boolean.urlaub
    state: "off"
action:
  - choose:
....
1 Like

Thank you for your feedback! That looks very promising.

I’ll be sure to try it and I will also look into the “wait template”. I hadn’t heard about that before but just going by the name it might be what I’m looking for.

(Still not sure what happened, though. The automation was working exactly as I wanted it until it suddenly didn’t…)

Post the automation’s trace file that was produced when the automation failed at the wait_for_trigger.

If you still have a trace file available for when it did work, post that as well.

Thank you for your interest!
I’m afraid I don’t have any of the old ones, but this is the latest attempt based on the feedback I received. It triggered at “Lux 15” but then failed the “wait for Lux 15” check as the next step and got stuck there same as before.
(I probably should have removed that check, but figured that since it triggers at this value it should just fly past. I’ve since removed it but obviously need to wait another 24 hours to see if that did the trick. All the while still not understanding why it starting failing in the first place…)

{
  "trace": {
    "last_step": "action/0",
    "run_id": "4ec4005c3d83c6a52797c2e73f395cb5",
    "state": "stopped",
    "script_execution": "cancelled",
    "timestamp": {
      "start": "2024-02-25T16:58:40.496532+00:00",
      "finish": "2024-02-25T16:59:52.998123+00:00"
    },
    "domain": "automation",
    "item_id": "1695550624418",
    "trigger": "numeric state of sensor.eg_eingang_zb_hue_sensor_beleuchtungsstarke",
    "trace": {
      "trigger/1": [
        {
          "path": "trigger/1",
          "timestamp": "2024-02-25T16:58:40.496710+00:00",
          "changed_variables": {
            "this": {
              "entity_id": "automation.sonnenuntergang",
              "state": "on",
              "attributes": {
                "id": "1695550624418",
                "last_triggered": "2024-02-24T18:30:58.164372+00:00",
                "mode": "single",
                "current": 0,
                "friendly_name": "Rollläden zu – Standard"
              },
              "last_changed": "2024-02-25T07:51:50.310636+00:00",
              "last_updated": "2024-02-25T07:51:50.310636+00:00",
              "context": {
                "id": "01HQFKZCS6RT3FW2NRPT79TSN5",
                "parent_id": null,
                "user_id": null
              }
            },
            "trigger": {
              "id": "1",
              "idx": "1",
              "alias": null,
              "platform": "numeric_state",
              "entity_id": "sensor.eg_eingang_zb_hue_sensor_beleuchtungsstarke",
              "below": 15,
              "above": null,
              "from_state": {
                "entity_id": "sensor.eg_eingang_zb_hue_sensor_beleuchtungsstarke",
                "state": "17",
                "attributes": {
                  "state_class": "measurement",
                  "unit_of_measurement": "lx",
                  "device_class": "illuminance",
                  "friendly_name": "EG_Eingang_ZB_Hue_Sensor Beleuchtungsstärke"
                },
                "last_changed": "2024-02-25T16:53:31.236621+00:00",
                "last_updated": "2024-02-25T16:53:31.236621+00:00",
                "context": {
                  "id": "01HQGJZ7Z4V5Q09CPY6XC580WT",
                  "parent_id": null,
                  "user_id": null
                }
              },
              "to_state": {
                "entity_id": "sensor.eg_eingang_zb_hue_sensor_beleuchtungsstarke",
                "state": "11",
                "attributes": {
                  "state_class": "measurement",
                  "unit_of_measurement": "lx",
                  "device_class": "illuminance",
                  "friendly_name": "EG_Eingang_ZB_Hue_Sensor Beleuchtungsstärke"
                },
                "last_changed": "2024-02-25T16:58:40.487894+00:00",
                "last_updated": "2024-02-25T16:58:40.487894+00:00",
                "context": {
                  "id": "01HQGK8NZ7G0WTWA9A233BN6PY",
                  "parent_id": null,
                  "user_id": null
                }
              },
              "for": null,
              "description": "numeric state of sensor.eg_eingang_zb_hue_sensor_beleuchtungsstarke"
            }
          }
        }
      ],
      "condition/0": [
        {
          "path": "condition/0",
          "timestamp": "2024-02-25T16:58:40.496820+00:00",
          "result": {
            "result": true
          }
        }
      ],
      "condition/0/entity_id/0": [
        {
          "path": "condition/0/entity_id/0",
          "timestamp": "2024-02-25T16:58:40.496917+00:00",
          "result": {
            "result": true,
            "state": 0.08
          }
        }
      ],
      "condition/1": [
        {
          "path": "condition/1",
          "timestamp": "2024-02-25T16:58:40.497139+00:00",
          "result": {
            "result": true
          }
        }
      ],
      "condition/1/entity_id/0": [
        {
          "path": "condition/1/entity_id/0",
          "timestamp": "2024-02-25T16:58:40.497244+00:00",
          "result": {
            "result": true,
            "state": 11
          }
        }
      ],
      "condition/2": [
        {
          "path": "condition/2",
          "timestamp": "2024-02-25T16:58:40.497477+00:00",
          "result": {
            "result": true
          }
        }
      ],
      "condition/2/entity_id/0": [
        {
          "path": "condition/2/entity_id/0",
          "timestamp": "2024-02-25T16:58:40.497618+00:00",
          "result": {
            "result": true,
            "state": "off",
            "wanted_state": "off"
          }
        }
      ],
      "action/0": [
        {
          "path": "action/0",
          "timestamp": "2024-02-25T16:58:40.507092+00:00",
          "changed_variables": {
            "context": {
              "id": "01HQGK8NZGW4WY1X89NM2PKAW5",
              "parent_id": "01HQGK8NZ7G0WTWA9A233BN6PY",
              "user_id": null
            },
            "wait": {
              "remaining": null,
              "trigger": null
            }
          },
          "result": {
            "result": true,
            "state": 11
          }
        }
      ]
    },
    "config": {
      "id": "1695550624418",
      "alias": "Rollläden zu – Standard",
      "description": "Rollläden schließen abhängig von Sonnenuntergang und Helligkeit",
      "trigger": [
        {
          "platform": "sun",
          "event": "sunset",
          "offset": "-01:00:00"
        },
        {
          "platform": "numeric_state",
          "entity_id": "sensor.eg_eingang_zb_hue_sensor_beleuchtungsstarke",
          "below": 15
        }
      ],
      "condition": [
        {
          "condition": "numeric_state",
          "entity_id": "sun.sun",
          "attribute": "elevation",
          "below": 8
        },
        {
          "condition": "numeric_state",
          "entity_id": "sensor.eg_eingang_zb_hue_sensor_beleuchtungsstarke",
          "below": 15
        },
        {
          "condition": "state",
          "entity_id": "input_boolean.urlaub",
          "state": "off"
        }
      ],
      "action": [
        {
          "wait_for_trigger": [
            {
              "platform": "numeric_state",
              "entity_id": [
                "sensor.eg_eingang_zb_hue_sensor_beleuchtungsstarke"
              ],
              "below": 15
            }
          ]
        },
        {
          "choose": [
            {
              "conditions": [
                {
                  "type": "is_temperature",
                  "condition": "device",
                  "device_id": "4a91e9d25b1a22a3b3c7d749ad9efd1c",
                  "entity_id": "1ede8abe62a56e31efbc86cba6920b08",
                  "domain": "sensor",
                  "above": 10.1
                }
              ],
              "sequence": [
                {
                  "parallel": [
                    {
                      "device_id": "2ff9398b81fe3d185f4ca740f50d5f7b",
                      "domain": "cover",
                      "entity_id": "b5ec7ba5628aa63f48c414ada92d3bee",
                      "type": "set_position",
                      "position": 40
                    },
                    {
                      "device_id": "4cc9d69df2dea1b00a9fea2b1e0334ca",
                      "domain": "cover",
                      "entity_id": "6c58dc3b3a2c8a036324e8757394ef5d",
                      "type": "set_position",
                      "position": 70
                    },
                    {
                      "alias": "Schließe Kinderzimmer",
                      "device_id": "0443a659366fa5665f7c18cfe7c993cd",
                      "domain": "cover",
                      "entity_id": "eb1fd18d05385b71f44fbab2dc114655",
                      "type": "close"
                    }
                  ]
                },
                {
                  "wait_for_trigger": [
                    {
                      "type": "temperature",
                      "platform": "device",
                      "device_id": "4a91e9d25b1a22a3b3c7d749ad9efd1c",
                      "entity_id": "1ede8abe62a56e31efbc86cba6920b08",
                      "domain": "sensor",
                      "below": 10
                    }
                  ],
                  "continue_on_timeout": false,
                  "timeout": {
                    "hours": 14,
                    "minutes": 0,
                    "seconds": 0,
                    "milliseconds": 0
                  }
                },
                {
                  "parallel": [
                    {
                      "device_id": "4cc9d69df2dea1b00a9fea2b1e0334ca",
                      "domain": "cover",
                      "entity_id": "6c58dc3b3a2c8a036324e8757394ef5d",
                      "type": "set_position",
                      "position": 30
                    },
                    {
                      "device_id": "2ff9398b81fe3d185f4ca740f50d5f7b",
                      "domain": "cover",
                      "entity_id": "b5ec7ba5628aa63f48c414ada92d3bee",
                      "type": "set_position",
                      "position": 25
                    }
                  ]
                }
              ]
            },
            {
              "conditions": [
                {
                  "type": "is_temperature",
                  "condition": "device",
                  "device_id": "4a91e9d25b1a22a3b3c7d749ad9efd1c",
                  "entity_id": "1ede8abe62a56e31efbc86cba6920b08",
                  "domain": "sensor",
                  "below": 10
                }
              ],
              "sequence": [
                {
                  "parallel": [
                    {
                      "device_id": "2ff9398b81fe3d185f4ca740f50d5f7b",
                      "domain": "cover",
                      "entity_id": "b5ec7ba5628aa63f48c414ada92d3bee",
                      "type": "set_position",
                      "position": 20
                    },
                    {
                      "device_id": "4cc9d69df2dea1b00a9fea2b1e0334ca",
                      "domain": "cover",
                      "entity_id": "6c58dc3b3a2c8a036324e8757394ef5d",
                      "type": "set_position",
                      "position": 30
                    },
                    {
                      "alias": "Schließe Kinderzimmer",
                      "device_id": "0443a659366fa5665f7c18cfe7c993cd",
                      "domain": "cover",
                      "entity_id": "ddf8044bfd1b8b3c77401bdcbe9d2afa",
                      "type": "close"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "mode": "single"
    },
    "blueprint_inputs": null,
    "context": {
      "id": "01HQGK8NZGW4WY1X89NM2PKAW5",
      "parent_id": "01HQGK8NZ7G0WTWA9A233BN6PY",
      "user_id": null
    }
  },
  "logbookEntries": [
    {
      "name": "Rollläden zu – Standard",
      "message": "triggered by numeric state of sensor.eg_eingang_zb_hue_sensor_beleuchtungsstarke",
      "source": "numeric state of sensor.eg_eingang_zb_hue_sensor_beleuchtungsstarke",
      "entity_id": "automation.sonnenuntergang",
      "context_id": "01HQGK8NZGW4WY1X89NM2PKAW5",
      "when": 1708880320.498113,
      "domain": "automation"
    }
  ]
}```