SmartThings cli syntax

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.

yeah thanks i saw there has many lines with many info some of them are usefull like current power consumption and power consumption counter tnx for supporting me
do you know some way for running smartthing cli on armbian ?

Sorry for hijacking thread. How do you get information out of the CLI that would normally be done with a callback in groovy?

You can try to make HTTP requests to the SmartThings API. However, remember that Groovy is part of our legacy platform.
Can you share more details about your use case?

I completely understand Groovy is legacy, which is the driver for my prototype. I’ve been using the CLI to test commands, which mostly involve managing lock codes. I don’t see any method in the CLI to perform callback type activities which are used for a number of device commands on the legacy platform. Do we know how long CLI will be supported? Trying to keep this simple for now. :slight_smile:

If you’re referring to this CLI, there are no plans to remove it and it’s being constantly improved by the engineering team. So, you don’t have to worry about that.