(closed) pushover script don't works after Update - Habib - 13.05.2017
Hi,
since the Update to the latest release on my SL (2.0.0) my script for notifications don't works anymore...
I used them for 1 year without any problems, but now without changing anything I don't get messages from spacelynk.
A testmessage via mail to pushover works, so the clients are working well...
Did you know anything about that problem?
My User Lib Script:
Code: require 'ssl.https'
local pushover_url = 'https://api.pushover.net/1/messages.json'
local token = 'mytoken' -- Your application token, at least 1 app must be created at pushover.net to get the application token
local user = 'my user token' -- Your user token, retrieve from settings inside pushover application for android or ios
function pushover(title, message, sound, priority, retry, expire)
if priority < -2 then priority = -2 end
if priority > 2 then priority = 2 end
if retry < 30 then retry = 30 end
if retry > 86400 then retry = 86400 end
if expire < retry then expire = retry end
if expire > 86400 then expire = 86400 end
if priority == 2 then prioritystring = ''.. priority .. '&retry=' .. retry .. '&expire=' .. expire ..'' else prioritystring = priority end
now = os.date('*t')
timestamp = string.format('%02d', now.day) .. '-' .. string.format('%02d', now.month) .. '-' .. now.year .. ' ' .. string.format('%02d', now.hour) .. ':' .. string.format('%02d', now.min) .. ':' .. string.format('%02d', now.sec)
local data_str = 'user=' .. user .. '&message=' .. message .. ' ' .. timestamp .. '&token=' .. token .. '&title=' .. title .. '&sound=' .. sound .. '&priority=' .. prioritystring .. ''
local res, code, headers, status = ssl.https.request(pushover_url, data_str)
end
my eventscript:
Code: value1 = event.getvalue('2/3/11') --holt den Ereigniswert
value2 = grp.getvalue('2/3/2') --holt den Status der Geräteraumtür
subjectopen = 'Geräteraumtür wurde aufgeschlossen'
messageopen = 'Geräteraumtür wurde aufgeschlossen'
subjectclose = 'Geräteraumtür wurde abgeschlossen'
messageclose = 'Geräteraumtür wurde abgeschlossen'
require("user.pushover")
--Set title for message
title = 'spaceLYnk'
--Set message to be send (current time and date will be added automaticly)
--message = 'Storing LBK1'
--Set sound to be played on device
--pushover(default), bike, bugle, cashregister, classical, cosmic, falling, gamelan, incoming, intermission, magic, mechanical, pianobar, siren, spacealarm, tugboat, alien, climb, persistent, echo, updown, none
sound = 'pushover'
--Set priority (-2 = no notification only badge and message in app, -1 = notification without sound or vibration, 0 = default, 1 = bypass user quiet hours (set in App not iOS), 2 = bypass user quiet hours (set in App not iOS) + acknowledge required
priority = 0
--Seconds to expire retry when not acknowledged, maximum = 86400 (24 hrs, only used with priority 2)
expire = 3600
--Seconds to retry when not acknowledged, minimum = 30 (only used with priority 2)
retry = 30
if value1 == true then
pushover(title, messageclose, sound, priority, retry, expire)
end
if value1 == false then
pushover(title, messageopen, sound, priority, retry, expire)
end
I don't know why, but during the testing without any changes it works already again???!!!
|