Hi,
I’m setting up an automation to ensure my thermostat turns of when both myself and partner are out of home. Hence I use the zone
for each of the defined persons as triggers, followed by a choose
that assesses the current states.
alias: 'Environment - Turn off thermostat when away '
description: ''
trigger:
- platform: state
entity_id: person.me
to: null
- platform: state
entity_id: person.partner
to: null
condition: []
action:
- choose:
- conditions:
- condition: and
conditions:
- condition: not
conditions:
- condition: zone
entity_id: person.me
zone: zone.home
- condition: not
conditions:
- condition: zone
entity_id: person.partner
zone: zone.home
sequence:
- device_id: 180eb38900273f74617503ed50b01d89
domain: climate
entity_id: climate.smartthermostat
type: set_hvac_mode
hvac_mode: 'off'
- conditions:
- condition: device
device_id: 180eb38900273f74617503ed50b01d89
domain: climate
entity_id: climate.smartthermostat
type: is_hvac_mode
hvac_mode: 'off'
sequence:
- device_id: 180eb38900273f74617503ed50b01d89
domain: climate
entity_id: climate.smartthermostat
type: set_hvac_mode
hvac_mode: auto
default: []
mode: single
However some debug traces and up in the default
rather than to execute the action.
Last example:
I’m leaving home, while my partner was already away.
Hence I would expect my condition to trigger, as now both persons are not_home
. However it ended up in the default
.
Debug trace:
{
"trace": {
"last_step": "action/0/choose/1/conditions/0",
"run_id": "7fdf4694a473902518a687d22bde659f",
"state": "stopped",
"script_execution": "finished",
"timestamp": {
"start": "2022-01-16T17:25:02.007482+00:00",
"finish": "2022-01-16T17:25:02.041887+00:00"
},
"domain": "automation",
"item_id": "1635889248367",
"trigger": "state of person.me",
"trace": {
"trigger/0": [
{
"path": "trigger/0",
"timestamp": "2022-01-16T17:25:02.007600+00:00",
"changed_variables": {
"this": {
"entity_id": "automation.environment_turn_off_thermostat_when_away",
"state": "on",
"attributes": {
"last_triggered": "2022-01-16T02:46:06.127489+00:00",
"mode": "single",
"current": 0,
"id": "1635889248367",
"friendly_name": "Environment - Turn off thermostat when away "
},
"last_changed": "2022-01-13T16:45:26.117708+00:00",
"last_updated": "2022-01-16T02:46:06.141476+00:00",
"context": {
"id": "4b870e6f00f2251e5062cefa6e4c2d09",
"parent_id": "2fa0c3afa7759ae371fd98a6fe7dc738",
"user_id": null
}
},
"trigger": {
"id": "0",
"idx": "0",
"platform": "state",
"entity_id": "person.me",
"from_state": {
"entity_id": "person.me",
"state": "home",
"attributes": {
"editable": false,
"id": "me",
"latitude": <lat>,
"longitude": <long>,
"gps_accuracy": 60,
"source": "device_tracker.oneplus_8_pro",
"user_id": "e8f27a6f86424260a0a5c99eacad2714",
"friendly_name": "Thibault"
},
"last_changed": "2022-01-16T02:46:06.121219+00:00",
"last_updated": "2022-01-16T17:24:04.620457+00:00",
"context": {
"id": "1dd58049d6216a33b86b1c3301f7f227",
"parent_id": null,
"user_id": null
}
},
"to_state": {
"entity_id": "person.me",
"state": "not_home",
"attributes": {
"editable": false,
"id": "me",
"latitude": <lat>,
"longitude": <long>,
"gps_accuracy": 10,
"source": "device_tracker.oneplus_8_pro",
"user_id": "e8f27a6f86424260a0a5c99eacad2714",
"friendly_name": "Thibault"
},
"last_changed": "2022-01-16T17:25:01.999095+00:00",
"last_updated": "2022-01-16T17:25:01.999095+00:00",
"context": {
"id": "8a4f452ecacef44dfa59678ebc0dce51",
"parent_id": null,
"user_id": null
}
},
"for": null,
"attribute": null,
"description": "state of person.me"
}
}
}
],
"action/0": [
{
"path": "action/0",
"timestamp": "2022-01-16T17:25:02.016142+00:00",
"changed_variables": {
"context": {
"id": "8a53e50b727013832d0aac49c8b8e626",
"parent_id": "8a4f452ecacef44dfa59678ebc0dce51",
"user_id": null
}
},
"result": {
"choice": "default"
}
}
],
"action/0/choose/0": [
{
"path": "action/0/choose/0",
"timestamp": "2022-01-16T17:25:02.016378+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/0/conditions/0": [
{
"path": "action/0/choose/0/conditions/0",
"timestamp": "2022-01-16T17:25:02.016594+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/0/conditions/0/conditions/0": [
{
"path": "action/0/choose/0/conditions/0/conditions/0",
"timestamp": "2022-01-16T17:25:02.016725+00:00",
"result": {
"result": true
}
}
],
"action/0/choose/0/conditions/0/conditions/0/conditions/0": [
{
"path": "action/0/choose/0/conditions/0/conditions/0/conditions/0",
"timestamp": "2022-01-16T17:25:02.016854+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/0/conditions/0/conditions/1": [
{
"path": "action/0/choose/0/conditions/0/conditions/1",
"timestamp": "2022-01-16T17:25:02.017302+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/0/conditions/0/conditions/1/conditions/0": [
{
"path": "action/0/choose/0/conditions/0/conditions/1/conditions/0",
"timestamp": "2022-01-16T17:25:02.017431+00:00",
"result": {
"result": true
}
}
],
"action/0/choose/1": [
{
"path": "action/0/choose/1",
"timestamp": "2022-01-16T17:25:02.017915+00:00",
"result": {
"result": false
}
}
],
"action/0/choose/1/conditions/0": [
{
"path": "action/0/choose/1/conditions/0",
"timestamp": "2022-01-16T17:25:02.018058+00:00",
"result": {
"result": false
}
}
]
},
"config": {
"id": "1635889248367",
"alias": "Environment - Turn off thermostat when away ",
"description": "",
"trigger": [
{
"platform": "state",
"entity_id": "person.me",
"to": null
},
{
"platform": "state",
"entity_id": "person.partner",
"to": null
}
],
"condition": [],
"action": [
{
"choose": [
{
"conditions": [
{
"condition": "and",
"conditions": [
{
"condition": "not",
"conditions": [
{
"condition": "zone",
"entity_id": "person.me",
"zone": "zone.home"
}
]
},
{
"condition": "not",
"conditions": [
{
"condition": "zone",
"entity_id": "person.partner",
"zone": "zone.home"
}
]
}
]
}
],
"sequence": [
{
"device_id": "180eb38900273f74617503ed50b01d89",
"domain": "climate",
"entity_id": "climate.smartthermostat",
"type": "set_hvac_mode",
"hvac_mode": "off"
}
]
},
{
"conditions": [
{
"condition": "device",
"device_id": "180eb38900273f74617503ed50b01d89",
"domain": "climate",
"entity_id": "climate.smartthermostat",
"type": "is_hvac_mode",
"hvac_mode": "off"
}
],
"sequence": [
{
"device_id": "180eb38900273f74617503ed50b01d89",
"domain": "climate",
"entity_id": "climate.smartthermostat",
"type": "set_hvac_mode",
"hvac_mode": "auto"
}
]
}
],
"default": []
}
],
"mode": "single",
"trace": {
"stored_traces": 20
}
},
"blueprint_inputs": null,
"context": {
"id": "8a53e50b727013832d0aac49c8b8e626",
"parent_id": "8a4f452ecacef44dfa59678ebc0dce51",
"user_id": null
}
},
"logbookEntries": [
{
"name": "Environment - Turn off thermostat when away ",
"message": "has been triggered by state of person.me",
"source": "state of person.me",
"entity_id": "automation.environment_turn_off_thermostat_when_away",
"context_id": "8a53e50b727013832d0aac49c8b8e626",
"when": "2022-01-16T17:25:02.007862+00:00",
"domain": "automation"
}
]
}
Any idea why the condition didn’t execute ?