SmartThings cli syntax

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 …

how is the correct way to read the current consumption parameter ?

You can use one of

smartthings devices:status [ID]
smartthings devices:component-status [ID] [COMPONENT]
smartthings devices:capability-status [ID] [COMPONENT] [CAPABILITY]

The first one shows all the device attributes, the second narrows it down to a component, and the last to a single capability.