Hello everyone,
i am not sure is this the place for this topic but i experience problem with syntax of the command line interface for Samsung SmartThing.
When i use smartthings.exe devices:commands and then use the api interface to navigate to the option i want it is ok.
When i try to use one line command it doesnβt accept anything.
Probably not but I only ever look in βlatestβ, βupdatedβ and βnewβ so it wouldnβt stop people like me finding it. I am sure if anyone feels it is out of place theyβll move it for you.
Anyway, letβs deal with the problem.
> smartthings devices:commands --help
execute a device command
USAGE
$ smartthings devices:commands [ID] [COMMAND]
ARGUMENTS
ID the device id
COMMAND the command [<component>]:<capability>:<command>([<arguments>])
Here the ID is the UUID of the device, not the number in the list. Whether you can also use the number in the list is rather inconsistent between commands but it seems to only accept the UUID here. For the command they seem to want the actual text of the capability and command. So an example would be:
Components:
βββββ¬βββββββββ
β 1 β main β
βββββΌβββββββββ€
β 2 β INDOOR β
βββββ΄βββββββββ
? Enter component index or id 1
D:>smartthings.exe devices:commands 838e0e73-6435-79b2-4577-000001200000 main:custom.outingMode:on
Error: Request failed with status code 422:
{βrequestIdβ:βAFC096F3-844F-4647-8D87-D91120417F6Dβ,βerrorβ:{βcodeβ:βConstraintViolationErrorβ,βmessageβ:βThe
request is malformed.β,βdetailsβ:[{βcodeβ:βNotValidValueβ,βtargetβ:βcommands[0].Command(component=main,
capability=custom.outingMode, command=on, arguments=)β,βmessageβ:βon is not a valid value.β,βdetailsβ:}]}}
D:>smartthings.exe devices:commands 838e0e73-6435-79b2-4577-000001200000 main:custom.outingMode:on
Error: Request failed with status code 422: {βrequestIdβ:βF3420095-0990-4656-B230-C26C969E4C5Fβ,βerrorβ:{βcodeβ:βConstraintViolationErrorβ,βmessageβ:βThe request is
malformed.β,βdetailsβ:[{βcodeβ:βNotValidValueβ,βtargetβ:βcommands[0].Command(component=main, capability=custom.outingMode, command=on, arguments=)β,βmessageβ:βon is not a valid value.β,βdetailsβ:}]}}
I donβt know if that is the right syntax for the argument as Iβve never actually used this command in the CLI before. It may need playing with. Or @nayelyz might know. She knows stuff.
Thanks for your input @orangebucket.
Iβm not sure about this specific capability, but Iβve seen others send commands for OCF devices like this:
//command to turn on the light of an AC display
{
"commands":[
{
"component":"main",
"capability":"execute",
"command":"execute",
"arguments":[
"mode/vs/0",
{
"x.com.samsung.da.options":[
"Light_On"
]
}
]
}
]
}
Making a request to this API endpoint https://api.smartthings.com/v1/devices/deviceID/commands.
Iβll ask the engineering team, @Miroslav_Nedev. Once I get more info, Iβll let you know .
D:>smartthings.exe devices:commands 838e0e73-6435-79b2-4577-000001200000 main:custom.outingMode:setOutingMode(on)
SyntaxError: Unexpected token o in JSON at position 1
I donβt know how is that possible to not have version for arm cpu. Most of the automation projects use arm based computers.
Now i am trying to run
smartthings.exe devices:commands 838e0e73-6435-79b2-4577-000001200000 INDOOR:custom.thermostatSetpointControl:setCoolingSetpoint(β30β)
Error: Request failed with status code 422: {βrequestIdβ:β12226614-4AD3-4DE2-96B7-85DB33A1AFDEβ,βerrorβ:{βcodeβ:βConstraintViolationErrorβ,βmessageβ:βThe request is
malformed.β,βdetailsβ:[{βcodeβ:βNotValidValueβ,βtargetβ:βcommands[0].Command(component=INDOOR, capability=custom.thermostatSetpointControl, command=setCoolingSetpoint,
arguments=[30])β,βmessageβ:βsetCoolingSetpoint is not a valid value.β,βdetailsβ:}]}}
i try all the combination with double quotes and escape slashes without success can you tell me how to correcty call this function with parameter inside
The custom.thermostatSetpointControl capability doesnβt seem to have a setCoolingSetpoint command. You can ask the CLI to tell you about the capabilities β¦
$ smartthings capabilities custom.thermostatSetpointControl
Capability: custom.thermostatSetpointControl
Attributes:
βββββββββββββββββββ¬βββββββββ¬βββββββββ
β Name β Type β Setter β
βββββββββββββββββββΌβββββββββΌβββββββββ€
β minimumSetpoint β number β β
β maximumSetpoint β number β β
βββββββββββββββββββ΄βββββββββ΄βββββββββ
Commands:
βββββββββββββββββ¬ββββββββββββ
β Name β Arguments β
βββββββββββββββββΌββββββββββββ€
β raiseSetpoint β β
β lowerSetpoint β β
βββββββββββββββββ΄ββββββββββββ
You can also add -j or -y arguments (alternatively --json or --yaml) to see the full API output in JSON or translated into YAML.
So that particular capability only has raiseSetpoint and lowerSetpoint commands and they donβt take arguments.
No, it means the Capability doesnβt have any commands associated with it. There is nothing you can instruct it to do.
In your particular example there is just an attribute containing the power consumption report for the device. All you can do is read the current value. What would you expect a command to do?