Pushover Plugin - push notifications

Posted on
Sat Feb 23, 2019 11:37 am
Dual offline
Posts: 122
Joined: Feb 05, 2019

Re: Pushover Plugin - push notifications

dduff617 wrote:
if your energy meter usage value is a property of an indigo device, then you can use the syntax "%%d:nnnnnn:stateid%%", where you would replace "nnnnnn" with the numeric deviceID and "stated" with the name of the state.


Exactly what I needed. Thanks!

Posted on
Tue Mar 26, 2019 12:36 am
Dual offline
Posts: 122
Joined: Feb 05, 2019

Re: Pushover Plugin - push notifications

FlyingDiver wrote:
If it's a device state, then you can do that substitution as well.


Is there a link to a list of all possible substitutions and their syntax? A user manual of sorts?

Cheers

John

Posted on
Tue Mar 26, 2019 7:38 am
FlyingDiver offline
Posts: 3466
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Pushover Plugin - push notifications

Dual wrote:
Is there a link to a list of all possible substitutions and their syntax? A user manual of sorts?


There's only variable substitutions and device state substitutions, both of which are described in the last few posts in this thread.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Mar 26, 2019 8:15 am
Dual offline
Posts: 122
Joined: Feb 05, 2019

Re: Pushover Plugin - push notifications

FlyingDiver wrote:
There's only variable substitutions and device state substitutions, both of which are described in the last few posts in this thread.

Thanks! Pushover is awesome. I am using it extensively. Great plugin!


Sent from my iPhone using Tapatalk

Posted on
Tue Jul 02, 2019 1:11 am
Dual offline
Posts: 122
Joined: Feb 05, 2019

Re: Pushover Plugin - push notifications

When entering my message in the Message field how do I include a carriage return (line feed) in my message so I can delineate my message across several lines?

John


Sent from my iPhone using Tapatalk

Posted on
Tue Jul 02, 2019 2:27 am
racarter offline
User avatar
Posts: 215
Joined: Jun 18, 2016
Location: North Yorkshire, UK

Re: Pushover Plugin - push notifications

I don't know of a way to do it via the plugin menu dialogue, but you can do it in a Python script:

Code: Select all
alertPlugin = indigo.server.getPlugin('io.thechad.indigoplugin.pushover')
if alertPlugin.isEnabled():
   msgTitle = "Test"
   message = "Hello\nsailor"
   try:
      alertProps = {'msgTitle':msgTitle, 'msgBody':message, 'msgSound':'pushover', 'msgPriority':0, 'msgDevice':'', 'msgSupLinkUrl':'', 'msgSupLinkTitle':''}
      alertPlugin.executeAction("send", props=alertProps)
   except:
      indigo.server.log('Message send error', isError=True)
else:
   indigo.server.log('Pushover plugin not available', isError=True)

Posted on
Tue Jul 02, 2019 8:17 am
whmoorejr offline
User avatar
Posts: 281
Joined: Jan 15, 2013
Location: Houston, TX

Re: Pushover Plugin - push notifications

If you have a multi-line text field saved as a variable, you can use that variable in the pushover message and it will do the carriage returns.

If you are going to have to write a script to build the variable first, either include sending the pushover message from that script or add a slight delay to allow the script to run before the pushover plugin fires.

Most of my pushover actions are currently done via python script outside of the plugin so I can segregate my notifications by type. I've created Application APIs for various subjects (Climate, Security, Network, Motion, Access Control, etc.)

This is one I use with the Fing plugin to notify me via email, pushover and indigo log entry when a new device joins my network. (I stole this from someone else on the forum... credit to that guy :lol: )

Code: Select all
ipDev = indigo.variables["ipDevsNewDeviceNo"]
ipDevVarNumber = ipDev.value.split(";")[0]
devName = ipDev.value.split(";")[1]
dev = indigo.devices[devName]
st = dev.states # shortcut

theSubject = "New device on network: " + st["ipNumber"]
theBody  = "New device on network: "  + st["ipNumber"]     +"\n"
theBody += "MACNumber: "            +st["MACNumber"]       +"\n"
theBody += "hardwareVendor: "       +st["hardwareVendor"]  +"\n"
theBody += "indigoID: "             +str(dev.id)           +"\n"
theBody += "Name : "                +devName               +"\n"

indigo.server.log(theBody)# also send it to the indigo log file

indigo.server.sendEmailTo("YourEmail@gmail.com", subject=theSubject, body=theBody)

import requests
r = requests.post("https://api.pushover.net/1/messages.json", data = {
  "token": "ApplicationToken", #your application token, I used a specific one for network
  "user": "YourPushoverUserNumber",
  "message": theBody
})
print(r.text)


I hope that helps. FYI, I never figured out how to do a pushover subject line via python.... my script only captures the subject line for the email part of my script.

Posted on
Tue Jul 02, 2019 8:28 am
whmoorejr offline
User avatar
Posts: 281
Joined: Jan 15, 2013
Location: Houston, TX

Re: Pushover Plugin - push notifications

Here is another example (used for letting me know if the thermostat setting change) that creates the message by combining different variable. (of course this references my variables and you'd have to change that)

Code: Select all
#Build the message
import datetime
Time = "{date:%H%:%M}".format(date=datetime.datetime.now())
DTG = u"{}_{}".format(Time, Title)

theMode = indigo.variables[143562231].value
isCool = indigo.variables[285071090].value
isHeat = indigo.variables[1231095420].value
Temp = indigo.variables[796298002].value

TheMessage = '%s\n%s at %s\n%s is %s\n%s is %s\n%s is %s' % ("Thermostat Mode Change", theMode, Time, "Cool Setpoint", isCool, "Heat Setpoint", isHeat, "Current Temp", Temp)

indigo.variable.updateValue(195713191, value=TheMessage) # I used this line for testing to see if it was building a message or error-ing out.

#Send Pushover message
import requests
r = requests.post("https://api.pushover.net/1/messages.json", data = {
  "token": "YourApplicationToken", # I used a specific application token for climate
  "user": "YourPushoveUserID",
  "message": TheMessage
})
print(r.text)

Posted on
Tue Jul 02, 2019 8:55 am
FlyingDiver offline
Posts: 3466
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Pushover Plugin - push notifications

Dual wrote:
When entering my message in the Message field how do I include a carriage return (line feed) in my message so I can delineate my message across several lines?


Please file an enhancement request for a multi-line message text field: https://github.com/IndigoDomotics/indig ... ver/issues

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Who is online

Users browsing this forum: No registered users and 1 guest