'DZVents/ChanceICON' toevoegen
This commit is contained in:
37
DZVents/ChanceICON
Normal file
37
DZVents/ChanceICON
Normal file
@@ -0,0 +1,37 @@
|
||||
-- Icon changer
|
||||
|
||||
return { on = {
|
||||
devices = {<DEV-IDX>}, -- change to your device
|
||||
},
|
||||
|
||||
-- logging =
|
||||
-- {
|
||||
-- level = domoticz.LOG_ERROR, -- switch to LOG_ERROR when OK
|
||||
-- marker = 'setIcon'
|
||||
-- },
|
||||
|
||||
execute = function(dz, item)
|
||||
|
||||
local icons = { -- level = iconNumber
|
||||
[0] = 103,
|
||||
[10] = 110,
|
||||
[20] = 110,
|
||||
[30] = 103,
|
||||
}
|
||||
|
||||
local function setIcon(iconNumber)
|
||||
local url = dz.settings['Domoticz url'] .. '/json.htm?type=setused&used=true&name=' .. dz.utils.urlEncode(item.name) ..
|
||||
'&description=' .. dz.utils.urlEncode(item.description) .. -- Required. If not set it will be blanked out.
|
||||
'&idx=' .. item.id ..
|
||||
'&switchtype=' .. item.switchTypeValue ..
|
||||
'&customimage=' .. iconNumber
|
||||
return dz.openURL(url)
|
||||
end
|
||||
|
||||
if item.level ~= item.lastLevel then
|
||||
setIcon(icons[item.level])
|
||||
else
|
||||
--dz.log('No Icon change necessary' .. item.id,dz.LOG_DEBUG)
|
||||
end
|
||||
end
|
||||
}
|
||||
Reference in New Issue
Block a user