Merci pour le tuto,
j'ai bricolé un truc qui fonctionne, mais je pense qu'il pourrai être simplifier un peu, qu'en pensez vous?
function QuickApp:open()
self:debug("base shutter opened")
self:updateProperty("state", "Opened")
local http = net.HTTPClient()
http:request("https://airsend.cloud/device/xxxxx/command/4/?session=???", {
success = function(response)
if response.status == 200 then
print('OK, réponse : '.. response.data)
else
print("Erreur : status=" .. tostring(response.status))
end
end,
error = function(err)
print("Erreur : " .. err)
end,
options = {
method = 'GET'
}
})
end
function QuickApp:close()
self:debug("base shutter closed")
self:updateProperty("state", "Closed")
local http = net.HTTPClient()
http:request("https://airsend.cloud/device/xxxxx/command/5/?session=???", {
success = function(response)
if response.status == 200 then
print('OK, réponse : '.. response.data)
else
print("Erreur : status=" .. tostring(response.status))
end
end,
error = function(err)
print("Erreur : " .. err)
end,
options = {
method = 'GET'
}
})
end
function QuickApp:stop()
self:debug("base shutter stopped")
self:updateProperty("state", "Unknown")
local http = net.HTTPClient()
http:request("https://airsend.cloud/device/xxxxx/command/3/?session=???", {
success = function(response)
if response.status == 200 then
print('OK, réponse : '.. response.data)
else
print("Erreur : status=" .. tostring(response.status))
end
end,
error = function(err)
print("Erreur : " .. err)
end,
options = {
method = 'GET'
}
})
end