Code: Select all
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
Moderator: leecollings
Code: Select all
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
the Domoticz notification system differs from the email system. In the notification settings the addressee is set and in the Email system the sender.elgringo wrote: Thursday 29 November 2018 17:40 I want to send a notify only via email since it is long and contains multiple lines. When using the notify there is an option to send a system
However there is no 'NSS_EMAIL'. Is it possible to send a notify only via email? I know there is a email command but rather want to use the notify function to prevent storing the email addresses at multiple places.
Code: Select all
local httpResponse = "settingsFromDomoticz"
return {
on = { timer = { "every minute" },
httpResponses = { httpResponse }},
data = { mailTo = { initial = false }},
execute = function(dz, item, info)
local function extractMailTo()
rt = item.json
dz.data.mailTo = rt.EmailTo
end
local function getDomoticzSettings()
local url = dz.settings['Domoticz url'] .. "/json.htm?type=settings"
dz.openURL ({ url = url, method = "GET", callback = httpResponse })
end
if item.isHTTPResponse then
extractMailTo()
elseif not dz.data.mailTo then
getDomoticzSettings()
return
end
-- Rest of script
-- This one use the elegant method by taking the mailTo address from dz.data.mailTo
dz.email(info.scriptName .. ". Triggered by event: " .. info.trigger ,"I got this Email adres from data", dz.data.mailTo )
-- This one use the dirty method (using a dummy mailTo address, and produce an event eror but still ends up in your inbox
dz.email(info.scriptName .. ". Triggered by ëvent: " .. info.trigger ,"I use a dummy mailTo address","root@localhost")
end
}Users browsing this forum: No registered users and 1 guest