This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Pushover notification scripting
#6
(25.10.2016, 21:38)Erwin van der Zwart Wrote: Hi Jørn,

Use this:

BR,

Erwin

Thanks, i had to hack it somewhat to make it to work, resulted in this;

Code:
value = event.getvalue()
previousvalue = storage.get ('outside_temp') -- name 'previous_value' must be unique in each script
if previousvalue >= 2.01 and value <= 2 then

-- put here your push command one
 require("user.pushover")
--Set title for message
 title = 'Notification'
--Set message to be send (current time and date will be added automaticly)
 message = 'Near Freezing'
--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 = 'updown'
--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 = -1
--Seconds to retry when not acknowledged, minimum = 30 (only used with priority 2)
 retry = 60
--Seconds to expire retry when not acknowledged, maximum = 86400 (24 hrs, only used with priority 2)
 expire = 5400
--Activate Pushover with parameters above
 pushover(title, message, sound, priority, retry, expire)

end
 
 storage.set ('outside_temp', value) -- name 'previous_value' must be unique in each script

In this instant used to alert when temperature outside gets close to freezing. Maybe a little messy, but it does the job  Wink

I was not able to save the script with "end" after storage.set , but it seems to be working.'


Edit; To make it work, i have to run a script first with only getvalue and storage.set, to make it write a value to storage. If not, the script get stopped before getting to store the value (error; attempt to compare number with nil). Workarounds to avoid this`?

Best regards, Jørn.
Reply


Messages In This Thread
Pushover notification scripting - by Jørn - 18.09.2016, 11:00
RE: Pushover notification scripting - by Jørn - 26.10.2016, 13:42

Forum Jump: