SmartThings cli syntax

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.

smartthings.exe devices:commands 1 1 12 on

Has anyone encountered this problem ?

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:

smartthings devices:commands 12345678-9012-3456-7890-123456789012 switch:off

2 Likes

Hello,
i allready try this.

D:>smartthings.exe devices:commands 838e0e73-6435-79b2-4577-000001200000

Samsung Heat Pump 16kW

Components:
β”Œβ”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 1 β”‚ main β”‚
β”œβ”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 2 β”‚ INDOOR β”‚
β””β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”˜

now how to choose 1 - main ?

You stick it in front of the capability and command. With my simple switch example it would be

smartthings devices:commands 12345678-9012-3456-7890-123456789012 main:switch:off

I wouldn’t be surprised if it actually defaulted to β€˜main’ anyway, but I haven’t tried it.

it doesn’t work :frowning:

Components:
β”Œβ”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 1 β”‚ main β”‚
β”œβ”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 2 β”‚ INDOOR β”‚
β””β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”˜
? Enter component index or id 1

Capabilities:
β”Œβ”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 1 β”‚ ocf β”‚
β”œβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 2 β”‚ switch β”‚
β”œβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 3 β”‚ temperatureMeasurement β”‚
β”œβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 4 β”‚ thermostatCoolingSetpoint β”‚
β”œβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 5 β”‚ airConditionerMode β”‚
β”œβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 6 β”‚ powerConsumptionReport β”‚
β”œβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 7 β”‚ demandResponseLoadControl β”‚
β”œβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 8 β”‚ remoteControlStatus β”‚
β”œβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 9 β”‚ refresh β”‚
β”œβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 10 β”‚ execute β”‚
β”œβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 11 β”‚ custom.energyType β”‚
β”œβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 12 β”‚ custom.outingMode β”‚
β”œβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 13 β”‚ custom.thermostatSetpointControl β”‚
β”œβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 14 β”‚ custom.deviceReportStateConfiguration β”‚
β”œβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 15 β”‚ custom.disabledCapabilities β”‚
β”œβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 16 β”‚ samsungce.driverVersion β”‚
β”œβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 17 β”‚ samsungce.softwareUpdate β”‚
β””β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
? Enter capability index or id

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”:}]}}

D:>

The custom.outingMode capability doesn’t have on() and off() commands, it has a setOutingMode() command. So it will have to be something like:

smartthings.exe devices:commands 838e0e73-6435-79b2-4577-000001200000 main:custom.outingMode:setOutingMode(on)

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 .

Commands:
β”Œβ”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 1 β”‚ setOutingMode(mode<enum {on, off}>) β”‚
β””β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
? Enter command

those are the possible options

D:>smartthings.exe devices:commands 838e0e73-6435-79b2-4577-000001200000 main:custom.outingMode:setOutingMode(on)
SyntaxError: Unexpected token o in JSON at position 1

Ah, ok.

I created a virtual device using this capability and this command works:

smartthings devices:commands deviceID main:custom.outingMode:setOutingMode(\"on\")

We need to scape the " symbols because of how the console processes the commands. This is the JSON used in queries to the API endpoint:

{
    "commands": [
        {
            "component": "main",
            "capability": "custom.outingMode",
            "command": "setOutingMode",
            "arguments": ["off"]
        }
    ]
}

Thanks now it is working great job thanks for supporting me :wink:

1 Like

Is there somewhere over the internet cli interface for arm cpu based linux

Do you mean on devices like Raspberry Pi? There’s an ongoing conversation about that here:

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

each command has it’s own syntaxis … is there a place with examples where i can check all the commands that i need?

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.

1 Like

my mistake tnx
smartthings.exe devices:commands 838e0e73-6435-79b2-4577-000001200000 main:thermostatCoolingSetpoint:setCoolingSetpoint(β€œ30”)

main section instead of INDOOR. :slight_smile:
Thanks again for supporting me.

Hello friends,
some of the options in my heatpump for example :
6 β”‚ powerConsumptionReport

returns Capability has no commands what i s that means? I can’t use that command with cli interface ?

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?

i am expecting to give me feedback of current power consumption or something …