Based on this topic viewtopic.php?f=31&t=35252 I have made simple script to use Nextcloud as notification server.
Thx again @waaren
Code: Select all
return
{
on =
{
customEvents = { "notification" },
},
logging = {
level = domoticz.LOG_DEBUG,
marker = notification,
},
execute = function(dz, item)
local function notify()
local ADMIN = "adminuser"
local TOKEN = "secret-token"
local USER = "targetuser"
local MESSAGE = item.data
dz.executeShellCommand(
{
command = 'curl -H "OCS-APIREQUEST: true" -X POST https://'..ADMIN..':'..TOKEN..'@redandblack.cz/ocs/v2.php/apps/admin_notifications/api/v1/notifications/'..USER..' -d "shortMessage='..MESSAGE..'"' ,
timeout = 300,
})
end
if item.isTimer or item.isDevice or item.customEvent then
notify()
else
dz.log(item,dz.LOG_DEBUG)
end
end
}
Code: Select all
mosquitto_pub -h domoticz -t domoticz/in -m '{"command":"customevent", "event":"notification","data":"message"}'
Code: Select all
domoticz.emitEvent('notification','message"')