REST API for display/light on Samsung Windfree AC

Hi,

I have got a Samsung Windfree AC (AR09RXPXBWKNEU) I would like to control via the REST API.

I can get the switch status with a GET request like this (plus JSONPATH):

curl -v -i -G -X GET 'https://api.smartthings.com/v1/devices/<device-id>/components/main/status' \
        -H "Authorization: Bearer <token>" \

And I can also set it easily enough with this POST request:

curl -v -i -X POST 'https://api.smartthings.com/v1/devices/<device-id>/commands' \
        -H "Authorization: Bearer <token>" \
        -d '{"commands": [{"component": "main" , "capability": "switch", "command": "off"}]}'

I would like to turn the display/light on and off via REST (I am not so much interested in the state as is goes on every time you issue a command). In the Smartthings App it can be controlled via the Settings:

However, there seems to be no capability controlling this setting. The only thing I could find in the status is in the execute section of the status JSON result:

"execute": {
    "data": {
        "value": {
            "payload": {
                ...
                ],
                "x.com.samsung.da.options": [
                    ...
                   "Light_On",
                    ...
                ],
                ...
             }
        },
        "data": {}
    }
},

Is there a way of turning the display/light off via the REST API?

Thanks,
Peter

Did you manage this?
I’m trying to do the same (and others commands too)

1 Like

Same story here. i’ve been trying all sorts of strings via webcore but nothing seems to work

I’m trying to do this by using capability postOcfCommand but I can’t found anything about how to use this.

Does anyone know how to use this capability?

Ditto! Can’t get it work. It is annoying that after setting display off, the next command turns it back on :frowning_face:.

I was too looking to setup some sort of automation that turns off the AC display every night and back on in the morning. I played around the execute capability but doesn’t seem to work. The app is able to do it so definitely there has to have some way for us to do it :slight_smile:. Did some digging with wireshark but so far no luck.

I’m trying to send commands over postOcfCommand and execute but without success until now.

I didn’t found any docs about this, still trying!

Hello all!

I’m using OCF Device Spy to manage my A/C and I’ve got this payload from resource:

