I have written this and I just like to check if I could have done it in another way or if something is wrong.
Needed a bit mot flexible notification system.
API I'm using is from this site https://joaoapps.com/join/api/
I wised I could encrypt my message as well but then I need some thing i wrote in this script https://github.com/varazir/join/blob/ma ... message.pl ( top modules loaded ) and code
https://github.com/varazir/join/blob/11 ... ge.pl#L325
The API can be used to send command to my phone to execute and then I don't need the title and icon.
dzVents: global_data.lua
Code: Select all
helpers = {
join = function(dz, deviceId, command, title)
icon = "&icon=https://raw.githubusercontent.com/domoticz/domoticz/master/www/images/logo.png"
toID = "&deviceId=" .. deviceId
if string.match(command, "=:=") then -- if command contains "=:=" it's should not add title and a icon
message = "&text=" .. command
else
message = "&title=" .. title .. "&text=" .. command .. icon
end
message = message .. toID
message = dz.urlEncode(message)
dz.notify(message,dz.PRIORITY_NORMAL,dz.NSS_HTTP)
end
}