Re: Sonoff - Aqara motion sensor mis à jour sans mouvement
Publié : 13 oct. 2022, 08:24
Le nouveau script sur 2 devices car j'ai 2 exemplaires du capteur maintenant
Peut-être ne suis-je pas bien réveillé ce matin
Les screenshots
Peut-être ne suis-je pas bien réveillé ce matin
Code : Tout sélectionner
-- the triggered script
local DEV = {2796, 2806}
-- log options
local LOG_DEBUG = 2 -- 0 =>ERROR / 1 => FORCE / 2 => DEBUG
local LOG_LEVEL
local LOGGING
if LOG_DEBUG == 2 then
LOGGING = domoticz.LOG_DEBUG
LOG_LEVEL = domoticz.LOG_DEBUG
elseif LOG_DEBUG == 1 then
LOGGING = domoticz.LOG_ERROR
LOG_LEVEL = domoticz.LOG_FORCE
else
LOGGING = domoticz.LOG_ERROR
LOG_LEVEL = domoticz.LOG_INFO
end
return {
logging = {
level = LOGGING
},
on = {
devices = DEV
},
execute = function(dz, item)
_G.logMarker = dz.moduleLabel
local function logWrite(str,level) -- Support function for shorthand debug log statements
if level == nil then
level = LOG_LEVEL
end
dz.log(tostring(str),level)
end
logWrite(item.id .. ' ' .. item.name .. ' ' .. item.state .. ' ' .. item.lastUpdate.raw)
end
}