SmartThings Rest API using Tasker

That’s pretty much what I was going to make. However I would suggest adding in handling return response. That way your not attempting to turn off a light that never got turned on.

I’m using sonoff temperature sensors that are connected with smarthings.
Can somebody make tasker widget that can display temperature and update itself

1 Like

Hmm. That sounds interesting. Send me. Pm with the information copied to the clipboard from the get device info task, and the device status task.


where to send the info?

So i have some RGB lights I wanted to control, i got the color working by removing “” so it sends int instead of a string, however I can’t get it to control the level/brightness. It doesn’t give a error it just doesn’t change

{ “commands”: [ {
“component”: “main”,
“capability”: “colorControl”,
“command”: “setColor”,
“arguments”: [{
“hue”: %colorHue,
“saturation”: %colorSaturation,
“level”: %colorLevel
} ] }

Get device status returns this:

You need to send a separate setLevel command. Level isn’t part of the colorControl capability in SmartThings. Use the switchLevel capability.

1 Like

:point_up:This is correct.

Here’s the code for dimmer/brightness.

{"commands": [{"component":"main","capability": "switchLevel","command": "setLevel","arguments": [%DimmerLevel]}]}
1 Like

A little more info on this, the capability colorControl only has attributes for color, hue, and saturation and commands for setColor, setHue and setSaturation.

I tried using the turn on and set level task, turns out there is a typo in that one: %dimmerLevel is the variable used but in the http request it says %DimmerLevel

Thats why I couldn’t figure it out :sweat_smile:

1 Like

If you use devices:commands in the cli it will show you what is accepted for a device…

mikefitzgerald@Mikes-MacBook-Air ~ % smartthings devices:commands 1a9bf31e-97b7-49fc-87e5-09c591c4315c 


 1  switch                                   
 2  button                                   
 3  platemusic11009.zoozLedMode              
 4  platemusic11009.zoozLedColor             
 5  platemusic11009.zoozLedBrightness        
 6  platemusic11009.firmware                 
 7  platemusic11009.basicSetAssociationGroup 
 8  platemusic11009.deviceNetworkId          
 9  refresh                                  

? Enter capability index or id 3

 1  setLedMode(value<enum 
      - onWhenOff         
      - onWhenOn          
      - alwaysOff         
      - alwaysOn>)        

1 Like

Thanks for finding that. I fixed it, I will republish the main tasks along with some new ones.

In tasker is there a quick way to go from the label to the ID, I’d like to be able to call turn on/off with the label as parameter instead of the dialog option. (To automate things)

Technically you only need the http request action. You can edit out the variables with the deviceid and commands. All my tasks a simply examples. If you could be a bit more specific on exactly what you want it will help me narrow down how to help.

Okay I don’t know how to explain it clearly but I’ll give it another try:
I would like to be able to convert a device label to a device id.
So basically a task that i can feed the ID for example “smartplug_1” as a parameter and it would set %deviceID to the corresponding ID

So you want to use the perform task action in tasker and use the %par1 to supply the deviceId to a generic task. And the %par1 is the device label and the generic task does a lookup in the local db for the deviceId correct?

Here are some new code snippet for use with @philh30 schlage lock driver.

Set Alarm Mode (argument - (off, activity, tamper, forcedwentry))

 {"commands": [ { "component": "settings", "capability": "platinummassive43262.schlageLockAlarm", "command": "setAlarmMode", "arguments": ["{{argumentMode}}"] } ] }

Set Tamper Sensitive (level (1-5))

{ "commands": [ { "component": "settings", "capability": "platinummassive43262.schlageLockAlarm", "command": "setTamperSensitivity", "arguments": [{{level}}] } ] }

Set Activity Sensitivity (level (1-5))

{ "commands": [ { "component": "settings", "capability": "platinummassive43262.schlageLockAlarm", "command": "setActivitySensitivity", "arguments": [{{level}}] } ] }

Set Forced Sensitivity (level (1-5))

{ "commands": [ { "component": "settings", "{ "commands": [ { "component": "settings", "capability": "platinummassive43262.vacationMode", "command": "off", "arguments": [] } ] }capability": "platinummassive43262.schlageLockAlarm", "command": "setForcedSensitivity", "arguments": [{{level}}] } ] }

External Keypad Beep (command -(beep or off))

{ "commands": [ { "component": "settings", "capability": "platinummassive43262.keypadBeep", "command": "{{command}}", "arguments": [] } ] }

Auto Lock (command -(autolock or off))

{ "commands": [ { "component": "settings", "capability": "platinummassive43262.autoLock", "command": "{{command}}", "arguments": [] } ] }

Interior Schlage button (command- (disable or enable))

{ "commands": [ { "component": "settings", "capability": "platinummassive43262.schlageInteriorButton", "command": "{{command}}", "arguments": [] } ] }

Lock and Leave (command (lockandleave or off))

{ "commands": [ { "component": "settings", "capability": "platinummassive43262.lockAndLeave", "command": "{{command}}", "arguments": [] } ] }

Vacation Mode (command -(vacation or off))

{ "commands": [ { "component": "settings", "capability": "platinummassive43262.vacationMode", "command": "{{command}}", "arguments": [] } ] }