Hi everybody, i need some help with the Pushover script. Everything is set up and working great, but my issue is that the script runs regardless of the value of the KNX object. I would i.e. like it to run only when the object is set to "1" or "0", and possibly when over or under a certain value (if for example a temperature climbs below or over a set point).
It's easy to make this happen with logic functions on my KNX devices, but i would rather keep it all in the LM5.
My lua programming skills are equal to zero
value = event.getvalue()
if value == true then -- or use =< 21
-- put here your push command
elseif value == false then -- or use => 22
-- put here your action / command
end
BR,
Erwin
Hi again Erwin, another problem arose when i started using this for real. I get an alert every time the bus get's updated with a lower value than set. What would i need to add in the script to make it check previous value, and not to run the script if previous value already led it to run the script`?
value = event.getvalue()
previousvalue = storage.get('previous_value') -- name 'previous_value' must be unique in each scriptifvalue ~= previousvaluethenifvalue == truethen-- or use =< 21-- put here your push commandelseifvalue == falsethen-- or use => 22-- put here your action / commandendstorage.set('previous_value', value) -- name 'previous_value' must be unique in each scriptend
26.10.2016, 13:42 (This post was last modified: 26.10.2016, 15:55 by Jørn.
Edit Reason: Additions
)
(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:
12345678910111213141516171819202122232425
value = event.getvalue()
previousvalue = storage.get ('outside_temp') -- name 'previous_value' must be unique in each scriptifpreviousvalue >= 2.01andvalue <= 2then-- put here your push command onerequire("user.pushover")
--Set title for messagetitle = '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, nonesound = '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 requiredpriority = -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 abovepushover(title, message, sound, priority, retry, expire)
endstorage.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
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`?
28.12.2016, 17:49 (This post was last modified: 28.12.2016, 17:54 by jetsetter.)
Hi, I have set up and used the pushover script according to the example given by Erwin (thank you for this), but I cannot see how I can select which device the message should be delivered to. So far I have downloaded and registered the mobile app in my phone and my wife's phone, but the messages are broadcasted to both phones. In the pushover website, you can choose to send a test notification by choosing a specific registered device or all the registered devices (broadcast). Is there another script that allows to select to which device the notification is send to?
Thank you in advance.
EDIT: I have seen in pushover API documentation that I can include in the sending url another optional field called "device" which is what I was looking for, so I will try this to see. I propose for Erwin to edit his original example in order to include this field as I found it very useful.
09.04.2017, 11:23 (This post was last modified: 09.04.2017, 11:52 by FatMax.)
I have played around a bit with Pushovers Glances API for the Apple Watch. It´s currently in Beta.
They specifically ask you not to send more than 1 update to the Glances API every 20 minutes, because of the way that Apple handles battery efficiency on the Apple Watch. It seems to work reliably though, except if you do not open the main app on your iPhone every 2 days. I suppose this is because of the lack of background tasking in iOS.
Create a new user library, user.glances :
Code:
12345678910
require'ssl.https'localglances_url = 'https://api.pushover.net/1/glances.json'localtoken = 'INSER APPLICATION TOKEN'-- Your application token, at least 1 app must be created at pushover.net to get the application tokenlocaluser = 'INSERT USER TOKEN'-- Your user token, retrieve from settings inside pushover application for iosfunctionglances(title, text, subtext, count, percent)
localdata_str = 'user=' .. user .. '&text=' .. text .. '&subtext=' .. subtext .. '&token=' .. token .. '&title=' .. title .. ''localres, code, headers, status = ssl.https.request(glances_url, data_str)
end
This script handles info sent to the Glances API, specified by you:
Code:
123456789101112
--Glances-script--Some glances support 3 lines of text, some only support percentage or count, etc--Set title for glancetitle = 'TITLE GOES HERE'--Set 1st textfieldtext = 'TEXT'--Set 2nd textfieldsubtext = 'SUBTEXT'count = ''percent = ''--Calls the user.glances user libraryglances(title, text, subtext, count, percent)
I´m sure this code can be cleaned up some, but just wanted to post it so other people can try it out.