[
   {
      "di":"xxxxxx",
      "links":[
         {
            "href":"/oic/sec/doxm",
            "rt":[
               "oic.r.doxm"
            ],
            "if":[
               "oic.if.baseline"
            ],
            "p":{
               "bm":1,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/oic/sec/pstat",
            "rt":[
               "oic.r.pstat"
            ],
            "if":[
               "oic.if.baseline"
            ],
            "p":{
               "bm":1,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/oic/d",
            "rt":[
               "oic.wk.d",
               "oic.d.airconditioner"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.r"
            ],
            "p":{
               "bm":1,
               "sec":false,
               "x.org.iotivity.tcp":0
            }
         },
         {
            "href":"/oic/p",
            "rt":[
               "oic.wk.p"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.r"
            ],
            "p":{
               "bm":1,
               "sec":false,
               "x.org.iotivity.tcp":0
            }
         },
         {
            "href":"/device/0",
            "rt":[
               "x.com.samsung.devcol",
               "oic.wk.col"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.ll",
               "oic.if.b"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/power/0",
            "rt":[
               "oic.r.switch.binary"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/power/vs/0",
            "rt":[
               "x.com.samsung.da.operation"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/temperature/desired/0",
            "rt":[
               "oic.r.temperature"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/temperature/current/0",
            "rt":[
               "oic.r.temperature"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.s"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/temperatures/vs/0",
            "rt":[
               "x.com.samsung.da.temperatures"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/airflow/0",
            "rt":[
               "oic.r.airflow"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/airflow/vs/0",
            "rt":[
               "x.com.samsung.da.wind"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/mode/0",
            "rt":[
               "oic.r.mode"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/mode/vs/0",
            "rt":[
               "x.com.samsung.da.mode"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/diagnosis/vs/0",
            "rt":[
               "x.com.samsung.da.diagnosis"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/alarms/vs/0",
            "rt":[
               "x.com.samsung.da.alarms"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/energy/consumption/0",
            "rt":[
               "oic.r.energy.consumption"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/energy/consumption/vs/0",
            "rt":[
               "x.com.samsung.da.energyconsumption"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/configuration/vs/0",
            "rt":[
               "x.com.samsung.da.configuration"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":1,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/file/information/vs/0",
            "rt":[
               "x.com.samsung.file.information"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":1,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/humidity/0",
            "rt":[
               "oic.r.humidity"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/consumable/vs/0",
            "rt":[
               "x.com.samsung.da.consumable"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.s"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/humidity/vs/0",
            "rt":[
               "x.com.samsung.da.humidity"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/multidevice/vs/0",
            "rt":[
               "x.com.samsung.da.multidevice"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/sec/devices",
            "rt":[
               "x.com.samsung.devcol",
               "oic.wk.col"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.ll",
               "oic.if.b"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/sec/accesspointlist",
            "rt":[
               "x.com.samsung.accesspointlist"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.s"
            ],
            "p":{
               "bm":3,
               "sec":false,
               "x.org.iotivity.tcp":0
            }
         },
         {
            "href":"/actions/vs/0",
            "rt":[
               "x.com.samsung.da.actions"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":1,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/file/transfer/vs/0",
            "rt":[
               "x.com.samsung.file.transfer"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":false,
               "x.org.iotivity.tcp":0
            }
         },
         {
            "href":"/sec/provisioninginfo",
            "rt":[
               "x.com.samsung.provisioninginfo"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":false,
               "x.org.iotivity.tcp":0
            }
         },
         {
            "href":"/information/vs/0",
            "rt":[
               "x.com.samsung.da.information"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/hass/state/vs/0",
            "rt":[
               "x.com.samsung.da.hass.state"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":false,
               "x.org.iotivity.tcp":0
            }
         },
         {
            "href":"/hass/command/vs/0",
            "rt":[
               "x.com.samsung.da.hass.command"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":false,
               "x.org.iotivity.tcp":0
            }
         },
         {
            "href":"/file/list/vs/0",
            "rt":[
               "x.com.samsung.file.list"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.s"
            ],
            "p":{
               "bm":1,
               "sec":false,
               "x.org.iotivity.tcp":0
            }
         },
         {
            "href":"/file/transfer/chunk/vs/0",
            "rt":[
               "x.com.samsung.file.chunk"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":1,
               "sec":false,
               "x.org.iotivity.tcp":0
            }
         },
         {
            "href":"/rm/state/vs/0",
            "rt":[
               "x.com.samsung.da.rm.state"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/rm/micomdata/vs/0",
            "rt":[
               "x.com.samsung.da.rm.micomdata"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/device/1",
            "rt":[
               "x.com.samsung.devcol",
               "oic.wk.col"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.ll",
               "oic.if.b"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/power/1",
            "rt":[
               "oic.r.switch.binary"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/power/vs/1",
            "rt":[
               "x.com.samsung.da.operation"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/temperature/desired/1",
            "rt":[
               "oic.r.temperature"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/temperature/current/1",
            "rt":[
               "oic.r.temperature"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.s"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/temperatures/vs/1",
            "rt":[
               "x.com.samsung.da.temperatures"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/airflow/1",
            "rt":[
               "oic.r.airflow"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/airflow/vs/1",
            "rt":[
               "x.com.samsung.da.wind"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/mode/1",
            "rt":[
               "oic.r.mode"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/mode/vs/1",
            "rt":[
               "x.com.samsung.da.mode"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/diagnosis/vs/1",
            "rt":[
               "x.com.samsung.da.diagnosis"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/alarms/vs/1",
            "rt":[
               "x.com.samsung.da.alarms"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/energy/consumption/1",
            "rt":[
               "oic.r.energy.consumption"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/energy/consumption/vs/1",
            "rt":[
               "x.com.samsung.da.energyconsumption"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/configuration/vs/1",
            "rt":[
               "x.com.samsung.da.configuration"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":1,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/file/information/vs/1",
            "rt":[
               "x.com.samsung.file.information"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":1,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/humidity/1",
            "rt":[
               "oic.r.humidity"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/consumable/vs/1",
            "rt":[
               "x.com.samsung.da.consumable"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.s"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/humidity/vs/1",
            "rt":[
               "x.com.samsung.da.humidity"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/actions/vs/1",
            "rt":[
               "x.com.samsung.da.actions"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":1,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/file/transfer/vs/1",
            "rt":[
               "x.com.samsung.file.transfer"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":false,
               "x.org.iotivity.tcp":0
            }
         },
         {
            "href":"/information/vs/1",
            "rt":[
               "x.com.samsung.da.information"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/hass/state/vs/1",
            "rt":[
               "x.com.samsung.da.hass.state"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":false,
               "x.org.iotivity.tcp":0
            }
         },
         {
            "href":"/hass/command/vs/1",
            "rt":[
               "x.com.samsung.da.hass.command"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":false,
               "x.org.iotivity.tcp":0
            }
         },
         {
            "href":"/file/list/vs/1",
            "rt":[
               "x.com.samsung.file.list"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.s"
            ],
            "p":{
               "bm":1,
               "sec":false,
               "x.org.iotivity.tcp":0
            }
         },
         {
            "href":"/file/transfer/chunk/vs/1",
            "rt":[
               "x.com.samsung.file.chunk"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":1,
               "sec":false,
               "x.org.iotivity.tcp":0
            }
         },
         {
            "href":"/rm/state/vs/1",
            "rt":[
               "x.com.samsung.da.rm.state"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/rm/micomdata/vs/1",
            "rt":[
               "x.com.samsung.da.rm.micomdata"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.a"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/EasySetupResURI",
            "rt":[
               "oic.r.easysetup",
               "oic.wk.col"
            ],
            "if":[
               "oic.if.baseline",
               "oic.if.ll",
               "oic.if.b"
            ],
            "p":{
               "bm":1,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/WiFiConfResURI",
            "rt":[
               "oic.r.wificonf"
            ],
            "if":[
               "oic.if.baseline"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/CoapCloudConfResURI",
            "rt":[
               "oic.r.coapcloudconf"
            ],
            "if":[
               "oic.if.baseline"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         },
         {
            "href":"/DevConfResURI",
            "rt":[
               "oic.r.devconf"
            ],
            "if":[
               "oic.if.baseline"
            ],
            "p":{
               "bm":3,
               "sec":true,
               "port":49155,
               "x.org.iotivity.tls":46228
            }
         }
      ]
   }
]
2 Likes

This is the payload to control light using OCF (off is display on, on is display off)!

And you can use all options using OCF!

{
   "commands":[
      {
         "component":"main",
         "capability":"execute",
         "command":"execute",
         "arguments":[
            "mode/vs/0",
            {
               "x.com.samsung.da.options":[
                  "Light_On"
               ]
            }
         ]
      }
   ]
}
3 Likes

@JRFabbi: Thanks a lot. It works like a charm!

Do you have any links where to find additional information on using OCF?

I create this post with some usefull data.

I will post more tomorrow with information to get states from execute (to check comands coming from SmartThings app)

2 Likes

Hello all!

To know what command are sent from SmartThins app to the device you can simply get device status from the API after send command from app, you will see the payload at execute (as you mention on your fist post)

To send command you use execute command that need the href (the first string and to know you need the resouce from OCF device, I put mine on latest post, you can use OCF Device Spy to get this, simply turn off your router for some minutes and turn on again to search because the unit closes all ports after some hours connected) and the payload and this you can get using the SmartThings app (and if need more explanation you can see documentation from OCF that I put on another post).

Today I tested with postman and I’m able to do everything that is possible from SmartThings app so finally it’s possible to create alot of automations.

I’ve tested with SmartApps and you can subscribe to the execute capability, with this you can get status to your actions or if anything change on device on OCF capabilities.

Brilliant! Thanks a ton. It works perfectly fine. Now finally I can turn off the AC lights automatically during night time :slight_smile:

2 Likes

I’m just a regular user - how can I add it this functionally to my windfree controls? I just installed a windfree today and works great from SmartThings except that I can’t turn off the darn light.

1 Like

Hello @Krupal_Desai, I have my device ID and a token, from Postman I can receive the status of the air conditioning by executing the code: https://api.smartthings.com/v1/devices/ā€˜device-id’/states
but I can’t understand how I can send the command line to turn off the light, can you help me?

Hi @javalin, you can use curl command to turn off the light, like so:

curl -L -X POST 'https://api.smartthings.com/v1/devices/<device_id>/commands' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
--data-raw '{
  "commands": [
    {
      "component": "main",
      "capability": "execute",
      "command": "execute",
      "arguments": [
        "mode/vs/0",
          {
             "x.com.samsung.da.options":[
                "Light_On"
             ]
          }
       ]
    }
  ]
}'

Ironically, as Ronaldo mentioned above,
Light_On = display off
Light_Off = display on

3 Likes

@ Krupal_Desai Thank you very much for your help, I have already managed to get it to work!!! :slight_smile:

That’s two of us… any help with this please?

Hi All
I am new to SmartThings and REST API and struggle to turn command mentioned above into RULE.
I can successfully run that command using Postman:
`
[
{
ā€œcomponentā€: ā€œmainā€,
ā€œcapabilityā€: ā€œexecuteā€,
ā€œcommandā€: ā€œexecuteā€,
ā€œargumentsā€: [
ā€œmode/vs/0ā€,
{
ā€œx.com.samsung.da.optionsā€: [
ā€œLight_Onā€
]
}
]
}
]

Result is ā€œstatusā€: ā€œACCEPTEDā€
But when I try to create new RULE with that same command:
{
ā€œnameā€: ā€œTurn off AC light at 9:00 pmā€,
ā€œactionsā€: [
{
ā€œeveryā€: {
ā€œspecificā€: {
ā€œreferenceā€: ā€œMidnightā€,
ā€œoffsetā€: {
ā€œvalueā€: {
ā€œintegerā€: -180
},
ā€œunitā€: ā€œMinuteā€
}
},
ā€œactionsā€: [
{
ā€œcommandā€: {
ā€œdevicesā€: [
ā€œProper-IDā€
],
ā€œcommandsā€: [
{
ā€œcomponentā€: ā€œmainā€,
ā€œcapabilityā€: ā€œexecuteā€,
ā€œcommandā€: ā€œexecuteā€,
ā€œargumentsā€: [
ā€œmode/vs/0ā€,
{
ā€œx.com.samsung.da.optionsā€: [
ā€œLight_Onā€
]
}
]
}
]
}
}
]
}
}
]
}
I have status 422 ERROR
{
ā€œrequestIdā€: ā€œ31B00D9F-872D-4AA7-93D4-F937C74CE02Bā€,
ā€œerrorā€: {
ā€œcodeā€: ā€œConstraintViolationErrorā€,
ā€œmessageā€: ā€œThe request is malformed.ā€,
ā€œdetailsā€: [
{
ā€œcodeā€: ā€œBodyMalformedErrorā€,
ā€œtargetā€: ā€œUnknown targetā€,
ā€œmessageā€: ā€œMalformed body on line 27ā€,
ā€œdetailsā€:
}
]
}
}
`
Mentioned line 27 is exactly ā€œmode/vs/0ā€,
Could you please tell me what I am doing wrong? I have played with arguments value for three hours but no success.
Thank you very much in advance.

I’m also struggling with that. Did you manage how to solve this?

Guys, sorry for resurrecting this topic. I’m learning how to code, and the solutions here have helped me make some progress.

By adapting @Krupal_Desai curl command to the Shell Command Integration in Home Assistant, I was able to create two buttons to turn my WindFree display on and off.

However, I would like to create a sensor using REST to retrieve the display status as well. I found a code snippet for this, but it is not working.

sensor:
     - platform: rest
      name: "OCF_Display_Status"
      resource: "https://api.smartthings.com/v1/devices/<DEVICE ID HERE>/components/main/capabilities/samsungce.airConditionerLighting/status"
      method: GET
      headers:
        Authorization: "Bearer <YOUR TOKEN HERE>"
        value_template: "{{ value_json.lighting.value }}"   

I got the error "message: ā€œThe request is malformed.ā€
I suspect that the resource address is incorrect. Could someone point me in the right direction?