Hobby

Turn on/off Samsung SmartThings A/C from Fibaro HC3

In order to integrate your SmartThings devices into Fibaro HC3 you need to create access token and review API documention which can be found here:

https://developer.smartthings.com/docs/api/public#tag/Devices/operation/getDevices

Then, to send on or off command to your device, grab its UUID, create QuickApp with the following code:

function QuickApp:turnOn()
    self:debug("binary switch turned on")
    self:updateProperty("value", true)
    local url = "https://api.smartthings.com/v1/devices/a-b-c-d/commands"
    local payload  = '{"commands": [{"component": "main","capability":"switch","command":"on"}]}'
    net.HTTPClient():request(url, {
        options = {
            data = payload,
            method = 'POST',
            headers = {
                ["Authorization"] = "Bearer abcdef"
            },
            timeout = tcpTimeout,
        },
        success = function(response)  
                print(response.status)
                print(response.data)
        end,
        error = function(message)
                print("error:", message)
        end
    })
end