Here is a rule snippet that I am trying to create a rule from. Specifically, I want to apply the rule if the switch comes on or off. I can’t seem to find the correct syntax for the right side. I just included a small piece of the rule and I need to figure out how to specify the right side correctly. I also included the full rule if that is easier to work with.
The intended rule states: If Switch 1 changes to ON or OFF, then execute a routine and turn on the switch. I am stuck with how to encode the ON or OFF condition.
"if": {
"changes": {
"equals": {
"left": {
"device": {
"devices": [
"17ec5cb1-25a0-4923-8fa7-f5b6c95521d6"
],
"component": "main",
"capability": "switch",
"attribute": "switch"
}
},
"right": {
"string": "off"
}
}
},
or the full rule as it exists right now.
{
"name": "test",
"actions": [
{
"if": {
"changes": {
"equals": {
"left": {
"device": {
"devices": [
"17ec5cb1-25a0-4923-8fa7-f5b6c95521d6"
],
"component": "main",
"capability": "switch",
"attribute": "switch"
}
},
"right": {
"string": "off"
}
}
},
"then": [
{
"scene": {
"scenes": [
"d733090e-2ff5-4212-8472-fbc9b3ed0c63"
]
}
},
{
"command": {
"devices": [
"8c350809-d794-4e44-abcc-102d253e8bc9"
],
"commands": [
{
"component": "main",
"capability": "switch",
"command": "on"
}
]
}
}
]
}
}
]
}
Solved. Thanks @orangebucket.
{
"if": {
"changes": {
"operand": {
"device": {
"devices": [
"17ec5cb1-25a0-4923-8fa7-f5b6c95521d6"
],
"component": "main",
"capability": "switch",
"attribute": "switch"
}
}
},