On-the-fly Scene not restoring

Hello all,

I’m seeking some help because seemingly I’m going insane here.
I have an automation to “flash” a lightstrip red for 1s whenever the door opens.
The scene it calls is basically just a red color and on state for the ledstrip.

For some reason, just randomly on the 1st, 2nd, 3rd or 5th or 10th trigger, the automation just doesn’t work/restore the light to the previous state.

I’ve tried setting a delay after creating the scene, I’ve tried creating setting a delay before resetting, I’ve tried deleting the scene at the end of the automation, I feel like I’ve tried everything. This happens both when triggering manually and when triggering via sensor.

Here is my automation config:

alias: Office Door Opens
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.office3_office_door
    from: "off"
    to: "on"
condition: []
action:
  - service: scene.create
    data:
      scene_id: officebefore
      snapshot_entities:
        - light.yeelight_stripe_0x0000000005e303b9
  - delay:
      milliseconds: 50
  - service: scene.turn_on
    metadata: {}
    target:
      entity_id: scene.officedooropen
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - service: scene.turn_on
    target:
      entity_id: scene.officebefore
    data: {}
  - delay:
      milliseconds: 250
  - service: scene.delete
    target:
      entity_id: scene.officebefore
    data: {}
mode: single

The most stripped down config I started with which also has this issue:

alias: Office Door Opens
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.office3_office_door
    from: "off"
    to: "on"
condition: []
action:
  - service: scene.create
    data:
      scene_id: officebefore
      snapshot_entities:
        - light.yeelight_stripe_0x0000000005e303b9
  - service: scene.turn_on
    metadata: {}
    target:
      entity_id: scene.officedooropen
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - service: scene.turn_on
    target:
      entity_id: scene.officebefore
    data: {}
mode: single

Any idea what I’m doing wrong or what could be the issue?

What does the trace tell you?

Are there errors in your log?

Sadly, the traces are exactly identical whether the automation completes successfully or not. I’ve been staring at the traces for hours and comparing each and every one of them with all the little changes but they are all the same. In the eyes of HA the automation always completes successfully and has the same output…

And no errors in the logs at all.

Post the traces. :wink:

My guess would be, it’s not enough time. You fire the scene changes practically while the first scene is created. But just a guess!

I’d try it with a wait_template or a delay between the different scenes. wait_template seems the better way, but not tested.

As an experiment, replace scene.officedooropen with the actual command(s) to turn on the light and set its color to red. In other words, remove the scene “middleman” and allow the automation to control the light directly. See if it makes any difference.

1 Like

Here are the traces for the automation as it is above:

