Thanks,
Am trying to achieve this:
If no one was home and someone arrives - Turn on ambient lights
If someone was home and another person arrives - Turn on home late lights
The home late lights have some other conditions such as sunset and checking to see when 2 other automations were run.
This is my trace code:
{
"trace": {
"last_step": "action/0/choose/1/conditions/0/conditions/1",
"run_id": "5ddaa32af876b7f72ad583b165231c7a",
"state": "stopped",
"script_execution": "finished",
"timestamp": {
"start": "2024-12-14T11:58:37.402224+00:00",
"finish": "2024-12-14T11:58:37.403007+00:00"
},
"domain": "automation",
"item_id": "1734176451480",
"trigger": "person.charlotte entering Home",
"trace": {
"trigger/1": [
{
"path": "trigger/1",
"timestamp": "2024-12-14T11:58:37.402258+00:00",
"changed_variables": {
"this": {
"entity_id": "automation.welcome_home_lighting_familygroup",
"state": "on",
"attributes": {
"id": "1734176451480",
"last_triggered": "2024-12-14T11:41:30.462603+00:00",
"mode": "single",
"current": 0,
"friendly_name": "Welcome Home Lighting (FamilyGroup)"
},
"last_changed": "2024-12-14T11:47:45.291838+00:00",
"last_reported": "2024-12-14T11:47:45.291838+00:00",
"last_updated": "2024-12-14T11:47:45.291838+00:00",
"context": {
"id": "01JF2FXZ0BEVQQ0FQCRVTJHHJP",
"parent_id": null,
"user_id": null
}
},
"trigger": {
"id": "1",
"idx": "1",
"alias": null,
"platform": "zone",
"entity_id": "person.charlotte",
"from_state": {
"entity_id": "person.charlotte",
"state": "not_home",
"attributes": {
"editable": true,
"id": "charlotte",
"device_trackers": [
"device_tracker.charlotte_s_iphone",
"device_tracker.charlotte_s_iphone_2"
],
"latitude": 51.03203498279328,
"longitude": 1.0027229385962284,
"gps_accuracy": 2,
"source": "device_tracker.charlotte_s_iphone_2",
"user_id": "fb5088572f3d4cb3969a5829f4d97d35",
"entity_picture": "/api/image/serve/5283d0f865c59ae902516549f510e47e/512x512",
"friendly_name": "Charlotte"
},
"last_changed": "2024-12-14T08:37:37.001149+00:00",
"last_reported": "2024-12-14T11:57:47.292253+00:00",
"last_updated": "2024-12-14T11:57:47.292253+00:00",
"context": {
"id": "01JF2GGAWWBSCJ6K279CPVGCSY",
"parent_id": null,
"user_id": null
}
},
"to_state": {
"entity_id": "person.charlotte",
"state": "home",
"attributes": {
"editable": true,
"id": "charlotte",
"device_trackers": [
"device_tracker.charlotte_s_iphone",
"device_tracker.charlotte_s_iphone_2"
],
"latitude": 51.035161339820384,
"longitude": 1.0096596680941905,
"gps_accuracy": 2,
"source": "device_tracker.charlotte_s_iphone_2",
"user_id": "fb5088572f3d4cb3969a5829f4d97d35",
"entity_picture": "/api/image/serve/5283d0f865c59ae902516549f510e47e/512x512",
"friendly_name": "Charlotte"
},
"last_changed": "2024-12-14T11:58:37.398036+00:00",
"last_reported": "2024-12-14T11:58:37.398036+00:00",
"last_updated": "2024-12-14T11:58:37.398036+00:00",
"context": {
"id": "01JF2GHVTPE41JYHPD002DKZ8Q",
"parent_id": null,
"user_id": null
}
},
"zone": {
"entity_id": "zone.home",
"state": "3",
"attributes": {
"latitude": 51.035796876353544,
"longitude": 1.009477043990046,
"radius": 100,
"passive": false,
"persons": [
"person.admin",
"person.alex",
"person.charlotte"
],
"editable": true,
"icon": "mdi:home",
"friendly_name": "Home",
"friendy_name": "Home"
},
"last_changed": "2024-12-14T11:58:37.398234+00:00",
"last_reported": "2024-12-14T11:58:37.398234+00:00",
"last_updated": "2024-12-14T11:58:37.398234+00:00",
"context": {
"id": "01JF2GHVTPPYNXTM02H12R31FD",
"parent_id": null,
"user_id": null
}
},
"event": "enter",
"description": "person.charlotte entering Home"
}
}
}
],
"action/0": [
{
"path": "action/0",
"timestamp": "2024-12-14T11:58:37.402430+00:00",
"changed_variables": {
"context": {
"id": "01JF2GHVTTKAFWB3VMMEWFB5YY",
"parent_id": "01JF2GHVTPE41JYHPD002DKZ8Q",
"user_id": null
}
}
}
],
"action/0/choose/0": [
{
"path": "action/0/choose/0",
"timestamp": "2024-12-14T11:58:37.402630+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/0/conditions/0": [
{
"path": "action/0/choose/0/conditions/0",
"timestamp": "2024-12-14T11:58:37.402649+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/0/conditions/0/entity_id/0": [
{
"path": "action/0/choose/0/conditions/0/entity_id/0",
"timestamp": "2024-12-14T11:58:37.402667+00:00",
"result": {
"result": false,
"state": "home",
"wanted_state": "not_home"
}
}
],
"action/0/choose/1": [
{
"path": "action/0/choose/1",
"timestamp": "2024-12-14T11:58:37.402707+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/1/conditions/0": [
{
"path": "action/0/choose/1/conditions/0",
"timestamp": "2024-12-14T11:58:37.402719+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/1/conditions/0/conditions/0": [
{
"path": "action/0/choose/1/conditions/0/conditions/0",
"timestamp": "2024-12-14T11:58:37.402730+00:00",
"result": {
"result": true
}
}
],
"action/0/choose/1/conditions/0/conditions/0/entity_id/0": [
{
"path": "action/0/choose/1/conditions/0/conditions/0/entity_id/0",
"timestamp": "2024-12-14T11:58:37.402740+00:00",
"result": {
"result": true,
"state": "home",
"wanted_state": "home"
}
}
],
"action/0/choose/1/conditions/0/conditions/1": [
{
"path": "action/0/choose/1/conditions/0/conditions/1",
"timestamp": "2024-12-14T11:58:37.402764+00:00",
"result": {
"wanted_time_after": "2024-12-14T15:48:53.486475+00:00",
"result": false
}
}
]
},
"config": {
"id": "1734176451480",
"alias": "Welcome Home Lighting (FamilyGroup)",
"description": "",
"triggers": [
{
"trigger": "zone",
"entity_id": "person.alex",
"zone": "zone.home",
"event": "enter"
},
{
"trigger": "zone",
"entity_id": "person.charlotte",
"zone": "zone.home",
"event": "enter"
}
],
"conditions": [],
"actions": [
{
"choose": [
{
"conditions": [
{
"condition": "state",
"entity_id": "group.silver_family",
"state": "not_home"
}
],
"sequence": [
{
"action": "automation.turn_on",
"metadata": {},
"data": {},
"target": {
"entity_id": "automation.shm_ambient_lighting"
}
},
{
"delay": {
"hours": 0,
"minutes": 0,
"seconds": 5,
"milliseconds": 0
}
},
{
"action": "automation.turn_on",
"metadata": {},
"data": {},
"target": {
"entity_id": "automation.shm_ambient_lighting"
}
}
]
},
{
"conditions": [
{
"condition": "and",
"conditions": [
{
"condition": "state",
"entity_id": "group.silver_family",
"state": "home"
},
{
"condition": "sun",
"after": "sunset"
},
{
"condition": "or",
"conditions": [
{
"condition": "template",
"value_template": "{{ now() - state_attr('automation.night_time', 'last_triggered') < timedelta(hours=7)}}"
},
{
"condition": "template",
"value_template": "{{ now() - state_attr('automation.3_shm_lights_off_when_not_home', 'last_triggered') < timedelta(hours=7) }}"
}
]
}
]
}
],
"sequence": [
{
"action": "script.turn_on",
"metadata": {},
"data": {},
"target": {
"entity_id": "script.welcome_home_late_lights"
}
}
]
}
]
}
],
"mode": "single"
},
"blueprint_inputs": null,
"context": {
"id": "01JF2GHVTTKAFWB3VMMEWFB5YY",
"parent_id": "01JF2GHVTPE41JYHPD002DKZ8Q",
"user_id": null
}
},
"logbookEntries": [
{
"name": "Welcome Home Lighting (FamilyGroup)",
"message": "triggered by person.charlotte entering Home",
"source": "person.charlotte entering Home",
"entity_id": "automation.welcome_home_lighting_familygroup",
"context_id": "01JF2GHVTTKAFWB3VMMEWFB5YY",
"domain": "automation",
"when": 1734177517.4022844
}
]
}