Code : Tout sélectionner
-- managedNotify test script
return {
active = true,
on = { timer = { "every 5 minutes" }},
execute = function(domoticz)
--local notificationTable = { domoticz.NSS_PUSHBULLET, domoticz.NSS_TELEGRAM } --Systèmes de notification disponibles : "PUSHBULLET", "HTTP", "GCM", "KODI", "LMS", "PROWL", "PUSHALOT"
local SubSystem = "TELEGRAM,PUSHBULLET"
--[[ Systèmes de notification disponibles :
NSS_GOOGLE_CLOUD_MESSAGING NSS_HTTP NSS_KODI NSS_LOGITECH_MEDIASERVER NSS_NMA NSS_PROWL NSS_PUSHALOT NSS_PUSHBULLET NSS_PUSHOVER NSS_PUSHSAFER
Pour une notification sur plusieurs systèmes, séparez les systèmes par une virgule et entourez l'ensemble par des {}.
Exemple :{domoticz.NSS_PUSHBULLET, domoticz.NSS_HTTP}
--]]
function split(s, delimiter)
result = {};
for match in (s..delimiter):gmatch("(.-)"..delimiter) do
table.insert(result, match);
end
return result;
end
function notificationTable(str)
--NSS_GOOGLE_CLOUD_MESSAGING, NSS_HTTP, NSS_KODI, NSS_LOGITECH_MEDIASERVER, NSS_NMA,NSS_PROWL, NSS_PUSHALOT, NSS_PUSHBULLET, NSS_PUSHOVER, NSS_PUSHSAFER, NSS_TELEGRAM
if (str) then
str = string.gsub (str,"GCM", domoticz.NSS_GOOGLE_CLOUD_MESSAGING)
str = string.gsub (str,"HTTP", domoticz.NSS_HTTP)
str = string.gsub (str,"LMS", domoticz.NSS_LOGITECH_MEDIASERVER)
str = string.gsub (str,"NMA", domoticz.NSS_NMA)
str = string.gsub (str,"PROWL", domoticz.NSS_PROWL)
str = string.gsub (str,"PUSHALOT", domoticz.NSS_PUSHALOT)
str = string.gsub (str,"PUSHOVER", domoticz.NSS_PUSHOVER)
str = string.gsub (str,"PUSHSAFER", domoticz.NSS_PUSHSAFER)
str = string.gsub (str,"PUSHBULLET", domoticz.NSS_PUSHBULLET)
str = string.gsub (str,"TELEGRAM", domoticz.NSS_TELEGRAM)
end
return (split(str,','))
end
domoticz.notify("Test Notification \xF0\x9F\x98\x81", "Test Notification \xF0\x9F\x98\x81 : \n"..tostring(domoticz.time.raw), domoticz.PRIORITY_NORMAL,domoticz.SOUND_DEFAULT, "" , notificationTable(SubSystem) )
end
}