airConditionerMode API command

Hello, by using Google I found out that I can send the following command to my Air Conditioner

{
      "component": "main",
      "capability": "switch",
      "command": "on"
    }

Now I wonder what else I can send it. I used the call for device components and capabilities, it gave me for example a airConditionerMode but it seems I cannot set it using a POST to .../commands.

    {
      "component": "main",
      "capability": "airConditionerMode",
      "command": "cool"
    }

The above does not work.

The documentation shows me that there is such a thing as ‘commands’ but I have not found an overview of possible commands for my air conditioner.

This is the capability I would like to use for example:
https://api.smartthings.com/v1/devices/aaaa-bbbbb-ccccccc-dddddd/components/main/capabilities/airConditionerMode/status

It returns:

{
    "supportedAcModes": {
        "value": [
            "cool",
            "dry",
            "wind",
            "auto",
            "heat"
        ],
        "timestamp": "2021-12-22T20:17:09.582Z"
    },
    "airConditionerMode": {
        "value": "cool",
        "timestamp": "2022-05-19T16:39:29.034Z"
    }
}

But it does not really take any value in a command.

The latest is that I use the “execute” capability to do something like this:

{
  "commands": [
    {
      "component": "main",
      "capability": "switch",
      "command": "on"
    },
    {
        "component": "main",
        "capability":"execute",
         "command":"execute",
         "arguments":[
             "mode", {
                 "airConditionerFanMode": "get-me-a-beer"
             }
         ]
    }
  ]
}

But it did not get me a beer, it beeps that it’s all fine and the API reponse is all ok but obviously I can send it anything this way.

You need to read the capability to see what commands it supports. You can do that via the API but most are documented.

In the case of airConditionerMode it is documented under
Proposed Capabilities. What exactly constitutes a proposed capability has never been clear as some of them have been around and used in official integrations for years now.

Thank you for your reply. I have read the ‘proposed’ page and that is where I found the “airConditionerFanMode”. But it is unclear how I could use those “capabilities”.

Have you read the introduction to Capabilities earlier in the documentation? They are rather fundamental to understanding of SmartThings.

If this is what you mean then yes: API | SmartThings Developers

Maybe you mean this: Capabilities | SmartThings Developers then also yes.

But maybe there is more documentation?

You could use Node Red to send those http requests to your air conditioning. I use my Panasonic air conditioning that way. Http request from ST to the Node Red and it sends message payload forward. I was lucky to have Node palette ready for Panasonic devices which make it pretty easy to configure.

Thanks for the tip! Node Red is great but all I really want is to turn my air conditioner on, pick cooling or heating and set it to a certain temperature using the API.

I can turn it on using this command but the other “capabilities” seem to be impossible to actually use.

POST: https://api.smartthings.com/v1/devices/aaa-bbb-ccc-ddd/commands

{
  "commands": [
    {
      "component": "main",
      "capability": "switch",
      "command": "on"
    }
  ]
}

I suspect capabilities haven’t quite clicked with you yet. You know from querying your device in the API that it has the airConditionerMode capability, and the supportedAcModes attribute of that tells you it understands cool, dry, wind, auto, and heat as the names of its modes.

The only command that airConditionerMode has is setAirConditionerMode and it takes a single string argument which is one of the modes e.g. cool. So there is your command and you have to add the argument to the JSON. I think that might be:

{
  "commands": [
    {
      "component": "main",
      "capability": "airConditionerMode",
      "command": "setAirConditionerMode",
      "arguments": [
        "cool"
      ]
    }
  ]
}

I am not 100% on the arguments part of the above but I think that is right. There may be better examples in the API reference now but I can’t check because that page doesn’t get along with my tablet. There are probably examples in this forum somewhere. It is a bit confusing because capability commands take positional arguments for back compatibility but the capabilities also name them. The above is (now I’ve changed it, including putting the right command in, and changed it again to put the right capability in) what I would expect to be correct and what the CLI seems to think the correct syntax is, but I’ve had to add seemingly spurious key names before.

Thank you for the example!!

The capability is airConditionerMode in stead of switch, then it works. Please edit it so I can mark your answer as Solution and bards may sing praises to your name for centuries to come.

POST: https://api.smartthings.com/v1/devices/aaa-bbb-ccc-ddd/commands

{
    "commands": [
        {
            "component": "main",
            "capability": "switch",
            "command": "on"
        },
        {
            "component": "main",
            "capability": "airConditionerMode",
            "command": "setAirConditionerMode",
            "arguments": [
                "cool"
            ]
        }
    ]
}

Yeah, sorry, I was being lazy and cutting and pasting and didn’t repair it all.

1 Like