worked
{
  "trace": {
    "last_step": "action/6",
    "run_id": "5bf689faa2229ad6e189ebd4a84fb1df",
    "state": "stopped",
    "script_execution": "finished",
    "timestamp": {
      "start": "2024-04-18T13:20:31.333276+00:00",
      "finish": "2024-04-18T13:20:32.678248+00:00"
    },
    "domain": "automation",
    "item_id": "1713311337778",
    "trigger": null,
    "trace": {
      "trigger": [
        {
          "path": "trigger",
          "timestamp": "2024-04-18T13:20:31.333346+00:00",
          "changed_variables": {
            "this": {
              "entity_id": "automation.office_door_opens",
              "state": "on",
              "attributes": {
                "id": "1713311337778",
                "last_triggered": "2024-04-18T13:19:35.312369+00:00",
                "mode": "single",
                "current": 0,
                "friendly_name": "Office Door Opens"
              },
              "last_changed": "2024-04-18T12:13:12.728225+00:00",
              "last_reported": "2024-04-18T13:19:36.645246+00:00",
              "last_updated": "2024-04-18T13:19:36.645246+00:00",
              "context": {
                "id": "01HVRNSKWG3NE1Y4PVY8MDFV6X",
                "parent_id": "01HVRNSKWFP0C3G9XZRW81ZWQD",
                "user_id": null
              }
            },
            "trigger": {
              "platform": null
            }
          }
        }
      ],
      "action/0": [
        {
          "path": "action/0",
          "timestamp": "2024-04-18T13:20:31.333856+00:00",
          "changed_variables": {
            "context": {
              "id": "01HVRNVAK5T26JJ0PBHWY8ZCE1",
              "parent_id": "01HVRNVAK4K68998HSW9A9HE6Q",
              "user_id": null
            }
          },
          "result": {
            "params": {
              "domain": "scene",
              "service": "create",
              "service_data": {
                "scene_id": "officebefore",
                "snapshot_entities": [
                  "light.yeelight_stripe_0x0000000005e303b9"
                ]
              },
              "target": {}
            },
            "running_script": false
          }
        }
      ],
      "action/1": [
        {
          "path": "action/1",
          "timestamp": "2024-04-18T13:20:31.334884+00:00",
          "result": {
            "delay": 0.05,
            "done": true
          }
        }
      ],
      "action/2": [
        {
          "path": "action/2",
          "timestamp": "2024-04-18T13:20:31.386108+00:00",
          "result": {
            "params": {
              "domain": "scene",
              "service": "turn_on",
              "service_data": {},
              "target": {
                "entity_id": [
                  "scene.officedooropen"
                ]
              }
            },
            "running_script": false
          }
        }
      ],
      "action/3": [
        {
          "path": "action/3",
          "timestamp": "2024-04-18T13:20:31.395020+00:00",
          "result": {
            "delay": 1,
            "done": true
          }
        }
      ],
      "action/4": [
        {
          "path": "action/4",
          "timestamp": "2024-04-18T13:20:32.396255+00:00",
          "result": {
            "params": {
              "domain": "scene",
              "service": "turn_on",
              "service_data": {},
              "target": {
                "entity_id": [
                  "scene.officebefore"
                ]
              }
            },
            "running_script": false
          }
        }
      ],
      "action/5": [
        {
          "path": "action/5",
          "timestamp": "2024-04-18T13:20:32.423250+00:00",
          "result": {
            "delay": 0.25,
            "done": true
          }
        }
      ],
      "action/6": [
        {
          "path": "action/6",
          "timestamp": "2024-04-18T13:20:32.675015+00:00",
          "result": {
            "params": {
              "domain": "scene",
              "service": "delete",
              "service_data": {},
              "target": {
                "entity_id": [
                  "scene.officebefore"
                ]
              }
            },
            "running_script": false
          }
        }
      ]
    },
    "config": {
      "id": "1713311337778",
      "alias": "Office Door Opens",
      "description": "",
      "trigger": [
        {
          "platform": "state",
          "entity_id": [
            "binary_sensor.office3_office_door"
          ],
          "from": "off",
          "to": "on"
        }
      ],
      "condition": [],
      "action": [
        {
          "service": "scene.create",
          "data": {
            "scene_id": "officebefore",
            "snapshot_entities": [
              "light.yeelight_stripe_0x0000000005e303b9"
            ]
          }
        },
        {
          "delay": {
            "milliseconds": 50
          }
        },
        {
          "service": "scene.turn_on",
          "metadata": {},
          "target": {
            "entity_id": "scene.officedooropen"
          }
        },
        {
          "delay": {
            "hours": 0,
            "minutes": 0,
            "seconds": 1,
            "milliseconds": 0
          }
        },
        {
          "service": "scene.turn_on",
          "target": {
            "entity_id": "scene.officebefore"
          },
          "data": {}
        },
        {
          "delay": {
            "milliseconds": 250
          }
        },
        {
          "service": "scene.delete",
          "target": {
            "entity_id": "scene.officebefore"
          },
          "data": {}
        }
      ],
      "mode": "single"
    },
    "blueprint_inputs": null,
    "context": {
      "id": "01HVRNVAK5T26JJ0PBHWY8ZCE1",
      "parent_id": "01HVRNVAK4K68998HSW9A9HE6Q",
      "user_id": null
    }
  },
  "logbookEntries": [
    {
      "name": "Office Door Opens",
      "message": "triggered",
      "source": null,
      "entity_id": "automation.office_door_opens",
      "context_id": "01HVRNVAK5T26JJ0PBHWY8ZCE1",
      "when": 1713446431.333416,
      "domain": "automation"
    },
    {
      "when": 1713446431.386963,
      "state": "2024-04-18T13:20:31.386841+00:00",
      "entity_id": "scene.officedooropen",
      "icon": "mdi:office-building",
      "context_event_type": "automation_triggered",
      "context_domain": "automation",
      "context_name": "Office Door Opens",
      "context_message": "triggered",
      "context_entity_id": "automation.office_door_opens"
    },
    {
      "when": 1713446432.397079,
      "state": "2024-04-18T13:20:32.396990+00:00",
      "entity_id": "scene.officebefore",
      "context_event_type": "automation_triggered",
      "context_domain": "automation",
      "context_name": "Office Door Opens",
      "context_message": "triggered",
      "context_entity_id": "automation.office_door_opens"
    }
  ]
}
failed
{
  "trace": {
    "last_step": "action/6",
    "run_id": "98da8eac5b9ee7be3fc767ea03671376",
    "state": "stopped",
    "script_execution": "finished",
    "timestamp": {
      "start": "2024-04-18T13:20:34.408869+00:00",
      "finish": "2024-04-18T13:20:35.730344+00:00"
    },
    "domain": "automation",
    "item_id": "1713311337778",
    "trigger": null,
    "trace": {
      "trigger": [
        {
          "path": "trigger",
          "timestamp": "2024-04-18T13:20:34.408966+00:00",
          "changed_variables": {
            "this": {
              "entity_id": "automation.office_door_opens",
              "state": "on",
              "attributes": {
                "id": "1713311337778",
                "last_triggered": "2024-04-18T13:20:31.333421+00:00",
                "mode": "single",
                "current": 0,
                "friendly_name": "Office Door Opens"
              },
              "last_changed": "2024-04-18T12:13:12.728225+00:00",
              "last_reported": "2024-04-18T13:20:32.676300+00:00",
              "last_updated": "2024-04-18T13:20:32.676300+00:00",
              "context": {
                "id": "01HVRNVAK5T26JJ0PBHWY8ZCE1",
                "parent_id": "01HVRNVAK4K68998HSW9A9HE6Q",
                "user_id": null
              }
            },
            "trigger": {
              "platform": null
            }
          }
        }
      ],
      "action/0": [
        {
          "path": "action/0",
          "timestamp": "2024-04-18T13:20:34.409648+00:00",
          "changed_variables": {
            "context": {
              "id": "01HVRNVDK885ES4NBE9TMFDY5Y",
              "parent_id": "01HVRNVDK8VVT6KS8489AFXTKH",
              "user_id": null
            }
          },
          "result": {
            "params": {
              "domain": "scene",
              "service": "create",
              "service_data": {
                "scene_id": "officebefore",
                "snapshot_entities": [
                  "light.yeelight_stripe_0x0000000005e303b9"
                ]
              },
              "target": {}
            },
            "running_script": false
          }
        }
      ],
      "action/1": [
        {
          "path": "action/1",
          "timestamp": "2024-04-18T13:20:34.411007+00:00",
          "result": {
            "delay": 0.05,
            "done": true
          }
        }
      ],
      "action/2": [
        {
          "path": "action/2",
          "timestamp": "2024-04-18T13:20:34.462018+00:00",
          "result": {
            "params": {
              "domain": "scene",
              "service": "turn_on",
              "service_data": {},
              "target": {
                "entity_id": [
                  "scene.officedooropen"
                ]
              }
            },
            "running_script": false
          }
        }
      ],
      "action/3": [
        {
          "path": "action/3",
          "timestamp": "2024-04-18T13:20:34.470479+00:00",
          "result": {
            "delay": 1,
            "done": true
          }
        }
      ],
      "action/4": [
        {
          "path": "action/4",
          "timestamp": "2024-04-18T13:20:35.471782+00:00",
          "result": {
            "params": {
              "domain": "scene",
              "service": "turn_on",
              "service_data": {},
              "target": {
                "entity_id": [
                  "scene.officebefore"
                ]
              }
            },
            "running_script": false
          }
        }
      ],
      "action/5": [
        {
          "path": "action/5",
          "timestamp": "2024-04-18T13:20:35.475188+00:00",
          "result": {
            "delay": 0.25,
            "done": true
          }
        }
      ],
      "action/6": [
        {
          "path": "action/6",
          "timestamp": "2024-04-18T13:20:35.726963+00:00",
          "result": {
            "params": {
              "domain": "scene",
              "service": "delete",
              "service_data": {},
              "target": {
                "entity_id": [
                  "scene.officebefore"
                ]
              }
            },
            "running_script": false
          }
        }
      ]
    },
    "config": {
      "id": "1713311337778",
      "alias": "Office Door Opens",
      "description": "",
      "trigger": [
        {
          "platform": "state",
          "entity_id": [
            "binary_sensor.office3_office_door"
          ],
          "from": "off",
          "to": "on"
        }
      ],
      "condition": [],
      "action": [
        {
          "service": "scene.create",
          "data": {
            "scene_id": "officebefore",
            "snapshot_entities": [
              "light.yeelight_stripe_0x0000000005e303b9"
            ]
          }
        },
        {
          "delay": {
            "milliseconds": 50
          }
        },
        {
          "service": "scene.turn_on",
          "metadata": {},
          "target": {
            "entity_id": "scene.officedooropen"
          }
        },
        {
          "delay": {
            "hours": 0,
            "minutes": 0,
            "seconds": 1,
            "milliseconds": 0
          }
        },
        {
          "service": "scene.turn_on",
          "target": {
            "entity_id": "scene.officebefore"
          },
          "data": {}
        },
        {
          "delay": {
            "milliseconds": 250
          }
        },
        {
          "service": "scene.delete",
          "target": {
            "entity_id": "scene.officebefore"
          },
          "data": {}
        }
      ],
      "mode": "single"
    },
    "blueprint_inputs": null,
    "context": {
      "id": "01HVRNVDK885ES4NBE9TMFDY5Y",
      "parent_id": "01HVRNVDK8VVT6KS8489AFXTKH",
      "user_id": null
    }
  },
  "logbookEntries": [
    {
      "name": "Office Door Opens",
      "message": "triggered",
      "source": null,
      "entity_id": "automation.office_door_opens",
      "context_id": "01HVRNVDK885ES4NBE9TMFDY5Y",
      "when": 1713446434.4090624,
      "domain": "automation"
    },
    {
      "when": 1713446434.462896,
      "state": "2024-04-18T13:20:34.462801+00:00",
      "entity_id": "scene.officedooropen",
      "icon": "mdi:office-building",
      "context_event_type": "automation_triggered",
      "context_domain": "automation",
      "context_name": "Office Door Opens",
      "context_message": "triggered",
      "context_entity_id": "automation.office_door_opens"
    },
    {
      "when": 1713446435.472832,
      "state": "2024-04-18T13:20:35.472713+00:00",
      "entity_id": "scene.officebefore",
      "context_event_type": "automation_triggered",
      "context_domain": "automation",
      "context_name": "Office Door Opens",
      "context_message": "triggered",
      "context_entity_id": "automation.office_door_opens"
    }
  ]
}

