So, recently, @TAustin was able to add the ST app Routines to his API Browser+ and I took at look at the setup for one of my Routines. So, I have an app Routine to disarm STHM when location mode changes:
which when viewed as JSON in the API Browser, looks like this:
{
"if": {
"equals": {
"left": {
"location": {
"locationId": "b355f7f5-7de9-4294-883d-d31b6c96b166",
"attribute": "Mode",
"trigger": "Always"
},
"type": "location"
},
"right": {
"array": {
"operands": [
{
"string": "84f1bcd3-81ca-46d1-a8ee-793045b2161a",
"type": "string"
},
{
"string": "97a869cf-b63d-4de0-a3f7-ddedd1fd165e",
"type": "string"
}
]
},
"type": "array"
}
},
"type": "equals",
"then": [
{
"location": {
"locationId": "b355f7f5-7de9-4294-883d-d31b6c96b166",
"security": {
"armState": "Disarmed"
}
},
"type": "location"
},
{
"notification": {
"push": {
"title": "Security Mode Home - Disarm",
"message": "Security mode disarmed - Home/Daytime Mode"
},
"type": "push"
},
"type": "notification"
}
],
"sequence": {
"then": "Parallel",
"else": "Parallel"
}
},
"type": "if"
}
Now, it’s been pointed out that the Rules API may or may not support everything that the Routines can support (and vice versa), but I think this could work given that location mode setting in the Routines JSON looks similar to the JSON in the Rules API.
"then": [
{
"location": {
"locationId": "b355f7f5-7de9-4294-883d-d31b6c96b166",
"mode": "09af3ea4-53f7-4c2c-bde8-a1826a157e7a"
},
"type": "location"
}
Let us know if it works for you or not.