Hi there,
I’m reasonably experienced with HA, but am completely stuck on this one - maybe it just needs a new set of eyes, but I’m drawing a blank.
I’ve had an automation for ages that turned on my desk light when I started using my Mac Mini sitting permenantly on the same desk. Recently, I switch out the Mac Mini for a MacBook with an external monitor. I now want the desk light automation to only turn on my desk light when I’m using the MacBook at the desk (and obviously not if I’m sitting on the sofa). I’ve therefore added a Condition to the existing automation to only trigger the desk light if the MacBook is also connected to the external monitor (the MacBook runs HA Companion, so I capture various info about the state of the MacBook).
All sounds great, except it won’t work (Condition is never met).
When I look at the Trace, however, the Display ID in the condition is met when the MacBook is plugged in, so I’m at a complete loss as to why the Condition is claiming not to be met.
I thought it might a variable type issue, but I don’t get to chose this with the automation, so I guess not.
Below are both the screen shots of the Trace, which shows that the Display ID appears to be exactly the same as the Display ID I’m testing for in the Condition:
and the full Trace file is below if it helps any to tell me why this isn’t working.
I’m completely stuck!
Thanks, HC
{
"trace": {
"last_step": "condition/0/entity_id/0",
"run_id": "1fbe6a4937b7c68548ef6b5fd3b501c2",
"state": "stopped",
"script_execution": "failed_conditions",
"timestamp": {
"start": "2024-10-10T07:35:56.307114+00:00",
"finish": "2024-10-10T07:35:56.307245+00:00"
},
"domain": "automation",
"item_id": "1702762645406",
"trigger": "state of binary_sensor.dmb_mbp_active",
"trace": {
"trigger/0": [
{
"path": "trigger/0",
"timestamp": "2024-10-10T07:35:56.307190+00:00",
"changed_variables": {
"this": {
"entity_id": "automation.libbys_desklight_automation",
"state": "on",
"attributes": {
"id": "1702762645406",
"last_triggered": "2024-09-30T15:25:40.885861+00:00",
"mode": "single",
"current": 0,
"friendly_name": "Libbys Desklight Automation"
},
"last_changed": "2024-10-09T22:40:40.155870+00:00",
"last_reported": "2024-10-09T22:40:40.155870+00:00",
"last_updated": "2024-10-09T22:40:40.155870+00:00",
"context": {
"id": "01J9SQ21PVH4ZGWYVM6H2TGC7B",
"parent_id": null,
"user_id": null
}
},
"trigger": {
"id": "0",
"idx": "0",
"alias": null,
"platform": "device",
"entity_id": "binary_sensor.dmb_mbp_active",
"from_state": {
"entity_id": "binary_sensor.dmb_mbp_active",
"state": "off",
"attributes": {
"Fast User Switched": false,
"Idle": false,
"Locked": true,
"Screen Off": false,
"Screensaver": false,
"Sleeping": false,
"Terminating": false,
"icon": "mdi:monitor-off",
"friendly_name": "DMB-MBP Active"
},
"last_changed": "2024-10-10T07:35:43.878748+00:00",
"last_reported": "2024-10-10T07:35:56.304463+00:00",
"last_updated": "2024-10-10T07:35:56.276600+00:00",
"context": {
"id": "01J9TNP53MYPXT47XP72BW2NEZ",
"parent_id": null,
"user_id": null
}
},
"to_state": {
"entity_id": "binary_sensor.dmb_mbp_active",
"state": "on",
"attributes": {
"Fast User Switched": false,
"Idle": false,
"Locked": false,
"Screen Off": false,
"Screensaver": false,
"Sleeping": false,
"Terminating": false,
"icon": "mdi:monitor",
"friendly_name": "DMB-MBP Active"
},
"last_changed": "2024-10-10T07:35:56.306542+00:00",
"last_reported": "2024-10-10T07:40:49.411124+00:00",
"last_updated": "2024-10-10T07:35:56.306542+00:00",
"context": {
"id": "01J9TNP54J9GGKPZ7X48HJ4FE7",
"parent_id": null,
"user_id": null
}
},
"for": null,
"attribute": null,
"description": "state of binary_sensor.dmb_mbp_active"
}
}
}
],
"condition/0": [
{
"path": "condition/0",
"timestamp": "2024-10-10T07:35:56.307208+00:00",
"result": {
"result": false
}
}
],
"condition/0/entity_id/0": [
{
"path": "condition/0/entity_id/0",
"timestamp": "2024-10-10T07:35:56.307219+00:00",
"result": {
"result": false,
"state": [
"13FB2362-7457-496E-995E-11421A5FBEB2"
],
"wanted_state": "13FB2362-7457-496E-995E-11421A5FBEB2"
}
}
]
},
"config": {
"id": "1702762645406",
"alias": "Libbys Desklight Automation",
"description": "Turn on Libby's desk light if I start to use my MBP when connected to the screen setup",
"trigger": [
{
"type": "turned_on",
"platform": "device",
"device_id": "2c0b6fac00a505ba03bdf5d2eb1e26f3",
"entity_id": "f9cbcea5cfa0f6764b50b70b904a579e",
"domain": "binary_sensor"
},
{
"type": "turned_off",
"platform": "device",
"device_id": "2c0b6fac00a505ba03bdf5d2eb1e26f3",
"entity_id": "f9cbcea5cfa0f6764b50b70b904a579e",
"domain": "binary_sensor",
"for": {
"hours": 0,
"minutes": 15,
"seconds": 0
}
}
],
"condition": [
{
"condition": "state",
"entity_id": "sensor.dmb_mbp_displays",
"attribute": "Display IDs",
"state": "13FB2362-7457-496E-995E-11421A5FBEB2"
}
],
"action": [
{
"choose": [
{
"conditions": [
{
"condition": "trigger",
"id": [
"1"
]
}
],
"sequence": [
{
"target": {
"entity_id": [
"switch.smart_switch_2104128868655490849148e1e96baf40_outlet"
],
"device_id": [],
"area_id": []
},
"data": {},
"action": "switch.turn_on"
}
]
},
{
"conditions": [
{
"condition": "trigger",
"id": [
"2"
]
}
],
"sequence": [
{
"target": {
"entity_id": "switch.smart_switch_2104128868655490849148e1e96baf40_outlet"
},
"data": {},
"action": "switch.turn_off"
}
]
}
]
}
],
"mode": "single"
},
"blueprint_inputs": null,
"context": {
"id": "01J9TNP54KFEQVPZQX2GAZ7A6R",
"parent_id": "01J9TNP54J9GGKPZ7X48HJ4FE7",
"user_id": null
}
},
"logbookEntries": []
}