I’ve try to make rule api as below. But I just get error as “Error adding rule “Aqara H1”. 422 The request is malformed. then: Unrecognized field “then” (class v20190122.internal.st.behaviors.Action), not marked as ignorable”
Please let me know how to handle it or modify my api…
[
{
"if": {
"changes": {
"operand": {
"device": {
"devices": [
"270aa5a2-b83f-47aa-b5ef-2096517bdc89"
],
"component": "main",
"capability": "switchLevel",
"attribute": "level"
}
}
}
},
"then": [
{
"if": {
"equals": {
"left": {
"device": {
"devices": [
"46d958cb-a165-4b6e-bc45-172cef6f2615"
],
"component": "main",
"capability": "switch",
"attribute": "switch",
"trigger": "Never"
}
},
"right": {
"string": "on"
}
}
},
"then": [
{
"command": {
"devices": [
"46d958cb-a165-4b6e-bc45-172cef6f2615"
],
"commands": [
{
"component": "main",
"capability": "switchLevel",
"command": "setLevel",
"arguments": [
{
"device": {
"devices": [
"270aa5a2-b83f-47aa-b5ef-2096517bdc89"
],
"component": "main",
"capability": "switchLevel",
"attribute": "level"
}
}
]
},
]
}
}
]
}
]
}
]