Control Samsung Air Conditioner interfacing Domoticz with SmartThings API [Solved]
Posted: Friday 11 December 2020 0:23
Good night,
I would like any help to 'POST' this command by dzVent to turn off the dispplay of my Air Conditioner. I have write some small lines of code based on a script that I have seen for a washing machine of the same brand, although in that case a GET 'state' is made and my goal is to perform a 'POST' command:
And the command I want to 'POST' is this:
I would like any help to 'POST' this command by dzVent to turn off the dispplay of my Air Conditioner. I have write some small lines of code based on a script that I have seen for a washing machine of the same brand, although in that case a GET 'state' is made and my goal is to perform a 'POST' command:
Code: Select all
-- assumpitions for Samsung Air Conditionner Script
-- API key from https://developer.samsung.com/smartthings
-- Device ID from https://smartthings.developer.samsung.com/docs/api-ref/st-api.html#operation/getDevices i used postman to get the device. Making a get requrdy with https://api.smartthings.com/v1/devices/
local API = 'Your API token'
local Device = 'Device-ID'
local scriptVar = 'AirConditionner_JSON'
return
{
on =
{
timer =
{
'every minute', -- just an example to trigger the request
},
httpResponses =
{
scriptVar, -- must match with the callback passed to the openURL command
},
},
logging =
{
level = domoticz.LOG_DEBUG ,
marker = scriptVar,
},
execute = function(dz, item)
if item.isTimer then
dz.openURL({
url = 'https://api.smartthings.com/v1/devices/'.. Device .. '/commands',
headers = { ['Authorization'] = 'Bearer '.. API },
method = 'POST',
callback = scriptVar, -- httpResponses above.
})
returnAny help is appreciated{
"commands":[
{
"component":"main",
"capability":"execute",
"command":"execute",
"arguments":[
"mode/vs/0",
{
"x.com.samsung.da.options":[
"Light_On"
]
}
]
}
]
}