@nayelyz
I know this works for turning on a switch
{ "commands": [ { "component": "main", "capability": "switch", "command": "on", "arguments": [] } ] }
But I can’t get set the level of the dimmer using.
{"commands": [{"component":"main","capability": "switchLevel","command": "setLevel","arguments": [{"integer": 20}]}]}
Do I have to send two commands or can it be done in one?
nayelyz
(Developer Support Team)
2
This body is used to send a command directly to the API, right? The property integer
is not needed in this case:
{"commands": [{"component":"main","capability": "switchLevel","command": "setLevel","arguments": [20]}]}
For future reference, it is only required in the commands of a Rule. For example:
{
"command": {
"devices": [
"deviceID"
],
"commands": [
{
"component": "main",
"capability": "switchLevel",
"command": "setLevel",
"arguments": [{
"integer": 20
}]
}
]
}
}
2 Likes
Yes, this is being directly sent to the API. The code provided worked. Thank you.
2 Likes