I tried this, by replacing the scene.officedooropen block with the following:

  - service: light.turn_on
    metadata: {}
    data:
      rgb_color:
        - 255
        - 0
        - 0
      brightness: 255
    target:
      entity_id: light.yeelight_stripe_0x0000000005e303b9

But sadly, it was the same issue.

Traces:

worked
{
  "trace": {
    "last_step": "action/6",
    "run_id": "fff0b80247307e6d16ff4636f2ec880b",
    "state": "stopped",
    "script_execution": "finished",
    "timestamp": {
      "start": "2024-04-18T13:39:08.460109+00:00",
      "finish": "2024-04-18T13:39:09.799253+00:00"
    },
    "domain": "automation",
    "item_id": "1713311337778",
    "trigger": null,
    "trace": {
      "trigger": [
        {
          "path": "trigger",
          "timestamp": "2024-04-18T13:39:08.460225+00:00",
          "changed_variables": {
            "this": {
              "entity_id": "automation.office_door_opens",
              "state": "on",
              "attributes": {
                "id": "1713311337778",
                "last_triggered": "2024-04-18T13:31:39.268557+00:00",
                "mode": "single",
                "current": 0,
                "friendly_name": "Office Door Opens"
              },
              "last_changed": "2024-04-18T13:31:23.023133+00:00",
              "last_reported": "2024-04-18T13:31:40.589705+00:00",
              "last_updated": "2024-04-18T13:31:40.589705+00:00",
              "context": {
                "id": "01HVRPFPW4TCXHHJFN31AHNCBP",
                "parent_id": "01HVRPFPW3C8DDQARWS6V4JV2E",
                "user_id": null
              }
            },
            "trigger": {
              "platform": null
            }
          }
        }
      ],
      "action/0": [
        {
          "path": "action/0",
          "timestamp": "2024-04-18T13:39:08.460972+00:00",
          "changed_variables": {
            "context": {
              "id": "01HVRPXDHCRANB1BD5RCEW71PP",
              "parent_id": "01HVRPXDHBAAXESDDW96NN3Y53",
              "user_id": null
            }
          },
          "result": {
            "params": {
              "domain": "scene",
              "service": "create",
              "service_data": {
                "scene_id": "officebefore",
                "snapshot_entities": [
                  "light.yeelight_stripe_0x0000000005e303b9"
                ]
              },
              "target": {}
            },
            "running_script": false
          }
        }
      ],
      "action/1": [
        {
          "path": "action/1",
          "timestamp": "2024-04-18T13:39:08.462433+00:00",
          "result": {
            "delay": 0.05,
            "done": true
          }
        }
      ],
      "action/2": [
        {
          "path": "action/2",
          "timestamp": "2024-04-18T13:39:08.513761+00:00",
          "result": {
            "params": {
              "domain": "light",
              "service": "turn_on",
              "service_data": {
                "rgb_color": [
                  255,
                  0,
                  0
                ],
                "brightness": 255,
                "entity_id": [
                  "light.yeelight_stripe_0x0000000005e303b9"
                ]
              },
              "target": {
                "entity_id": [
                  "light.yeelight_stripe_0x0000000005e303b9"
                ]
              }
            },
            "running_script": false
          }
        }
      ],
      "action/3": [
        {
          "path": "action/3",
          "timestamp": "2024-04-18T13:39:08.529432+00:00",
          "result": {
            "delay": 1,
            "done": true
          }
        }
      ],
      "action/4": [
        {
          "path": "action/4",
          "timestamp": "2024-04-18T13:39:09.530194+00:00",
          "result": {
            "params": {
              "domain": "scene",
              "service": "turn_on",
              "service_data": {},
              "target": {
                "entity_id": [
                  "scene.officebefore"
                ]
              }
            },
            "running_script": false
          }
        }
      ],
      "action/5": [
        {
          "path": "action/5",
          "timestamp": "2024-04-18T13:39:09.543542+00:00",
          "result": {
            "delay": 0.25,
            "done": true
          }
        }
      ],
      "action/6": [
        {
          "path": "action/6",
          "timestamp": "2024-04-18T13:39:09.795433+00:00",
          "result": {
            "params": {
              "domain": "scene",
              "service": "delete",
              "service_data": {},
              "target": {
                "entity_id": [
                  "scene.officebefore"
                ]
              }
            },
            "running_script": false
          }
        }
      ]
    },
    "config": {
      "id": "1713311337778",
      "alias": "Office Door Opens",
      "description": "",
      "trigger": [
        {
          "platform": "state",
          "entity_id": [
            "binary_sensor.office3_office_door"
          ],
          "from": "off",
          "to": "on"
        }
      ],
      "condition": [],
      "action": [
        {
          "service": "scene.create",
          "data": {
            "scene_id": "officebefore",
            "snapshot_entities": [
              "light.yeelight_stripe_0x0000000005e303b9"
            ]
          }
        },
        {
          "delay": {
            "milliseconds": 50
          }
        },
        {
          "service": "light.turn_on",
          "metadata": {},
          "data": {
            "rgb_color": [
              255,
              0,
              0
            ],
            "brightness": 255
          },
          "target": {
            "entity_id": "light.yeelight_stripe_0x0000000005e303b9"
          }
        },
        {
          "delay": {
            "hours": 0,
            "minutes": 0,
            "seconds": 1,
            "milliseconds": 0
          }
        },
        {
          "service": "scene.turn_on",
          "target": {
            "entity_id": "scene.officebefore"
          },
          "data": {}
        },
        {
          "delay": {
            "milliseconds": 250
          }
        },
        {
          "service": "scene.delete",
          "target": {
            "entity_id": "scene.officebefore"
          },
          "data": {}
        }
      ],
      "mode": "single"
    },
    "blueprint_inputs": null,
    "context": {
      "id": "01HVRPXDHCRANB1BD5RCEW71PP",
      "parent_id": "01HVRPXDHBAAXESDDW96NN3Y53",
      "user_id": null
    }
  },
  "logbookEntries": [
    {
      "name": "Office Door Opens",
      "message": "triggered",
      "source": null,
      "entity_id": "automation.office_door_opens",
      "context_id": "01HVRPXDHCRANB1BD5RCEW71PP",
      "when": 1713447548.4603255,
      "domain": "automation"
    },
    {
      "when": 1713447549.53109,
      "state": "2024-04-18T13:39:09.530997+00:00",
      "entity_id": "scene.officebefore",
      "context_event_type": "automation_triggered",
      "context_domain": "automation",
      "context_name": "Office Door Opens",
      "context_message": "triggered",
      "context_entity_id": "automation.office_door_opens"
    }
  ]
}
failed
{
  "trace": {
    "last_step": "action/6",
    "run_id": "9dbc755b8d72bd58cb7f209e48ec4a6d",
    "state": "stopped",
    "script_execution": "finished",
    "timestamp": {
      "start": "2024-04-18T13:39:11.318733+00:00",
      "finish": "2024-04-18T13:39:12.642790+00:00"
    },
    "domain": "automation",
    "item_id": "1713311337778",
    "trigger": null,
    "trace": {
      "trigger": [
        {
          "path": "trigger",
          "timestamp": "2024-04-18T13:39:11.318814+00:00",
          "changed_variables": {
            "this": {
              "entity_id": "automation.office_door_opens",
              "state": "on",
              "attributes": {
                "id": "1713311337778",
                "last_triggered": "2024-04-18T13:39:08.460336+00:00",
                "mode": "single",
                "current": 0,
                "friendly_name": "Office Door Opens"
              },
              "last_changed": "2024-04-18T13:31:23.023133+00:00",
              "last_reported": "2024-04-18T13:39:09.796843+00:00",
              "last_updated": "2024-04-18T13:39:09.796843+00:00",
              "context": {
                "id": "01HVRPXDHCRANB1BD5RCEW71PP",
                "parent_id": "01HVRPXDHBAAXESDDW96NN3Y53",
                "user_id": null
              }
            },
            "trigger": {
              "platform": null
            }
          }
        }
      ],
      "action/0": [
        {
          "path": "action/0",
          "timestamp": "2024-04-18T13:39:11.319376+00:00",
          "changed_variables": {
            "context": {
              "id": "01HVRPXGAPAAMCWEDH6HKA3SSD",
              "parent_id": "01HVRPXGAPH1ZK0MHGFR1933VZ",
              "user_id": null
            }
          },
          "result": {
            "params": {
              "domain": "scene",
              "service": "create",
              "service_data": {
                "scene_id": "officebefore",
                "snapshot_entities": [
                  "light.yeelight_stripe_0x0000000005e303b9"
                ]
              },
              "target": {}
            },
            "running_script": false
          }
        }
      ],
      "action/1": [
        {
          "path": "action/1",
          "timestamp": "2024-04-18T13:39:11.321221+00:00",
          "result": {
            "delay": 0.05,
            "done": true
          }
        }
      ],
      "action/2": [
        {
          "path": "action/2",
          "timestamp": "2024-04-18T13:39:11.372595+00:00",
          "result": {
            "params": {
              "domain": "light",
              "service": "turn_on",
              "service_data": {
                "rgb_color": [
                  255,
                  0,
                  0
                ],
                "brightness": 255,
                "entity_id": [
                  "light.yeelight_stripe_0x0000000005e303b9"
                ]
              },
              "target": {
                "entity_id": [
                  "light.yeelight_stripe_0x0000000005e303b9"
                ]
              }
            },
            "running_script": false
          }
        }
      ],
      "action/3": [
        {
          "path": "action/3",
          "timestamp": "2024-04-18T13:39:11.382482+00:00",
          "result": {
            "delay": 1,
            "done": true
          }
        }
      ],
      "action/4": [
        {
          "path": "action/4",
          "timestamp": "2024-04-18T13:39:12.383915+00:00",
          "result": {
            "params": {
              "domain": "scene",
              "service": "turn_on",
              "service_data": {},
              "target": {
                "entity_id": [
                  "scene.officebefore"
                ]
              }
            },
            "running_script": false
          }
        }
      ],
      "action/5": [
        {
          "path": "action/5",
          "timestamp": "2024-04-18T13:39:12.387801+00:00",
          "result": {
            "delay": 0.25,
            "done": true
          }
        }
      ],
      "action/6": [
        {
          "path": "action/6",
          "timestamp": "2024-04-18T13:39:12.639701+00:00",
          "result": {
            "params": {
              "domain": "scene",
              "service": "delete",
              "service_data": {},
              "target": {
                "entity_id": [
                  "scene.officebefore"
                ]
              }
            },
            "running_script": false
          }
        }
      ]
    },
    "config": {
      "id": "1713311337778",
      "alias": "Office Door Opens",
      "description": "",
      "trigger": [
        {
          "platform": "state",
          "entity_id": [
            "binary_sensor.office3_office_door"
          ],
          "from": "off",
          "to": "on"
        }
      ],
      "condition": [],
      "action": [
        {
          "service": "scene.create",
          "data": {
            "scene_id": "officebefore",
            "snapshot_entities": [
              "light.yeelight_stripe_0x0000000005e303b9"
            ]
          }
        },
        {
          "delay": {
            "milliseconds": 50
          }
        },
        {
          "service": "light.turn_on",
          "metadata": {},
          "data": {
            "rgb_color": [
              255,
              0,
              0
            ],
            "brightness": 255
          },
          "target": {
            "entity_id": "light.yeelight_stripe_0x0000000005e303b9"
          }
        },
        {
          "delay": {
            "hours": 0,
            "minutes": 0,
            "seconds": 1,
            "milliseconds": 0
          }
        },
        {
          "service": "scene.turn_on",
          "target": {
            "entity_id": "scene.officebefore"
          },
          "data": {}
        },
        {
          "delay": {
            "milliseconds": 250
          }
        },
        {
          "service": "scene.delete",
          "target": {
            "entity_id": "scene.officebefore"
          },
          "data": {}
        }
      ],
      "mode": "single"
    },
    "blueprint_inputs": null,
    "context": {
      "id": "01HVRPXGAPAAMCWEDH6HKA3SSD",
      "parent_id": "01HVRPXGAPH1ZK0MHGFR1933VZ",
      "user_id": null
    }
  },
  "logbookEntries": [
    {
      "name": "Office Door Opens",
      "message": "triggered",
      "source": null,
      "entity_id": "automation.office_door_opens",
      "context_id": "01HVRPXGAPAAMCWEDH6HKA3SSD",
      "when": 1713447551.318893,
      "domain": "automation"
    },
    {
      "when": 1713447552.385759,
      "state": "2024-04-18T13:39:12.385677+00:00",
      "entity_id": "scene.officebefore",
      "context_event_type": "automation_triggered",
      "context_domain": "automation",
      "context_name": "Office Door Opens",
      "context_message": "triggered",
      "context_entity_id": "automation.office_door_opens"
    }
  ]
}

Fixed it.

I’m now convinced this is due to the light itself and not the automation or home assistant - from what I remember yeelights are notorious for ratelimiting, especially when it comes to multiple requests in x timespan, or just straight away multiple commands.

As soon as I changed the delay from 1 second to 2 seconds, it stopped happening.

1 Like

Based on that result, the next thing I was going to suggest is that it’s a problem with the device itself (specifically a communications timing issue) but you have already come to the same conclusion. Glad to hear you were able to mitigate the problem.