This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
action_http [2018/08/14 16:15] Niek Fixed busy state at startup and made DEVICE optional again |
action_http [2018/08/15 12:28] (current) Niek Bugfix |
||
---|---|---|---|
Line 90: | Line 90: | ||
info = info .."&mimetype=" .. http.getMimetype() | info = info .."&mimetype=" .. http.getMimetype() | ||
end | end | ||
+ | |||
if devobj.setColor(info) == false then | if devobj.setColor(info) == false then | ||
error("http action device \"" .. devname .. "\" color could not be set to \"" .. info .. "\"") | error("http action device \"" .. devname .. "\" color could not be set to \"" .. info .. "\"") | ||
end | end | ||
- | if devobj.setLabel(http.getData()) == false then | + | local label = data['old_data']; |
- | error("http action device \"" .. devname .. "\" label could not be set to \"" .. http.getData() .. "\"") | + | if http.getCode() == 200 then |
+ | label = http.getData(); | ||
+ | end | ||
+ | if devobj.setLabel(label) == false then | ||
+ | error("http action device \"" .. devname .. "\" label could not be set to \"" .. label .. "\"") | ||
end | end | ||
Line 140: | Line 145: | ||
local new_state = nil; | local new_state = nil; | ||
local old_data = devobj.getLabel(); | local old_data = devobj.getLabel(); | ||
+ | data['old_data'] = old_data; | ||
if old_state ~= nil then | if old_state ~= nil then |