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
#11
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:
require 'ssl.https'

local glances_url = 'https://api.pushover.net/1/glances.json'
local token = 'INSER APPLICATION TOKEN' -- Your application token, at least 1 app must be created at pushover.net to get the application token
local user = 'INSERT USER TOKEN' -- Your user token, retrieve from settings inside pushover application for ios

function glances(title, text, subtext, count, percent)
 local data_str = 'user=' .. user .. '&text=' .. text .. '&subtext=' .. subtext .. '&token=' .. token .. '&title=' .. title  .. ''
 local res, code, headers, status = ssl.https.request(glances_url, data_str)
end

This script handles info sent to the Glances API, specified by you:

Code:
--Glances-script
--Some glances support 3 lines of text, some only support percentage or count, etc
--Set title for glance
title = 'TITLE GOES HERE'
--Set 1st textfield
text = 'TEXT'
--Set 2nd textfield
subtext = 'SUBTEXT'
count = ''
percent = ''
--Calls the user.glances user library
glances(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.
Reply


Messages In This Thread
Pushover notification scripting - by Jørn - 18.09.2016, 11:00
RE: Pushover notification scripting - by FatMax - 09.04.2017, 11:23

Forum Jump: