Thanks for reporting this. I see you’ve implemented similar logic for the light switch and noticed the same problem. Hopefully it gets fixed soon. In my case it usually works, but every now and then there’s no ID, and the light stays on even though nobody touched the physical switch.
Please post your automation. And the automation that you’re trying to detect. Context does not always apply in every spot. Making blanket statements like “it doesn’t work anymore” really doesn’t help anyone find the issue because context is added differently to every trigger.
Secondly, if you use context, it’s only available in certain parts of the automation. Prior to that, it’s the automations previous context.
Below is a blueprint for my automation. But it is evident from the history of events, sometimes there is “triggered by automation…”, and sometimes it’s not (and even vice-versa).
blueprint:
name: Motion-Activated Light with Manual Override (context-based)
description: >
Motion turns the light on; when all motion clears, turns it off after a delay.
Manual ON (UI/voice/physical) enables override until turned OFF again.
domain: automation
input:
motion_sensor_group:
name: Motion Sensor Group
selector: { entity: { domain: binary_sensor } }
target_light:
name: Light Entity
selector: { entity: { domain: light } }
off_delay:
name: Delay Before Turning Off (seconds)
default: 300
selector: { number: { min: 1, max: 3600, unit_of_measurement: seconds, mode: slider } }
override_boolean:
name: Override Helper
selector: { entity: { domain: input_boolean } }
mode: queued
variables:
light_entity: !input target_light
override_boolean: !input override_boolean
off_delay: !input off_delay
motion_group: !input motion_sensor_group
trigger:
- platform: state
entity_id: !input motion_sensor_group
from: "off"
to: "on"
id: motion_on
- platform: state
entity_id: !input motion_sensor_group
from: "on"
to: "off"
id: motion_off
- platform: state
entity_id: !input target_light
from: "off"
to: "on"
id: light_on
- platform: state
entity_id: !input target_light
from: "on"
to: "off"
id: light_off
action:
- choose:
# (A) Light turned OFF: clear override
- conditions:
- condition: trigger
id: light_off
sequence:
- service: input_boolean.turn_off
target: { entity_id: !input override_boolean }
# (B) Light turned ON -> if manual, set override ON
- conditions:
- condition: trigger
id: light_on
- condition: state
entity_id: !input override_boolean
state: "off"
- condition: template
value_template: >
{% set ctx = trigger.to_state.context %}
{{ ctx.user_id is not none or ctx.parent_id is none }}
sequence:
- service: input_boolean.turn_on
target: { entity_id: !input override_boolean }
# (C) Motion detected & override OFF -> turn light ON
- conditions:
- condition: trigger
id: motion_on
- condition: state
entity_id: !input override_boolean
state: "off"
sequence:
- service: light.turn_on
target: { entity_id: !input target_light }
# (D) Motion cleared & override OFF -> schedule OFF; verify all sensors off
- conditions:
- condition: trigger
id: motion_off
- condition: state
entity_id: !input override_boolean
state: "off"
sequence:
- wait_for_trigger:
- platform: state
entity_id: !input motion_sensor_group
from: "off"
to: "on"
timeout: "00:00:{{ off_delay }}"
- condition: and
conditions:
- condition: state
entity_id: !input override_boolean
state: "off"
- condition: template
value_template: >
{% set sensors = expand(motion_group) %}
{{ sensors | selectattr('state','eq','off') | list | length ==
sensors | list | length }}
- service: light.turn_off
target: { entity_id: !input target_light }
default: []
And are you sure (by looking at the triggering automation trace) that the context matches and this isn’t a byproduct of a faulty device?
Please post the automations that should be triggering your context that are not. We will need the full trace timeline. I recommend posting all traces of that automation around the time this occurs. Also, export the history for the entity in question that is causing Motion-Activated Light with Manual Override (context-based) and post it here as well.
TLDR: We need proof that there’s a bug to replicate it.
Here’s one simple example: after the light was turned on by automation through the motion sensor, I pressed the physical switch to turn the light off a second later. In the history, however, this off action is recorded as triggered by automation. From what I understand, a manual action like this should appear without a parent or user ID. The automation trace was indeed triggered at the same moment, but as you can see from the traces, the automation did not actually perform any light.turn_off action.
Trace 1 (motion-triggered → light turn_on):
{
"trace": {
"last_step": "action/0/choose/3/conditions/0",
"run_id": "b4daabbd2bbb8ef96125c5233c8c06a4",
"state": "stopped",
"script_execution": "finished",
"timestamp": {
"start": "2025-08-30T21:47:58.448985+00:00",
"finish": "2025-08-30T21:47:58.450532+00:00"
},
"domain": "automation",
"item_id": "1737564570465",
"trigger": "state of light.switch_hallway_stairs_l2",
"trace": {
"trigger/2": [
{
"path": "trigger/2",
"timestamp": "2025-08-30T21:47:58.449194+00:00",
"changed_variables": {
"light_entity": "light.switch_hallway_stairs_l2",
"override_boolean": "input_boolean.manual_override_stairs",
"off_delay": 5,
"motion_group": "binary_sensor.stairs_motion_group",
"this": {
"entity_id": "automation.motion_activated_light_with_manual_override_stairs",
"state": "on",
"attributes": {
"id": "1737564570465",
"last_triggered": "2025-08-30T21:47:58.302796+00:00",
"mode": "queued",
"current": 0,
"max": 10,
"friendly_name": "Motion-Activated Light with Manual Override Stairs"
},
"last_changed": "2025-08-30T13:08:28.302062+00:00",
"last_reported": "2025-08-30T21:47:58.315379+00:00",
"last_updated": "2025-08-30T21:47:58.315379+00:00",
"context": {
"id": "01K3YF74YYCK8XGZMJRPKKB6AD",
"parent_id": "01K3YF74YTAM6ZVWACY5QYXATH",
"user_id": null
}
},
"trigger": {
"id": "light_on",
"idx": "2",
"alias": null,
"platform": "state",
"entity_id": "light.switch_hallway_stairs_l2",
"from_state": {
"entity_id": "light.switch_hallway_stairs_l2",
"state": "off",
"attributes": {
"supported_color_modes": [
"onoff"
],
"color_mode": null,
"friendly_name": "Switch Hallway Stairs Relay_right",
"supported_features": 0
},
"last_changed": "2025-08-30T21:35:50.728022+00:00",
"last_reported": "2025-08-30T21:35:50.728022+00:00",
"last_updated": "2025-08-30T21:35:50.728022+00:00",
"context": {
"id": "01K3YEGSDRFESHNV1C0P1QCXMX",
"parent_id": "01K3YEGSDPW6WPAFCDJJ0BBX21",
"user_id": null
}
},
"to_state": {
"entity_id": "light.switch_hallway_stairs_l2",
"state": "on",
"attributes": {
"supported_color_modes": [
"onoff"
],
"color_mode": "onoff",
"friendly_name": "Switch Hallway Stairs Relay_right",
"supported_features": 0
},
"last_changed": "2025-08-30T21:47:58.448496+00:00",
"last_reported": "2025-08-30T21:47:58.448496+00:00",
"last_updated": "2025-08-30T21:47:58.448496+00:00",
"context": {
"id": "01K3YF74YYCK8XGZMJRPKKB6AD",
"parent_id": "01K3YF74YTAM6ZVWACY5QYXATH",
"user_id": null
}
},
"for": null,
"attribute": null,
"description": "state of light.switch_hallway_stairs_l2"
}
}
}
],
"action/0": [
{
"path": "action/0",
"timestamp": "2025-08-30T21:47:58.449534+00:00",
"changed_variables": {
"context": {
"id": "01K3YF753GKAQ1G7QNZY577RJC",
"parent_id": "01K3YF74YYCK8XGZMJRPKKB6AD",
"user_id": null
}
},
"result": {
"choice": "default"
}
}
],
"action/0/choose/0": [
{
"path": "action/0/choose/0",
"timestamp": "2025-08-30T21:47:58.449603+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/0/conditions/0": [
{
"path": "action/0/choose/0/conditions/0",
"timestamp": "2025-08-30T21:47:58.449650+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/1": [
{
"path": "action/0/choose/1",
"timestamp": "2025-08-30T21:47:58.449713+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/1/conditions/0": [
{
"path": "action/0/choose/1/conditions/0",
"timestamp": "2025-08-30T21:47:58.449750+00:00",
"result": {
"result": true
}
}
],
"action/0/choose/1/conditions/1": [
{
"path": "action/0/choose/1/conditions/1",
"timestamp": "2025-08-30T21:47:58.449791+00:00",
"result": {
"result": true
}
}
],
"action/0/choose/1/conditions/1/entity_id/0": [
{
"path": "action/0/choose/1/conditions/1/entity_id/0",
"timestamp": "2025-08-30T21:47:58.449825+00:00",
"result": {
"result": true,
"state": "off",
"wanted_state": "off"
}
}
],
"action/0/choose/1/conditions/2": [
{
"path": "action/0/choose/1/conditions/2",
"timestamp": "2025-08-30T21:47:58.449872+00:00",
"result": {
"result": false,
"entities": []
}
}
],
"action/0/choose/2": [
{
"path": "action/0/choose/2",
"timestamp": "2025-08-30T21:47:58.450080+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/2/conditions/0": [
{
"path": "action/0/choose/2/conditions/0",
"timestamp": "2025-08-30T21:47:58.450120+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/3": [
{
"path": "action/0/choose/3",
"timestamp": "2025-08-30T21:47:58.450172+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/3/conditions/0": [
{
"path": "action/0/choose/3/conditions/0",
"timestamp": "2025-08-30T21:47:58.450206+00:00",
"result": {
"result": false
}
}
]
},
"config": {
"mode": "queued",
"variables": {
"light_entity": "light.switch_hallway_stairs_l2",
"override_boolean": "input_boolean.manual_override_stairs",
"off_delay": 5,
"motion_group": "binary_sensor.stairs_motion_group"
},
"triggers": [
{
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from": "off",
"to": "on",
"id": "motion_on"
},
{
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from": "on",
"to": "off",
"id": "motion_off"
},
{
"platform": "state",
"entity_id": "light.switch_hallway_stairs_l2",
"from": "off",
"to": "on",
"id": "light_on"
},
{
"platform": "state",
"entity_id": "light.switch_hallway_stairs_l2",
"from": "on",
"to": "off",
"id": "light_off"
}
],
"actions": [
{
"choose": [
{
"conditions": [
{
"condition": "trigger",
"id": "light_off"
}
],
"sequence": [
{
"target": {
"entity_id": "input_boolean.manual_override_stairs"
},
"action": "input_boolean.turn_off"
}
]
},
{
"conditions": [
{
"condition": "trigger",
"id": "light_on"
},
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
},
{
"condition": "template",
"value_template": "{% set ctx = trigger.to_state.context %} {{ ctx.user_id is not none or ctx.parent_id is none }}\n"
}
],
"sequence": [
{
"target": {
"entity_id": "input_boolean.manual_override_stairs"
},
"action": "input_boolean.turn_on"
}
]
},
{
"conditions": [
{
"condition": "trigger",
"id": "motion_on"
},
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
}
],
"sequence": [
{
"target": {
"entity_id": "light.switch_hallway_stairs_l2"
},
"action": "light.turn_on"
}
]
},
{
"conditions": [
{
"condition": "trigger",
"id": "motion_off"
},
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
}
],
"sequence": [
{
"wait_for_trigger": [
{
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from": "off",
"to": "on"
}
],
"timeout": "00:00:{{ off_delay }}"
},
{
"condition": "and",
"conditions": [
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
},
{
"condition": "template",
"value_template": "{% set sensors = expand(motion_group) %} {{ sensors | selectattr('state','eq','off') | list | length ==\n sensors | list | length }}\n"
}
]
},
{
"target": {
"entity_id": "light.switch_hallway_stairs_l2"
},
"action": "light.turn_off"
}
]
}
],
"default": []
}
],
"id": "1737564570465",
"alias": "Motion-Activated Light with Manual Override Stairs",
"description": ""
},
"blueprint_inputs": {
"id": "1737564570465",
"alias": "Motion-Activated Light with Manual Override Stairs",
"description": "",
"use_blueprint": {
"path": "my_blueprints/motion_light_override.yaml",
"input": {
"motion_sensor_group": "binary_sensor.stairs_motion_group",
"target_light": "light.switch_hallway_stairs_l2",
"off_delay": 5,
"override_boolean": "input_boolean.manual_override_stairs",
"motion_trigger_flag": "input_boolean.motion_trigger_flag_stairs"
}
}
},
"context": {
"id": "01K3YF753GKAQ1G7QNZY577RJC",
"parent_id": "01K3YF74YYCK8XGZMJRPKKB6AD",
"user_id": null
}
},
"logbookEntries": [
{
"name": "Motion-Activated Light with Manual Override Stairs",
"message": "triggered by state of light.switch_hallway_stairs_l2",
"source": "state of light.switch_hallway_stairs_l2",
"entity_id": "automation.motion_activated_light_with_manual_override_stairs",
"context_id": "01K3YF753GKAQ1G7QNZY577RJC",
"domain": "automation",
"when": 1756590478.4492521
}
]
}
Trace 2 (triggered by turn_off event of the light → to clear the ‘manual override’ input_boolean, if true):
{
"trace": {
"last_step": "action/0/choose/0/sequence/0",
"run_id": "0db26a7d336df5badf10a3bce1dd37b9",
"state": "stopped",
"script_execution": "finished",
"timestamp": {
"start": "2025-08-30T21:47:59.710645+00:00",
"finish": "2025-08-30T21:47:59.712919+00:00"
},
"domain": "automation",
"item_id": "1737564570465",
"trigger": "state of light.switch_hallway_stairs_l2",
"trace": {
"trigger/3": [
{
"path": "trigger/3",
"timestamp": "2025-08-30T21:47:59.710864+00:00",
"changed_variables": {
"light_entity": "light.switch_hallway_stairs_l2",
"override_boolean": "input_boolean.manual_override_stairs",
"off_delay": 5,
"motion_group": "binary_sensor.stairs_motion_group",
"this": {
"entity_id": "automation.motion_activated_light_with_manual_override_stairs",
"state": "on",
"attributes": {
"id": "1737564570465",
"last_triggered": "2025-08-30T21:47:58.449288+00:00",
"mode": "queued",
"current": 0,
"max": 10,
"friendly_name": "Motion-Activated Light with Manual Override Stairs"
},
"last_changed": "2025-08-30T13:08:28.302062+00:00",
"last_reported": "2025-08-30T21:47:58.450393+00:00",
"last_updated": "2025-08-30T21:47:58.450393+00:00",
"context": {
"id": "01K3YF753GKAQ1G7QNZY577RJC",
"parent_id": "01K3YF74YYCK8XGZMJRPKKB6AD",
"user_id": null
}
},
"trigger": {
"id": "light_off",
"idx": "3",
"alias": null,
"platform": "state",
"entity_id": "light.switch_hallway_stairs_l2",
"from_state": {
"entity_id": "light.switch_hallway_stairs_l2",
"state": "on",
"attributes": {
"supported_color_modes": [
"onoff"
],
"color_mode": "onoff",
"friendly_name": "Switch Hallway Stairs Relay_right",
"supported_features": 0
},
"last_changed": "2025-08-30T21:47:58.448496+00:00",
"last_reported": "2025-08-30T21:47:58.448496+00:00",
"last_updated": "2025-08-30T21:47:58.448496+00:00",
"context": {
"id": "01K3YF74YYCK8XGZMJRPKKB6AD",
"parent_id": "01K3YF74YTAM6ZVWACY5QYXATH",
"user_id": null
}
},
"to_state": {
"entity_id": "light.switch_hallway_stairs_l2",
"state": "off",
"attributes": {
"supported_color_modes": [
"onoff"
],
"color_mode": null,
"friendly_name": "Switch Hallway Stairs Relay_right",
"supported_features": 0
},
"last_changed": "2025-08-30T21:47:59.707729+00:00",
"last_reported": "2025-08-30T21:47:59.707729+00:00",
"last_updated": "2025-08-30T21:47:59.707729+00:00",
"context": {
"id": "01K3YF74YYCK8XGZMJRPKKB6AD",
"parent_id": "01K3YF74YTAM6ZVWACY5QYXATH",
"user_id": null
}
},
"for": null,
"attribute": null,
"description": "state of light.switch_hallway_stairs_l2"
}
}
}
],
"action/0": [
{
"path": "action/0",
"timestamp": "2025-08-30T21:47:59.711825+00:00",
"changed_variables": {
"context": {
"id": "01K3YF76AYC0AC46NH6R7XVZ59",
"parent_id": "01K3YF74YYCK8XGZMJRPKKB6AD",
"user_id": null
}
},
"result": {
"choice": 0
}
}
],
"action/0/choose/0": [
{
"path": "action/0/choose/0",
"timestamp": "2025-08-30T21:47:59.711939+00:00",
"result": {
"result": true
}
}
],
"action/0/choose/0/conditions/0": [
{
"path": "action/0/choose/0/conditions/0",
"timestamp": "2025-08-30T21:47:59.711996+00:00",
"result": {
"result": true
}
}
],
"action/0/choose/0/sequence/0": [
{
"path": "action/0/choose/0/sequence/0",
"timestamp": "2025-08-30T21:47:59.712160+00:00",
"result": {
"params": {
"domain": "input_boolean",
"service": "turn_off",
"service_data": {},
"target": {
"entity_id": [
"input_boolean.manual_override_stairs"
]
}
},
"running_script": false
}
}
]
},
"config": {
"mode": "queued",
"variables": {
"light_entity": "light.switch_hallway_stairs_l2",
"override_boolean": "input_boolean.manual_override_stairs",
"off_delay": 5,
"motion_group": "binary_sensor.stairs_motion_group"
},
"triggers": [
{
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from": "off",
"to": "on",
"id": "motion_on"
},
{
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from": "on",
"to": "off",
"id": "motion_off"
},
{
"platform": "state",
"entity_id": "light.switch_hallway_stairs_l2",
"from": "off",
"to": "on",
"id": "light_on"
},
{
"platform": "state",
"entity_id": "light.switch_hallway_stairs_l2",
"from": "on",
"to": "off",
"id": "light_off"
}
],
"actions": [
{
"choose": [
{
"conditions": [
{
"condition": "trigger",
"id": "light_off"
}
],
"sequence": [
{
"target": {
"entity_id": "input_boolean.manual_override_stairs"
},
"action": "input_boolean.turn_off"
}
]
},
{
"conditions": [
{
"condition": "trigger",
"id": "light_on"
},
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
},
{
"condition": "template",
"value_template": "{% set ctx = trigger.to_state.context %} {{ ctx.user_id is not none or ctx.parent_id is none }}\n"
}
],
"sequence": [
{
"target": {
"entity_id": "input_boolean.manual_override_stairs"
},
"action": "input_boolean.turn_on"
}
]
},
{
"conditions": [
{
"condition": "trigger",
"id": "motion_on"
},
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
}
],
"sequence": [
{
"target": {
"entity_id": "light.switch_hallway_stairs_l2"
},
"action": "light.turn_on"
}
]
},
{
"conditions": [
{
"condition": "trigger",
"id": "motion_off"
},
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
}
],
"sequence": [
{
"wait_for_trigger": [
{
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from": "off",
"to": "on"
}
],
"timeout": "00:00:{{ off_delay }}"
},
{
"condition": "and",
"conditions": [
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
},
{
"condition": "template",
"value_template": "{% set sensors = expand(motion_group) %} {{ sensors | selectattr('state','eq','off') | list | length ==\n sensors | list | length }}\n"
}
]
},
{
"target": {
"entity_id": "light.switch_hallway_stairs_l2"
},
"action": "light.turn_off"
}
]
}
],
"default": []
}
],
"id": "1737564570465",
"alias": "Motion-Activated Light with Manual Override Stairs",
"description": ""
},
"blueprint_inputs": {
"id": "1737564570465",
"alias": "Motion-Activated Light with Manual Override Stairs",
"description": "",
"use_blueprint": {
"path": "my_blueprints/motion_light_override.yaml",
"input": {
"motion_sensor_group": "binary_sensor.stairs_motion_group",
"target_light": "light.switch_hallway_stairs_l2",
"off_delay": 5,
"override_boolean": "input_boolean.manual_override_stairs",
"motion_trigger_flag": "input_boolean.motion_trigger_flag_stairs"
}
}
},
"context": {
"id": "01K3YF76AYC0AC46NH6R7XVZ59",
"parent_id": "01K3YF74YYCK8XGZMJRPKKB6AD",
"user_id": null
}
},
"logbookEntries": [
{
"name": "Motion-Activated Light with Manual Override Stairs",
"message": "triggered by state of light.switch_hallway_stairs_l2",
"source": "state of light.switch_hallway_stairs_l2",
"entity_id": "automation.motion_activated_light_with_manual_override_stairs",
"context_id": "01K3YF76AYC0AC46NH6R7XVZ59",
"domain": "automation",
"when": 1756590479.7109447
}
]
}
Screenshot of the logbook:
Nope, this is a from_state: off to_state: on for the light. So that’s not a motion trigger execution. Unless you mean “It was triggered by the other automation as motion”. And if so, we need to see the last few traces of that automation. This trace did go to the default path, so it executed nothing at that point.
And it has context
So that context is working as expected.
Can you put this template into your template editor?
{{ states | selectattr('context.id', 'eq', '01K3YF74YTAM6ZVWACY5QYXATH') | map(attribute='name') | list | first | default }}
Your second trace definitely shows context. But also understand your automation is queued. To me, it seems like it’s a poorly written automation that can trigger itself and the motion_on and motion_off triggers that turn on/off the light are triggering the light_on and light_off triggers in a later execution. Also all your off sections don’t appear to debounce anything using the parent context. So I’d consider that an issue with your automation as well because it’s queued.
My mistake earlier — the automation was triggered twice (I don’t see this as a problem) and so I copied the wrong trace (second one - which basically checks if it needs to turn off the input_boolean ‘manual override’). The first trace should actually look like this:
{
"trace": {
"last_step": "action/0/choose/2/sequence/0",
"run_id": "b9f990edf99f985112e38ea542cde973",
"state": "stopped",
"script_execution": "finished",
"timestamp": {
"start": "2025-08-31T13:08:27.811027+00:00",
"finish": "2025-08-31T13:08:27.823039+00:00"
},
"domain": "automation",
"item_id": "1737564570465",
"trigger": "state of binary_sensor.stairs_motion_group",
"trace": {
"trigger/0": [
{
"path": "trigger/0",
"timestamp": "2025-08-31T13:08:27.811490+00:00",
"changed_variables": {
"light_entity": "light.switch_hallway_stairs_l2",
"override_boolean": "input_boolean.manual_override_stairs",
"off_delay": 5,
"motion_group": "binary_sensor.stairs_motion_group",
"this": {
"entity_id": "automation.motion_activated_light_with_manual_override_stairs",
"state": "on",
"attributes": {
"id": "1737564570465",
"last_triggered": "2025-08-31T13:02:17.524433+00:00",
"mode": "queued",
"current": 0,
"max": 10,
"friendly_name": "Motion-Activated Light with Manual Override Stairs"
},
"last_changed": "2025-08-31T13:08:04.911242+00:00",
"last_reported": "2025-08-31T13:08:04.911242+00:00",
"last_updated": "2025-08-31T13:08:04.911242+00:00",
"context": {
"id": "01K403VXNFSYG4F4N61EQ45FWD",
"parent_id": null,
"user_id": null
}
},
"trigger": {
"id": "motion_on",
"idx": "0",
"alias": null,
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from_state": {
"entity_id": "binary_sensor.stairs_motion_group",
"state": "off",
"attributes": {
"entity_id": [
"binary_sensor.motion_3_occupancy",
"binary_sensor.motion_5_occupancy"
],
"friendly_name": "stairs motion group"
},
"last_changed": "2025-08-31T13:02:17.522968+00:00",
"last_reported": "2025-08-31T13:02:17.522968+00:00",
"last_updated": "2025-08-31T13:02:17.522968+00:00",
"context": {
"id": "01K403HADHXX2HYQAQ4HZZ6DK0",
"parent_id": null,
"user_id": null
}
},
"to_state": {
"entity_id": "binary_sensor.stairs_motion_group",
"state": "on",
"attributes": {
"entity_id": [
"binary_sensor.motion_3_occupancy",
"binary_sensor.motion_5_occupancy"
],
"friendly_name": "stairs motion group"
},
"last_changed": "2025-08-31T13:08:27.810231+00:00",
"last_reported": "2025-08-31T13:08:27.810231+00:00",
"last_updated": "2025-08-31T13:08:27.810231+00:00",
"context": {
"id": "01K403WM10BPXY4QDQ2SADTB6X",
"parent_id": null,
"user_id": null
}
},
"for": null,
"attribute": null,
"description": "state of binary_sensor.stairs_motion_group"
}
}
}
],
"action/0": [
{
"path": "action/0",
"timestamp": "2025-08-31T13:08:27.811944+00:00",
"changed_variables": {
"context": {
"id": "01K403WM12P8HZJHT187X8QNS9",
"parent_id": "01K403WM10BPXY4QDQ2SADTB6X",
"user_id": null
}
},
"result": {
"choice": 2
}
}
],
"action/0/choose/0": [
{
"path": "action/0/choose/0",
"timestamp": "2025-08-31T13:08:27.812350+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/0/conditions/0": [
{
"path": "action/0/choose/0/conditions/0",
"timestamp": "2025-08-31T13:08:27.812436+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/1": [
{
"path": "action/0/choose/1",
"timestamp": "2025-08-31T13:08:27.812522+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/1/conditions/0": [
{
"path": "action/0/choose/1/conditions/0",
"timestamp": "2025-08-31T13:08:27.812563+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/2": [
{
"path": "action/0/choose/2",
"timestamp": "2025-08-31T13:08:27.812617+00:00",
"result": {
"result": true
}
}
],
"action/0/choose/2/conditions/0": [
{
"path": "action/0/choose/2/conditions/0",
"timestamp": "2025-08-31T13:08:27.812653+00:00",
"result": {
"result": true
}
}
],
"action/0/choose/2/conditions/1": [
{
"path": "action/0/choose/2/conditions/1",
"timestamp": "2025-08-31T13:08:27.812705+00:00",
"result": {
"result": true
}
}
],
"action/0/choose/2/conditions/1/entity_id/0": [
{
"path": "action/0/choose/2/conditions/1/entity_id/0",
"timestamp": "2025-08-31T13:08:27.812750+00:00",
"result": {
"result": true,
"state": "off",
"wanted_state": "off"
}
}
],
"action/0/choose/2/sequence/0": [
{
"path": "action/0/choose/2/sequence/0",
"timestamp": "2025-08-31T13:08:27.812920+00:00",
"result": {
"params": {
"domain": "light",
"service": "turn_on",
"service_data": {},
"target": {
"entity_id": [
"light.switch_hallway_stairs_l2"
]
}
},
"running_script": false
}
}
]
},
"config": {
"mode": "queued",
"variables": {
"light_entity": "light.switch_hallway_stairs_l2",
"override_boolean": "input_boolean.manual_override_stairs",
"off_delay": 5,
"motion_group": "binary_sensor.stairs_motion_group"
},
"triggers": [
{
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from": "off",
"to": "on",
"id": "motion_on"
},
{
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from": "on",
"to": "off",
"id": "motion_off"
},
{
"platform": "state",
"entity_id": "light.switch_hallway_stairs_l2",
"from": "off",
"to": "on",
"id": "light_on"
},
{
"platform": "state",
"entity_id": "light.switch_hallway_stairs_l2",
"from": "on",
"to": "off",
"id": "light_off"
}
],
"actions": [
{
"choose": [
{
"conditions": [
{
"condition": "trigger",
"id": "light_off"
}
],
"sequence": [
{
"target": {
"entity_id": "input_boolean.manual_override_stairs"
},
"action": "input_boolean.turn_off"
}
]
},
{
"conditions": [
{
"condition": "trigger",
"id": "light_on"
},
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
},
{
"condition": "template",
"value_template": "{% set ctx = trigger.to_state.context %} {{ ctx.user_id is not none or ctx.parent_id is none }}\n"
}
],
"sequence": [
{
"target": {
"entity_id": "input_boolean.manual_override_stairs"
},
"action": "input_boolean.turn_on"
}
]
},
{
"conditions": [
{
"condition": "trigger",
"id": "motion_on"
},
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
}
],
"sequence": [
{
"target": {
"entity_id": "light.switch_hallway_stairs_l2"
},
"action": "light.turn_on"
}
]
},
{
"conditions": [
{
"condition": "trigger",
"id": "motion_off"
},
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
}
],
"sequence": [
{
"wait_for_trigger": [
{
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from": "off",
"to": "on"
}
],
"timeout": "00:00:{{ off_delay }}"
},
{
"condition": "and",
"conditions": [
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
},
{
"condition": "template",
"value_template": "{% set sensors = expand(motion_group) %} {{ sensors | selectattr('state','eq','off') | list | length ==\n sensors | list | length }}\n"
}
]
},
{
"target": {
"entity_id": "light.switch_hallway_stairs_l2"
},
"action": "light.turn_off"
}
]
}
],
"default": []
}
],
"id": "1737564570465",
"alias": "Motion-Activated Light with Manual Override Stairs",
"description": ""
},
"blueprint_inputs": {
"id": "1737564570465",
"alias": "Motion-Activated Light with Manual Override Stairs",
"description": "",
"use_blueprint": {
"path": "my_blueprints/motion_light_override.yaml",
"input": {
"motion_sensor_group": "binary_sensor.stairs_motion_group",
"target_light": "light.switch_hallway_stairs_l2",
"off_delay": 5,
"override_boolean": "input_boolean.manual_override_stairs",
"motion_trigger_flag": "input_boolean.motion_trigger_flag_stairs"
}
}
},
"context": {
"id": "01K403WM12P8HZJHT187X8QNS9",
"parent_id": "01K403WM10BPXY4QDQ2SADTB6X",
"user_id": null
}
},
"logbookEntries": [
{
"name": "Motion-Activated Light with Manual Override Stairs",
"message": "triggered by state of binary_sensor.stairs_motion_group",
"source": "state of binary_sensor.stairs_motion_group",
"entity_id": "automation.motion_activated_light_with_manual_override_stairs",
"context_id": "01K403WM12P8HZJHT187X8QNS9",
"domain": "automation",
"when": 1756645707.8115928
},
{
"state": "on",
"entity_id": "switch.switch_hallway_stairs_relay_right",
"when": 1756645707.9262269,
"context_event_type": "automation_triggered",
"context_domain": "automation",
"context_name": "Motion-Activated Light with Manual Override Stairs",
"context_message": "triggered by state of binary_sensor.stairs_motion_group",
"context_source": "state of binary_sensor.stairs_motion_group",
"context_entity_id": "automation.motion_activated_light_with_manual_override_stairs"
},
{
"state": "on",
"entity_id": "light.switch_hallway_stairs_l2",
"when": 1756645707.9270654,
"context_event_type": "automation_triggered",
"context_domain": "automation",
"context_name": "Motion-Activated Light with Manual Override Stairs",
"context_message": "triggered by state of binary_sensor.stairs_motion_group",
"context_source": "state of binary_sensor.stairs_motion_group",
"context_entity_id": "automation.motion_activated_light_with_manual_override_stairs"
},
{
"state": "2",
"entity_id": "sensor.active_lights_groundfloor",
"when": 1756645707.9450893,
"context_event_type": "automation_triggered",
"context_domain": "automation",
"context_name": "Motion-Activated Light with Manual Override Stairs",
"context_message": "triggered by state of binary_sensor.stairs_motion_group",
"context_source": "state of binary_sensor.stairs_motion_group",
"context_entity_id": "automation.motion_activated_light_with_manual_override_stairs"
},
{
"state": "off",
"entity_id": "switch.switch_hallway_stairs_relay_right",
"when": 1756645710.3751838,
"context_event_type": "automation_triggered",
"context_domain": "automation",
"context_name": "Motion-Activated Light with Manual Override Stairs",
"context_message": "triggered by state of binary_sensor.stairs_motion_group",
"context_source": "state of binary_sensor.stairs_motion_group",
"context_entity_id": "automation.motion_activated_light_with_manual_override_stairs"
},
{
"state": "off",
"entity_id": "light.switch_hallway_stairs_l2",
"when": 1756645710.375947,
"context_event_type": "automation_triggered",
"context_domain": "automation",
"context_name": "Motion-Activated Light with Manual Override Stairs",
"context_message": "triggered by state of binary_sensor.stairs_motion_group",
"context_source": "state of binary_sensor.stairs_motion_group",
"context_entity_id": "automation.motion_activated_light_with_manual_override_stairs"
},
{
"state": "1",
"entity_id": "sensor.active_lights_groundfloor",
"when": 1756645710.3793702,
"context_event_type": "automation_triggered",
"context_domain": "automation",
"context_name": "Motion-Activated Light with Manual Override Stairs",
"context_message": "triggered by state of binary_sensor.stairs_motion_group",
"context_source": "state of binary_sensor.stairs_motion_group",
"context_entity_id": "automation.motion_activated_light_with_manual_override_stairs"
}
]
}
When I put the template from your post into the template editor it returns nothing.
What I still don’t understand is why the turn_off event is shown in the logbook/history as “triggered by automation …” even though, as the trace shows, the automation never executed a light.turn_off. The only connection seems to be that both events share a very close timestamp. BTW, if I toggle the physical switch again after some time, it logs correctly with no parent or user ID.
The trace shows a trigger where the light is turning off and it’s context points to the automation. This is why I asked you to post all the traces around what you’re considering the bad one. Because in all likelyhood, your queued mode has a trace between them where the motion_off is triggering the light turn_off command.
This right here.
It’s not a “manual override” from my eyes. It’s the motion automation clearing and then triggering the automation again because there’s no debounce protection for any of the “turn off” paths.
Now I could be reading those in the wrong order because the timestamps don’t make sense. However queued mode can be confusing and some recorder/logbook state changes may not be shown here because this only shows related state changes.
So the only way to know 100% for certain that the state changes are not caused by the automation is to view all traces in order.
inside the .storage folder, you can find all the traces for the single automation and dpaste that file here.
These are the only four traces (see below), and yes, turn_off can indeed be triggered by the automation — in fact, it normally is (unless manual override input_boolean is set to 1), after the predefined timeout (around 30 seconds in this case). In the situation I described, however, the turn_off appears soon after the light was turned on by motion (because I pressed physical switch). This one should have no parent and user ids. I also tried modifying the automation mode from queued to restart to see if that made any difference, but it did not.
Trace 1:
{
"trace": {
"last_step": "action/0/choose/2/sequence/0",
"run_id": "8b5f5676791c80901e5c28d0d48caa72",
"state": "stopped",
"script_execution": "finished",
"timestamp": {
"start": "2025-08-31T13:47:47.457678+00:00",
"finish": "2025-08-31T13:47:47.467900+00:00"
},
"domain": "automation",
"item_id": "1737564570465",
"trigger": "state of binary_sensor.stairs_motion_group",
"trace": {
"trigger/0": [
{
"path": "trigger/0",
"timestamp": "2025-08-31T13:47:47.457964+00:00",
"changed_variables": {
"light_entity": "light.switch_hallway_stairs_l2",
"override_boolean": "input_boolean.manual_override_stairs",
"off_delay": 5,
"motion_group": "binary_sensor.stairs_motion_group",
"this": {
"entity_id": "automation.motion_activated_light_with_manual_override_stairs",
"state": "on",
"attributes": {
"id": "1737564570465",
"last_triggered": "2025-08-31T13:45:58.086009+00:00",
"mode": "queued",
"current": 0,
"max": 10,
"friendly_name": "Motion-Activated Light with Manual Override Stairs"
},
"last_changed": "2025-08-31T13:08:04.911242+00:00",
"last_reported": "2025-08-31T13:45:58.087559+00:00",
"last_updated": "2025-08-31T13:45:58.087559+00:00",
"context": {
"id": "01K40619J530PJ7TPSFD61EPVF",
"parent_id": "01K40614HZQ5SYSEE08A7YK2WW",
"user_id": null
}
},
"trigger": {
"id": "motion_on",
"idx": "0",
"alias": null,
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from_state": {
"entity_id": "binary_sensor.stairs_motion_group",
"state": "off",
"attributes": {
"entity_id": [
"binary_sensor.motion_3_occupancy",
"binary_sensor.motion_5_occupancy"
],
"friendly_name": "stairs motion group"
},
"last_changed": "2025-08-31T13:45:52.958696+00:00",
"last_reported": "2025-08-31T13:45:52.958696+00:00",
"last_updated": "2025-08-31T13:45:52.958696+00:00",
"context": {
"id": "01K40614HWPBG4H2XY6CV6HR3A",
"parent_id": null,
"user_id": null
}
},
"to_state": {
"entity_id": "binary_sensor.stairs_motion_group",
"state": "on",
"attributes": {
"entity_id": [
"binary_sensor.motion_3_occupancy",
"binary_sensor.motion_5_occupancy"
],
"friendly_name": "stairs motion group"
},
"last_changed": "2025-08-31T13:47:47.456933+00:00",
"last_reported": "2025-08-31T13:47:47.456933+00:00",
"last_updated": "2025-08-31T13:47:47.456933+00:00",
"context": {
"id": "01K4064MBZCG68ZRH6Y50RC3SX",
"parent_id": null,
"user_id": null
}
},
"for": null,
"attribute": null,
"description": "state of binary_sensor.stairs_motion_group"
}
}
}
],
"action/0": [
{
"path": "action/0",
"timestamp": "2025-08-31T13:47:47.458426+00:00",
"changed_variables": {
"context": {
"id": "01K4064MC1G9Z3A7M6GCKGBRVR",
"parent_id": "01K4064MBZCG68ZRH6Y50RC3SX",
"user_id": null
}
},
"result": {
"choice": 2
}
}
],
"action/0/choose/0": [
{
"path": "action/0/choose/0",
"timestamp": "2025-08-31T13:47:47.458548+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/0/conditions/0": [
{
"path": "action/0/choose/0/conditions/0",
"timestamp": "2025-08-31T13:47:47.458614+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/1": [
{
"path": "action/0/choose/1",
"timestamp": "2025-08-31T13:47:47.458724+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/1/conditions/0": [
{
"path": "action/0/choose/1/conditions/0",
"timestamp": "2025-08-31T13:47:47.458780+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/2": [
{
"path": "action/0/choose/2",
"timestamp": "2025-08-31T13:47:47.458848+00:00",
"result": {
"result": true
}
}
],
"action/0/choose/2/conditions/0": [
{
"path": "action/0/choose/2/conditions/0",
"timestamp": "2025-08-31T13:47:47.458895+00:00",
"result": {
"result": true
}
}
],
"action/0/choose/2/conditions/1": [
{
"path": "action/0/choose/2/conditions/1",
"timestamp": "2025-08-31T13:47:47.458941+00:00",
"result": {
"result": true
}
}
],
"action/0/choose/2/conditions/1/entity_id/0": [
{
"path": "action/0/choose/2/conditions/1/entity_id/0",
"timestamp": "2025-08-31T13:47:47.458975+00:00",
"result": {
"result": true,
"state": "off",
"wanted_state": "off"
}
}
],
"action/0/choose/2/sequence/0": [
{
"path": "action/0/choose/2/sequence/0",
"timestamp": "2025-08-31T13:47:47.459145+00:00",
"result": {
"params": {
"domain": "light",
"service": "turn_on",
"service_data": {},
"target": {
"entity_id": [
"light.switch_hallway_stairs_l2"
]
}
},
"running_script": false
}
}
]
},
"config": {
"mode": "queued",
"variables": {
"light_entity": "light.switch_hallway_stairs_l2",
"override_boolean": "input_boolean.manual_override_stairs",
"off_delay": 5,
"motion_group": "binary_sensor.stairs_motion_group"
},
"triggers": [
{
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from": "off",
"to": "on",
"id": "motion_on"
},
{
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from": "on",
"to": "off",
"id": "motion_off"
},
{
"platform": "state",
"entity_id": "light.switch_hallway_stairs_l2",
"from": "off",
"to": "on",
"id": "light_on"
},
{
"platform": "state",
"entity_id": "light.switch_hallway_stairs_l2",
"from": "on",
"to": "off",
"id": "light_off"
}
],
"actions": [
{
"choose": [
{
"conditions": [
{
"condition": "trigger",
"id": "light_off"
}
],
"sequence": [
{
"target": {
"entity_id": "input_boolean.manual_override_stairs"
},
"action": "input_boolean.turn_off"
}
]
},
{
"conditions": [
{
"condition": "trigger",
"id": "light_on"
},
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
},
{
"condition": "template",
"value_template": "{% set ctx = trigger.to_state.context %} {{ ctx.user_id is not none or ctx.parent_id is none }}\n"
}
],
"sequence": [
{
"target": {
"entity_id": "input_boolean.manual_override_stairs"
},
"action": "input_boolean.turn_on"
}
]
},
{
"conditions": [
{
"condition": "trigger",
"id": "motion_on"
},
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
}
],
"sequence": [
{
"target": {
"entity_id": "light.switch_hallway_stairs_l2"
},
"action": "light.turn_on"
}
]
},
{
"conditions": [
{
"condition": "trigger",
"id": "motion_off"
},
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
}
],
"sequence": [
{
"wait_for_trigger": [
{
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from": "off",
"to": "on"
}
],
"timeout": "00:00:{{ off_delay }}"
},
{
"condition": "and",
"conditions": [
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
},
{
"condition": "template",
"value_template": "{% set sensors = expand(motion_group) %} {{ sensors | selectattr('state','eq','off') | list | length ==\n sensors | list | length }}\n"
}
]
},
{
"target": {
"entity_id": "light.switch_hallway_stairs_l2"
},
"action": "light.turn_off"
}
]
}
],
"default": []
}
],
"id": "1737564570465",
"alias": "Motion-Activated Light with Manual Override Stairs",
"description": ""
},
"blueprint_inputs": {
"id": "1737564570465",
"alias": "Motion-Activated Light with Manual Override Stairs",
"description": "",
"use_blueprint": {
"path": "my_blueprints/motion_light_override.yaml",
"input": {
"motion_sensor_group": "binary_sensor.stairs_motion_group",
"target_light": "light.switch_hallway_stairs_l2",
"off_delay": 5,
"override_boolean": "input_boolean.manual_override_stairs",
"motion_trigger_flag": "input_boolean.motion_trigger_flag_stairs"
}
}
},
"context": {
"id": "01K4064MC1G9Z3A7M6GCKGBRVR",
"parent_id": "01K4064MBZCG68ZRH6Y50RC3SX",
"user_id": null
}
},
"logbookEntries": [
{
"name": "Motion-Activated Light with Manual Override Stairs",
"message": "triggered by state of binary_sensor.stairs_motion_group",
"source": "state of binary_sensor.stairs_motion_group",
"entity_id": "automation.motion_activated_light_with_manual_override_stairs",
"context_id": "01K4064MC1G9Z3A7M6GCKGBRVR",
"domain": "automation",
"when": 1756648067.458082
},
{
"state": "on",
"entity_id": "switch.switch_hallway_stairs_relay_right",
"when": 1756648067.5666027,
"context_event_type": "automation_triggered",
"context_domain": "automation",
"context_name": "Motion-Activated Light with Manual Override Stairs",
"context_message": "triggered by state of binary_sensor.stairs_motion_group",
"context_source": "state of binary_sensor.stairs_motion_group",
"context_entity_id": "automation.motion_activated_light_with_manual_override_stairs"
},
{
"state": "on",
"entity_id": "light.switch_hallway_stairs_l2",
"when": 1756648067.5672712,
"context_event_type": "automation_triggered",
"context_domain": "automation",
"context_name": "Motion-Activated Light with Manual Override Stairs",
"context_message": "triggered by state of binary_sensor.stairs_motion_group",
"context_source": "state of binary_sensor.stairs_motion_group",
"context_entity_id": "automation.motion_activated_light_with_manual_override_stairs"
},
{
"state": "3",
"entity_id": "sensor.active_lights_groundfloor",
"when": 1756648067.5700011,
"context_event_type": "automation_triggered",
"context_domain": "automation",
"context_name": "Motion-Activated Light with Manual Override Stairs",
"context_message": "triggered by state of binary_sensor.stairs_motion_group",
"context_source": "state of binary_sensor.stairs_motion_group",
"context_entity_id": "automation.motion_activated_light_with_manual_override_stairs"
},
{
"state": "off",
"entity_id": "switch.switch_hallway_stairs_relay_right",
"when": 1756648069.2194595,
"context_event_type": "automation_triggered",
"context_domain": "automation",
"context_name": "Motion-Activated Light with Manual Override Stairs",
"context_message": "triggered by state of binary_sensor.stairs_motion_group",
"context_source": "state of binary_sensor.stairs_motion_group",
"context_entity_id": "automation.motion_activated_light_with_manual_override_stairs"
},
{
"state": "off",
"entity_id": "light.switch_hallway_stairs_l2",
"when": 1756648069.223788,
"context_event_type": "automation_triggered",
"context_domain": "automation",
"context_name": "Motion-Activated Light with Manual Override Stairs",
"context_message": "triggered by state of binary_sensor.stairs_motion_group",
"context_source": "state of binary_sensor.stairs_motion_group",
"context_entity_id": "automation.motion_activated_light_with_manual_override_stairs"
},
{
"state": "2",
"entity_id": "sensor.active_lights_groundfloor",
"when": 1756648069.2283192,
"context_event_type": "automation_triggered",
"context_domain": "automation",
"context_name": "Motion-Activated Light with Manual Override Stairs",
"context_message": "triggered by state of binary_sensor.stairs_motion_group",
"context_source": "state of binary_sensor.stairs_motion_group",
"context_entity_id": "automation.motion_activated_light_with_manual_override_stairs"
}
]
}
Trace 2:
{
"trace": {
"last_step": "action/0/choose/3/conditions/0",
"run_id": "9620f7fde217fc486e742568daba7fd6",
"state": "stopped",
"script_execution": "finished",
"timestamp": {
"start": "2025-08-31T13:47:47.570777+00:00",
"finish": "2025-08-31T13:47:47.572253+00:00"
},
"domain": "automation",
"item_id": "1737564570465",
"trigger": "state of light.switch_hallway_stairs_l2",
"trace": {
"trigger/2": [
{
"path": "trigger/2",
"timestamp": "2025-08-31T13:47:47.570895+00:00",
"changed_variables": {
"light_entity": "light.switch_hallway_stairs_l2",
"override_boolean": "input_boolean.manual_override_stairs",
"off_delay": 5,
"motion_group": "binary_sensor.stairs_motion_group",
"this": {
"entity_id": "automation.motion_activated_light_with_manual_override_stairs",
"state": "on",
"attributes": {
"id": "1737564570465",
"last_triggered": "2025-08-31T13:47:47.458119+00:00",
"mode": "queued",
"current": 0,
"max": 10,
"friendly_name": "Motion-Activated Light with Manual Override Stairs"
},
"last_changed": "2025-08-31T13:08:04.911242+00:00",
"last_reported": "2025-08-31T13:47:47.467022+00:00",
"last_updated": "2025-08-31T13:47:47.467022+00:00",
"context": {
"id": "01K4064MC1G9Z3A7M6GCKGBRVR",
"parent_id": "01K4064MBZCG68ZRH6Y50RC3SX",
"user_id": null
}
},
"trigger": {
"id": "light_on",
"idx": "2",
"alias": null,
"platform": "state",
"entity_id": "light.switch_hallway_stairs_l2",
"from_state": {
"entity_id": "light.switch_hallway_stairs_l2",
"state": "off",
"attributes": {
"supported_color_modes": [
"onoff"
],
"color_mode": null,
"friendly_name": "Switch Hallway Stairs Relay_right",
"supported_features": 0
},
"last_changed": "2025-08-31T13:45:58.079401+00:00",
"last_reported": "2025-08-31T13:45:58.079401+00:00",
"last_updated": "2025-08-31T13:45:58.079401+00:00",
"context": {
"id": "01K40614HZQ5SYSEE08A7YK2WW",
"parent_id": "01K40614HWPBG4H2XY6CV6HR3A",
"user_id": null
}
},
"to_state": {
"entity_id": "light.switch_hallway_stairs_l2",
"state": "on",
"attributes": {
"supported_color_modes": [
"onoff"
],
"color_mode": "onoff",
"friendly_name": "Switch Hallway Stairs Relay_right",
"supported_features": 0
},
"last_changed": "2025-08-31T13:47:47.567271+00:00",
"last_reported": "2025-08-31T13:47:47.567271+00:00",
"last_updated": "2025-08-31T13:47:47.567271+00:00",
"context": {
"id": "01K4064MC1G9Z3A7M6GCKGBRVR",
"parent_id": "01K4064MBZCG68ZRH6Y50RC3SX",
"user_id": null
}
},
"for": null,
"attribute": null,
"description": "state of light.switch_hallway_stairs_l2"
}
}
}
],
"action/0": [
{
"path": "action/0",
"timestamp": "2025-08-31T13:47:47.571187+00:00",
"changed_variables": {
"context": {
"id": "01K4064MFJP1SQG80JVNXHFWPX",
"parent_id": "01K4064MC1G9Z3A7M6GCKGBRVR",
"user_id": null
}
},
"result": {
"choice": "default"
}
}
],
"action/0/choose/0": [
{
"path": "action/0/choose/0",
"timestamp": "2025-08-31T13:47:47.571258+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/0/conditions/0": [
{
"path": "action/0/choose/0/conditions/0",
"timestamp": "2025-08-31T13:47:47.571304+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/1": [
{
"path": "action/0/choose/1",
"timestamp": "2025-08-31T13:47:47.571382+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/1/conditions/0": [
{
"path": "action/0/choose/1/conditions/0",
"timestamp": "2025-08-31T13:47:47.571419+00:00",
"result": {
"result": true
}
}
],
"action/0/choose/1/conditions/1": [
{
"path": "action/0/choose/1/conditions/1",
"timestamp": "2025-08-31T13:47:47.571469+00:00",
"result": {
"result": true
}
}
],
"action/0/choose/1/conditions/1/entity_id/0": [
{
"path": "action/0/choose/1/conditions/1/entity_id/0",
"timestamp": "2025-08-31T13:47:47.571505+00:00",
"result": {
"result": true,
"state": "off",
"wanted_state": "off"
}
}
],
"action/0/choose/1/conditions/2": [
{
"path": "action/0/choose/1/conditions/2",
"timestamp": "2025-08-31T13:47:47.571552+00:00",
"result": {
"result": false,
"entities": []
}
}
],
"action/0/choose/2": [
{
"path": "action/0/choose/2",
"timestamp": "2025-08-31T13:47:47.571776+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/2/conditions/0": [
{
"path": "action/0/choose/2/conditions/0",
"timestamp": "2025-08-31T13:47:47.571818+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/3": [
{
"path": "action/0/choose/3",
"timestamp": "2025-08-31T13:47:47.571886+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/3/conditions/0": [
{
"path": "action/0/choose/3/conditions/0",
"timestamp": "2025-08-31T13:47:47.571924+00:00",
"result": {
"result": false
}
}
]
},
"config": {
"mode": "queued",
"variables": {
"light_entity": "light.switch_hallway_stairs_l2",
"override_boolean": "input_boolean.manual_override_stairs",
"off_delay": 5,
"motion_group": "binary_sensor.stairs_motion_group"
},
"triggers": [
{
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from": "off",
"to": "on",
"id": "motion_on"
},
{
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from": "on",
"to": "off",
"id": "motion_off"
},
{
"platform": "state",
"entity_id": "light.switch_hallway_stairs_l2",
"from": "off",
"to": "on",
"id": "light_on"
},
{
"platform": "state",
"entity_id": "light.switch_hallway_stairs_l2",
"from": "on",
"to": "off",
"id": "light_off"
}
],
"actions": [
{
"choose": [
{
"conditions": [
{
"condition": "trigger",
"id": "light_off"
}
],
"sequence": [
{
"target": {
"entity_id": "input_boolean.manual_override_stairs"
},
"action": "input_boolean.turn_off"
}
]
},
{
"conditions": [
{
"condition": "trigger",
"id": "light_on"
},
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
},
{
"condition": "template",
"value_template": "{% set ctx = trigger.to_state.context %} {{ ctx.user_id is not none or ctx.parent_id is none }}\n"
}
],
"sequence": [
{
"target": {
"entity_id": "input_boolean.manual_override_stairs"
},
"action": "input_boolean.turn_on"
}
]
},
{
"conditions": [
{
"condition": "trigger",
"id": "motion_on"
},
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
}
],
"sequence": [
{
"target": {
"entity_id": "light.switch_hallway_stairs_l2"
},
"action": "light.turn_on"
}
]
},
{
"conditions": [
{
"condition": "trigger",
"id": "motion_off"
},
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
}
],
"sequence": [
{
"wait_for_trigger": [
{
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from": "off",
"to": "on"
}
],
"timeout": "00:00:{{ off_delay }}"
},
{
"condition": "and",
"conditions": [
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
},
{
"condition": "template",
"value_template": "{% set sensors = expand(motion_group) %} {{ sensors | selectattr('state','eq','off') | list | length ==\n sensors | list | length }}\n"
}
]
},
{
"target": {
"entity_id": "light.switch_hallway_stairs_l2"
},
"action": "light.turn_off"
}
]
}
],
"default": []
}
],
"id": "1737564570465",
"alias": "Motion-Activated Light with Manual Override Stairs",
"description": ""
},
"blueprint_inputs": {
"id": "1737564570465",
"alias": "Motion-Activated Light with Manual Override Stairs",
"description": "",
"use_blueprint": {
"path": "my_blueprints/motion_light_override.yaml",
"input": {
"motion_sensor_group": "binary_sensor.stairs_motion_group",
"target_light": "light.switch_hallway_stairs_l2",
"off_delay": 5,
"override_boolean": "input_boolean.manual_override_stairs",
"motion_trigger_flag": "input_boolean.motion_trigger_flag_stairs"
}
}
},
"context": {
"id": "01K4064MFJP1SQG80JVNXHFWPX",
"parent_id": "01K4064MC1G9Z3A7M6GCKGBRVR",
"user_id": null
}
},
"logbookEntries": [
{
"name": "Motion-Activated Light with Manual Override Stairs",
"message": "triggered by state of light.switch_hallway_stairs_l2",
"source": "state of light.switch_hallway_stairs_l2",
"entity_id": "automation.motion_activated_light_with_manual_override_stairs",
"context_id": "01K4064MFJP1SQG80JVNXHFWPX",
"domain": "automation",
"when": 1756648067.5709565
}
]
}
Trace 3:
{
"trace": {
"last_step": "action/0/choose/0/sequence/0",
"run_id": "ee0cf3324d5d3ed4758c2d122b288aa2",
"state": "stopped",
"script_execution": "finished",
"timestamp": {
"start": "2025-08-31T13:47:49.229297+00:00",
"finish": "2025-08-31T13:47:49.231518+00:00"
},
"domain": "automation",
"item_id": "1737564570465",
"trigger": "state of light.switch_hallway_stairs_l2",
"trace": {
"trigger/3": [
{
"path": "trigger/3",
"timestamp": "2025-08-31T13:47:49.229642+00:00",
"changed_variables": {
"light_entity": "light.switch_hallway_stairs_l2",
"override_boolean": "input_boolean.manual_override_stairs",
"off_delay": 5,
"motion_group": "binary_sensor.stairs_motion_group",
"this": {
"entity_id": "automation.motion_activated_light_with_manual_override_stairs",
"state": "on",
"attributes": {
"id": "1737564570465",
"last_triggered": "2025-08-31T13:47:47.570959+00:00",
"mode": "queued",
"current": 0,
"max": 10,
"friendly_name": "Motion-Activated Light with Manual Override Stairs"
},
"last_changed": "2025-08-31T13:08:04.911242+00:00",
"last_reported": "2025-08-31T13:47:47.572125+00:00",
"last_updated": "2025-08-31T13:47:47.572125+00:00",
"context": {
"id": "01K4064MFJP1SQG80JVNXHFWPX",
"parent_id": "01K4064MC1G9Z3A7M6GCKGBRVR",
"user_id": null
}
},
"trigger": {
"id": "light_off",
"idx": "3",
"alias": null,
"platform": "state",
"entity_id": "light.switch_hallway_stairs_l2",
"from_state": {
"entity_id": "light.switch_hallway_stairs_l2",
"state": "on",
"attributes": {
"supported_color_modes": [
"onoff"
],
"color_mode": "onoff",
"friendly_name": "Switch Hallway Stairs Relay_right",
"supported_features": 0
},
"last_changed": "2025-08-31T13:47:47.567271+00:00",
"last_reported": "2025-08-31T13:47:47.567271+00:00",
"last_updated": "2025-08-31T13:47:47.567271+00:00",
"context": {
"id": "01K4064MC1G9Z3A7M6GCKGBRVR",
"parent_id": "01K4064MBZCG68ZRH6Y50RC3SX",
"user_id": null
}
},
"to_state": {
"entity_id": "light.switch_hallway_stairs_l2",
"state": "off",
"attributes": {
"supported_color_modes": [
"onoff"
],
"color_mode": null,
"friendly_name": "Switch Hallway Stairs Relay_right",
"supported_features": 0
},
"last_changed": "2025-08-31T13:47:49.223788+00:00",
"last_reported": "2025-08-31T13:47:49.223788+00:00",
"last_updated": "2025-08-31T13:47:49.223788+00:00",
"context": {
"id": "01K4064MC1G9Z3A7M6GCKGBRVR",
"parent_id": "01K4064MBZCG68ZRH6Y50RC3SX",
"user_id": null
}
},
"for": null,
"attribute": null,
"description": "state of light.switch_hallway_stairs_l2"
}
}
}
],
"action/0": [
{
"path": "action/0",
"timestamp": "2025-08-31T13:47:49.230116+00:00",
"changed_variables": {
"context": {
"id": "01K4064P3DJEKFGKGE6Y4QW19R",
"parent_id": "01K4064MC1G9Z3A7M6GCKGBRVR",
"user_id": null
}
},
"result": {
"choice": 0
}
}
],
"action/0/choose/0": [
{
"path": "action/0/choose/0",
"timestamp": "2025-08-31T13:47:49.230247+00:00",
"result": {
"result": true
}
}
],
"action/0/choose/0/conditions/0": [
{
"path": "action/0/choose/0/conditions/0",
"timestamp": "2025-08-31T13:47:49.230313+00:00",
"result": {
"result": true
}
}
],
"action/0/choose/0/sequence/0": [
{
"path": "action/0/choose/0/sequence/0",
"timestamp": "2025-08-31T13:47:49.230504+00:00",
"result": {
"params": {
"domain": "input_boolean",
"service": "turn_off",
"service_data": {},
"target": {
"entity_id": [
"input_boolean.manual_override_stairs"
]
}
},
"running_script": false
}
}
]
},
"config": {
"mode": "queued",
"variables": {
"light_entity": "light.switch_hallway_stairs_l2",
"override_boolean": "input_boolean.manual_override_stairs",
"off_delay": 5,
"motion_group": "binary_sensor.stairs_motion_group"
},
"triggers": [
{
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from": "off",
"to": "on",
"id": "motion_on"
},
{
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from": "on",
"to": "off",
"id": "motion_off"
},
{
"platform": "state",
"entity_id": "light.switch_hallway_stairs_l2",
"from": "off",
"to": "on",
"id": "light_on"
},
{
"platform": "state",
"entity_id": "light.switch_hallway_stairs_l2",
"from": "on",
"to": "off",
"id": "light_off"
}
],
"actions": [
{
"choose": [
{
"conditions": [
{
"condition": "trigger",
"id": "light_off"
}
],
"sequence": [
{
"target": {
"entity_id": "input_boolean.manual_override_stairs"
},
"action": "input_boolean.turn_off"
}
]
},
{
"conditions": [
{
"condition": "trigger",
"id": "light_on"
},
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
},
{
"condition": "template",
"value_template": "{% set ctx = trigger.to_state.context %} {{ ctx.user_id is not none or ctx.parent_id is none }}\n"
}
],
"sequence": [
{
"target": {
"entity_id": "input_boolean.manual_override_stairs"
},
"action": "input_boolean.turn_on"
}
]
},
{
"conditions": [
{
"condition": "trigger",
"id": "motion_on"
},
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
}
],
"sequence": [
{
"target": {
"entity_id": "light.switch_hallway_stairs_l2"
},
"action": "light.turn_on"
}
]
},
{
"conditions": [
{
"condition": "trigger",
"id": "motion_off"
},
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
}
],
"sequence": [
{
"wait_for_trigger": [
{
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from": "off",
"to": "on"
}
],
"timeout": "00:00:{{ off_delay }}"
},
{
"condition": "and",
"conditions": [
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
},
{
"condition": "template",
"value_template": "{% set sensors = expand(motion_group) %} {{ sensors | selectattr('state','eq','off') | list | length ==\n sensors | list | length }}\n"
}
]
},
{
"target": {
"entity_id": "light.switch_hallway_stairs_l2"
},
"action": "light.turn_off"
}
]
}
],
"default": []
}
],
"id": "1737564570465",
"alias": "Motion-Activated Light with Manual Override Stairs",
"description": ""
},
"blueprint_inputs": {
"id": "1737564570465",
"alias": "Motion-Activated Light with Manual Override Stairs",
"description": "",
"use_blueprint": {
"path": "my_blueprints/motion_light_override.yaml",
"input": {
"motion_sensor_group": "binary_sensor.stairs_motion_group",
"target_light": "light.switch_hallway_stairs_l2",
"off_delay": 5,
"override_boolean": "input_boolean.manual_override_stairs",
"motion_trigger_flag": "input_boolean.motion_trigger_flag_stairs"
}
}
},
"context": {
"id": "01K4064P3DJEKFGKGE6Y4QW19R",
"parent_id": "01K4064MC1G9Z3A7M6GCKGBRVR",
"user_id": null
}
},
"logbookEntries": [
{
"name": "Motion-Activated Light with Manual Override Stairs",
"message": "triggered by state of light.switch_hallway_stairs_l2",
"source": "state of light.switch_hallway_stairs_l2",
"entity_id": "automation.motion_activated_light_with_manual_override_stairs",
"context_id": "01K4064P3DJEKFGKGE6Y4QW19R",
"domain": "automation",
"when": 1756648069.2297516
}
]
}
Trace 4:
{
"trace": {
"last_step": "action/0/choose/3/sequence/2",
"run_id": "dbb16e2b1b9a0b5f6bc1f95911902c93",
"state": "stopped",
"script_execution": "finished",
"timestamp": {
"start": "2025-08-31T13:48:19.469854+00:00",
"finish": "2025-08-31T13:48:24.483774+00:00"
},
"domain": "automation",
"item_id": "1737564570465",
"trigger": "state of binary_sensor.stairs_motion_group",
"trace": {
"trigger/1": [
{
"path": "trigger/1",
"timestamp": "2025-08-31T13:48:19.470447+00:00",
"changed_variables": {
"light_entity": "light.switch_hallway_stairs_l2",
"override_boolean": "input_boolean.manual_override_stairs",
"off_delay": 5,
"motion_group": "binary_sensor.stairs_motion_group",
"this": {
"entity_id": "automation.motion_activated_light_with_manual_override_stairs",
"state": "on",
"attributes": {
"id": "1737564570465",
"last_triggered": "2025-08-31T13:47:49.229755+00:00",
"mode": "queued",
"current": 0,
"max": 10,
"friendly_name": "Motion-Activated Light with Manual Override Stairs"
},
"last_changed": "2025-08-31T13:08:04.911242+00:00",
"last_reported": "2025-08-31T13:47:49.231381+00:00",
"last_updated": "2025-08-31T13:47:49.231381+00:00",
"context": {
"id": "01K4064P3DJEKFGKGE6Y4QW19R",
"parent_id": "01K4064MC1G9Z3A7M6GCKGBRVR",
"user_id": null
}
},
"trigger": {
"id": "motion_off",
"idx": "1",
"alias": null,
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from_state": {
"entity_id": "binary_sensor.stairs_motion_group",
"state": "on",
"attributes": {
"entity_id": [
"binary_sensor.motion_3_occupancy",
"binary_sensor.motion_5_occupancy"
],
"friendly_name": "stairs motion group"
},
"last_changed": "2025-08-31T13:47:47.456933+00:00",
"last_reported": "2025-08-31T13:47:47.456933+00:00",
"last_updated": "2025-08-31T13:47:47.456933+00:00",
"context": {
"id": "01K4064MBZCG68ZRH6Y50RC3SX",
"parent_id": null,
"user_id": null
}
},
"to_state": {
"entity_id": "binary_sensor.stairs_motion_group",
"state": "off",
"attributes": {
"entity_id": [
"binary_sensor.motion_3_occupancy",
"binary_sensor.motion_5_occupancy"
],
"friendly_name": "stairs motion group"
},
"last_changed": "2025-08-31T13:48:19.468634+00:00",
"last_reported": "2025-08-31T13:48:19.468634+00:00",
"last_updated": "2025-08-31T13:48:19.468634+00:00",
"context": {
"id": "01K4065KM9ADVGVYTZPR1TTWAZ",
"parent_id": null,
"user_id": null
}
},
"for": null,
"attribute": null,
"description": "state of binary_sensor.stairs_motion_group"
}
}
}
],
"action/0": [
{
"path": "action/0",
"timestamp": "2025-08-31T13:48:19.471015+00:00",
"changed_variables": {
"context": {
"id": "01K4065KMDXY306WM5Z9TX5GYF",
"parent_id": "01K4065KM9ADVGVYTZPR1TTWAZ",
"user_id": null
},
"wait": {
"remaining": 0,
"completed": false,
"trigger": null
}
},
"result": {
"choice": 3
}
}
],
"action/0/choose/0": [
{
"path": "action/0/choose/0",
"timestamp": "2025-08-31T13:48:19.471186+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/0/conditions/0": [
{
"path": "action/0/choose/0/conditions/0",
"timestamp": "2025-08-31T13:48:19.471270+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/1": [
{
"path": "action/0/choose/1",
"timestamp": "2025-08-31T13:48:19.471399+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/1/conditions/0": [
{
"path": "action/0/choose/1/conditions/0",
"timestamp": "2025-08-31T13:48:19.471439+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/2": [
{
"path": "action/0/choose/2",
"timestamp": "2025-08-31T13:48:19.471511+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/2/conditions/0": [
{
"path": "action/0/choose/2/conditions/0",
"timestamp": "2025-08-31T13:48:19.471558+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/3": [
{
"path": "action/0/choose/3",
"timestamp": "2025-08-31T13:48:19.471612+00:00",
"result": {
"result": true
}
}
],
"action/0/choose/3/conditions/0": [
{
"path": "action/0/choose/3/conditions/0",
"timestamp": "2025-08-31T13:48:19.471672+00:00",
"result": {
"result": true
}
}
],
"action/0/choose/3/conditions/1": [
{
"path": "action/0/choose/3/conditions/1",
"timestamp": "2025-08-31T13:48:19.471725+00:00",
"result": {
"result": true
}
}
],
"action/0/choose/3/conditions/1/entity_id/0": [
{
"path": "action/0/choose/3/conditions/1/entity_id/0",
"timestamp": "2025-08-31T13:48:19.471760+00:00",
"result": {
"result": true,
"state": "off",
"wanted_state": "off"
}
}
],
"action/0/choose/3/sequence/0": [
{
"path": "action/0/choose/3/sequence/0",
"timestamp": "2025-08-31T13:48:19.471935+00:00",
"changed_variables": {
"wait": {
"remaining": 0,
"completed": false,
"trigger": null
}
},
"result": {
"wait": {
"remaining": 0,
"completed": false,
"trigger": null
}
}
}
],
"action/0/choose/3/sequence/1": [
{
"path": "action/0/choose/3/sequence/1",
"timestamp": "2025-08-31T13:48:24.473826+00:00",
"result": {
"result": true
}
}
],
"action/0/choose/3/sequence/1/conditions/0": [
{
"path": "action/0/choose/3/sequence/1/conditions/0",
"timestamp": "2025-08-31T13:48:24.473993+00:00",
"result": {
"result": true
}
}
],
"action/0/choose/3/sequence/1/conditions/0/entity_id/0": [
{
"path": "action/0/choose/3/sequence/1/conditions/0/entity_id/0",
"timestamp": "2025-08-31T13:48:24.474047+00:00",
"result": {
"result": true,
"state": "off",
"wanted_state": "off"
}
}
],
"action/0/choose/3/sequence/1/conditions/1": [
{
"path": "action/0/choose/3/sequence/1/conditions/1",
"timestamp": "2025-08-31T13:48:24.474116+00:00",
"result": {
"result": true,
"entities": [
"binary_sensor.motion_3_occupancy",
"binary_sensor.stairs_motion_group",
"binary_sensor.motion_5_occupancy"
]
}
}
],
"action/0/choose/3/sequence/2": [
{
"path": "action/0/choose/3/sequence/2",
"timestamp": "2025-08-31T13:48:24.474537+00:00",
"result": {
"params": {
"domain": "light",
"service": "turn_off",
"service_data": {},
"target": {
"entity_id": [
"light.switch_hallway_stairs_l2"
]
}
},
"running_script": false
}
}
]
},
"config": {
"mode": "queued",
"variables": {
"light_entity": "light.switch_hallway_stairs_l2",
"override_boolean": "input_boolean.manual_override_stairs",
"off_delay": 5,
"motion_group": "binary_sensor.stairs_motion_group"
},
"triggers": [
{
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from": "off",
"to": "on",
"id": "motion_on"
},
{
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from": "on",
"to": "off",
"id": "motion_off"
},
{
"platform": "state",
"entity_id": "light.switch_hallway_stairs_l2",
"from": "off",
"to": "on",
"id": "light_on"
},
{
"platform": "state",
"entity_id": "light.switch_hallway_stairs_l2",
"from": "on",
"to": "off",
"id": "light_off"
}
],
"actions": [
{
"choose": [
{
"conditions": [
{
"condition": "trigger",
"id": "light_off"
}
],
"sequence": [
{
"target": {
"entity_id": "input_boolean.manual_override_stairs"
},
"action": "input_boolean.turn_off"
}
]
},
{
"conditions": [
{
"condition": "trigger",
"id": "light_on"
},
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
},
{
"condition": "template",
"value_template": "{% set ctx = trigger.to_state.context %} {{ ctx.user_id is not none or ctx.parent_id is none }}\n"
}
],
"sequence": [
{
"target": {
"entity_id": "input_boolean.manual_override_stairs"
},
"action": "input_boolean.turn_on"
}
]
},
{
"conditions": [
{
"condition": "trigger",
"id": "motion_on"
},
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
}
],
"sequence": [
{
"target": {
"entity_id": "light.switch_hallway_stairs_l2"
},
"action": "light.turn_on"
}
]
},
{
"conditions": [
{
"condition": "trigger",
"id": "motion_off"
},
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
}
],
"sequence": [
{
"wait_for_trigger": [
{
"platform": "state",
"entity_id": "binary_sensor.stairs_motion_group",
"from": "off",
"to": "on"
}
],
"timeout": "00:00:{{ off_delay }}"
},
{
"condition": "and",
"conditions": [
{
"condition": "state",
"entity_id": "input_boolean.manual_override_stairs",
"state": "off"
},
{
"condition": "template",
"value_template": "{% set sensors = expand(motion_group) %} {{ sensors | selectattr('state','eq','off') | list | length ==\n sensors | list | length }}\n"
}
]
},
{
"target": {
"entity_id": "light.switch_hallway_stairs_l2"
},
"action": "light.turn_off"
}
]
}
],
"default": []
}
],
"id": "1737564570465",
"alias": "Motion-Activated Light with Manual Override Stairs",
"description": ""
},
"blueprint_inputs": {
"id": "1737564570465",
"alias": "Motion-Activated Light with Manual Override Stairs",
"description": "",
"use_blueprint": {
"path": "my_blueprints/motion_light_override.yaml",
"input": {
"motion_sensor_group": "binary_sensor.stairs_motion_group",
"target_light": "light.switch_hallway_stairs_l2",
"off_delay": 5,
"override_boolean": "input_boolean.manual_override_stairs",
"motion_trigger_flag": "input_boolean.motion_trigger_flag_stairs"
}
}
},
"context": {
"id": "01K4065KMDXY306WM5Z9TX5GYF",
"parent_id": "01K4065KM9ADVGVYTZPR1TTWAZ",
"user_id": null
}
},
"logbookEntries": [
{
"name": "Motion-Activated Light with Manual Override Stairs",
"message": "triggered by state of binary_sensor.stairs_motion_group",
"source": "state of binary_sensor.stairs_motion_group",
"entity_id": "automation.motion_activated_light_with_manual_override_stairs",
"context_id": "01K4065KMDXY306WM5Z9TX5GYF",
"domain": "automation",
"when": 1756648099.470562
}
]
}
Logbook:
and can you download the history for the light please. and take a screenshot of the logbook for the light in the logbook page. If you know how to get the logbook from your history as entries by doing a query, that would also help.
Then once you have that information, post it in the issue or create a new one with all of that information so someone can reproduce it.
Petro, many thanks for your help! Below I’ve included the history and logbook for this case.
History:
[
[
{
"entity_id": "light.switch_hallway_stairs_l2",
"state": "off",
"attributes": {
"friendly_name": "Switch Hallway Stairs Relay_right"
},
"last_changed": "2025-08-31T13:45:00+00:00",
"last_updated": "2025-08-31T13:45:00+00:00"
},
{
"entity_id": "light.switch_hallway_stairs_l2",
"state": "on",
"attributes": {
"friendly_name": "Switch Hallway Stairs Relay_right"
},
"last_changed": "2025-08-31T13:45:16.624851+00:00",
"last_updated": "2025-08-31T13:45:16.624851+00:00"
},
{
"entity_id": "light.switch_hallway_stairs_l2",
"state": "off",
"attributes": {
"friendly_name": "Switch Hallway Stairs Relay_right"
},
"last_changed": "2025-08-31T13:45:58.079401+00:00",
"last_updated": "2025-08-31T13:45:58.079401+00:00"
},
{
"entity_id": "light.switch_hallway_stairs_l2",
"state": "on",
"attributes": {
"friendly_name": "Switch Hallway Stairs Relay_right"
},
"last_changed": "2025-08-31T13:47:47.567271+00:00",
"last_updated": "2025-08-31T13:47:47.567271+00:00"
},
{
"entity_id": "light.switch_hallway_stairs_l2",
"state": "off",
"attributes": {
"friendly_name": "Switch Hallway Stairs Relay_right"
},
"last_changed": "2025-08-31T13:47:49.223788+00:00",
"last_updated": "2025-08-31T13:47:49.223788+00:00"
}
]
]
Logbook:
[
{
"state": "on",
"entity_id": "light.switch_hallway_stairs_l2",
"name": "Switch Hallway Stairs Relay_right",
"when": "2025-08-31T13:45:16.624851+00:00",
"context_event_type": "automation_triggered",
"context_domain": "automation",
"context_name": "Motion-Activated Light with Manual Override Stairs",
"context_message": "triggered by state of binary_sensor.stairs_motion_group",
"context_source": "state of binary_sensor.stairs_motion_group",
"context_entity_id": "automation.motion_activated_light_with_manual_override_stairs",
"context_entity_id_name": "Motion-Activated Light with Manual Override Stairs"
},
{
"state": "off",
"entity_id": "light.switch_hallway_stairs_l2",
"name": "Switch Hallway Stairs Relay_right",
"when": "2025-08-31T13:45:58.079401+00:00",
"context_event_type": "automation_triggered",
"context_domain": "automation",
"context_name": "Motion-Activated Light with Manual Override Stairs",
"context_message": "triggered by state of binary_sensor.stairs_motion_group",
"context_source": "state of binary_sensor.stairs_motion_group",
"context_entity_id": "automation.motion_activated_light_with_manual_override_stairs",
"context_entity_id_name": "Motion-Activated Light with Manual Override Stairs"
},
{
"state": "on",
"entity_id": "light.switch_hallway_stairs_l2",
"name": "Switch Hallway Stairs Relay_right",
"when": "2025-08-31T13:47:47.567271+00:00",
"context_event_type": "automation_triggered",
"context_domain": "automation",
"context_name": "Motion-Activated Light with Manual Override Stairs",
"context_message": "triggered by state of binary_sensor.stairs_motion_group",
"context_source": "state of binary_sensor.stairs_motion_group",
"context_entity_id": "automation.motion_activated_light_with_manual_override_stairs",
"context_entity_id_name": "Motion-Activated Light with Manual Override Stairs"
},
{
"state": "off",
"entity_id": "light.switch_hallway_stairs_l2",
"name": "Switch Hallway Stairs Relay_right",
"when": "2025-08-31T13:47:49.223788+00:00",
"context_event_type": "automation_triggered",
"context_domain": "automation",
"context_name": "Motion-Activated Light with Manual Override Stairs",
"context_message": "triggered by state of binary_sensor.stairs_motion_group",
"context_source": "state of binary_sensor.stairs_motion_group",
"context_entity_id": "automation.motion_activated_light_with_manual_override_stairs",
"context_entity_id_name": "Motion-Activated Light with Manual Override Stairs"
}
]
Well, if you’re claiming that trace 3 and history 4 and logbook 4 are a physical press outside the automation, then there may be a bug here and you should add all this information to the issue on github. I think it would also be helpful to post the history and logbook information for the motion sensor as well.
I don’t think there’s any other information that would be needed to diagnose the problem.
I’ve done that, thanks. I also noticed that in cases where no parent ID is recorded for an action that was actually triggered by automation, there is a delay of several seconds between when the automation is triggered and when the turn_on event is logged. This might be due to a lost command or simply the Zigbee device taking longer to report back.
I have developed a sensor Integration which will provide full info on who and where and when and how a device was triggered. It works with all physical devices, plus helpers, groups, and templated devices. It will inform you whether a device was triggered manually, dashboard, automation, script or scene, with Attributes detailing the name of the actual script, automation or scene, or the user.
It’s quite handy for quick debugging but it’s also quite powerful for use in automations where you want to override actions based on how a device is triggered.
I discovered there a lot things going on under the hood with HA which make it quite challenging to get accurate results, especially using just YAML. Apologies if you also read this same post on a related thread, I just want to get the word out. Hopefully someone will find this integration helpful.


