thanks @mrfitz98 , that didn’t seem to work, not sure if it is because it’s nested
if(VACATION BUTTON= ON) -> set VACATION mode and ARMED(Away)
else if Everyone is Away -> set AWAY mode and ARMED(Away)
else if time changed\between 11pm and 7 am -> set NIGHT mode and ARMED(Stay)
else -> set HOME mode and DISARMED
i did ultimately get it to work, although i don’t think it’s optimal as i had to repeat all the conditions
{
"name": "Location Mode Updater (Mode)",
"actions": [
{
"every": {
"specific": {
"reference": "Noon",
"offset": {
"value": {
"decimal": 11
},
"unit": "Hour"
}
},
"actions": [
{
"if": {
"equals": {
"left": {
"device": {
"devices": [
"a22fffbe-f6d0-427b-bf48-9746e5545216"
],
"component": "main",
"capability": "switch",
"attribute": "switch",
"trigger": "Always"
}
},
"right": {
"string": "on"
}
},
"then": [
{
"location": {
"security": {
"armState": "ArmedAway"
}
}
},
{
"location": {
"mode": "cf17bc21-d3c2-4f69-8443-752acac57cec"
}
}
],
"else": [
{
"if": {
"equals": {
"left": {
"device": {
"devices": [
"74a67738-af98-4089-af9e-c17b811c47ab",
"ef2bcbf9-ca11-421a-88f7-2c9b9702f219"
],
"component": "main",
"capability": "presenceSensor",
"attribute": "presence",
"trigger": "Always"
}
},
"right": {
"string": "not present"
},
"aggregation": "All"
},
"then": [
{
"location": {
"security": {
"armState": "ArmedAway"
}
}
},
{
"location": {
"mode": "99d86a45-853e-49e1-9129-72493ab0153c"
}
}
],
"else": [
{
"location": {
"security": {
"armState": "ArmedStay"
}
}
},
{
"location": {
"mode": "3f8418ca-1beb-474c-9640-fd2e013a94b2"
}
}
]
}
}
]
}
}
]
}
},
{
"every": {
"specific": {
"reference": "Noon",
"offset": {
"value": {
"decimal": -5
},
"unit": "Hour"
}
},
"actions": [
{
"if": {
"equals": {
"left": {
"device": {
"devices": [
"a22fffbe-f6d0-427b-bf48-9746e5545216"
],
"component": "main",
"capability": "switch",
"attribute": "switch",
"trigger": "Always"
}
},
"right": {
"string": "on"
}
},
"then": [
{
"location": {
"security": {
"armState": "ArmedAway"
}
}
},
{
"location": {
"mode": "cf17bc21-d3c2-4f69-8443-752acac57cec"
}
}
],
"else": [
{
"if": {
"equals": {
"left": {
"device": {
"devices": [
"74a67738-af98-4089-af9e-c17b811c47ab",
"ef2bcbf9-ca11-421a-88f7-2c9b9702f219"
],
"component": "main",
"capability": "presenceSensor",
"attribute": "presence",
"trigger": "Always"
}
},
"right": {
"string": "not present"
},
"aggregation": "All"
},
"then": [
{
"location": {
"security": {
"armState": "ArmedAway"
}
}
},
{
"location": {
"mode": "99d86a45-853e-49e1-9129-72493ab0153c"
}
}
],
"else": [
{
"location": {
"security": {
"armState": "Disarmed"
}
}
},
{
"location": {
"mode": "39d2fbe6-c52b-4097-9115-85cc03c54c4c"
}
}
]
}
}
]
}
}
]
}
},
{
"if": {
"equals": {
"left": {
"device": {
"devices": [
"a22fffbe-f6d0-427b-bf48-9746e5545216"
],
"component": "main",
"capability": "switch",
"attribute": "switch",
"trigger": "Always"
}
},
"right": {
"string": "on"
}
},
"then": [
{
"location": {
"security": {
"armState": "ArmedAway"
}
}
},
{
"location": {
"mode": "cf17bc21-d3c2-4f69-8443-752acac57cec"
}
}
],
"else": [
{
"if": {
"equals": {
"left": {
"device": {
"devices": [
"74a67738-af98-4089-af9e-c17b811c47ab",
"ef2bcbf9-ca11-421a-88f7-2c9b9702f219"
],
"component": "main",
"capability": "presenceSensor",
"attribute": "presence",
"trigger": "Always"
}
},
"right": {
"string": "not present"
},
"aggregation": "All"
},
"then": [
{
"location": {
"security": {
"armState": "ArmedAway"
}
}
},
{
"location": {
"mode": "99d86a45-853e-49e1-9129-72493ab0153c"
}
}
],
"else": [
{
"if": {
"between": {
"value": {
"time": {
"reference": "Now"
}
},
"start": {
"time": {
"reference": "Noon",
"offset": {
"value": {
"decimal": 11
},
"unit": "Hour"
}
}
},
"end": {
"time": {
"reference": "Noon",
"offset": {
"value": {
"decimal": -5
},
"unit": "Hour"
}
}
}
},
"then": [
{
"location": {
"security": {
"armState": "ArmedStay"
}
}
},
{
"location": {
"mode": "3f8418ca-1beb-474c-9640-fd2e013a94b2"
}
}
],
"else": [
{
"location": {
"security": {
"armState": "Disarmed"
}
}
},
{
"location": {
"mode": "39d2fbe6-c52b-4097-9115-85cc03c54c4c"
}
}
]
}
}
]
}
}
]
}
}
]
}