Pushover Plugin - push notifications

This subforum holds the older topics about this plugin before it was moved to open source. It's locked and only provided as historical reference.
Dual
Posts: 267
Joined: Tue Feb 05, 2019 6:01 pm

Re: Pushover Plugin - push notifications

Post by Dual »

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!
Dual
Posts: 267
Joined: Tue Feb 05, 2019 6:01 pm

Re: Pushover Plugin - push notifications

Post by Dual »

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
User avatar
FlyingDiver
Posts: 7326
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Pushover Plugin - push notifications

Post by FlyingDiver »

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
Dual
Posts: 267
Joined: Tue Feb 05, 2019 6:01 pm

Re: Pushover Plugin - push notifications

Post by Dual »

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
Dual
Posts: 267
Joined: Tue Feb 05, 2019 6:01 pm

Re: Pushover Plugin - push notifications

Post by Dual »

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
User avatar
racarter
Posts: 500
Joined: Sat Jun 18, 2016 4:23 am
Location: North Yorkshire, UK
Contact:

Re: Pushover Plugin - push notifications

Post by racarter »

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)
User avatar
whmoorejr
Posts: 767
Joined: Tue Jan 15, 2013 11:23 am
Location: Houston, TX

Re: Pushover Plugin - push notifications

Post by whmoorejr »

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.
Bill
My Plugin: My People
User avatar
whmoorejr
Posts: 767
Joined: Tue Jan 15, 2013 11:23 am
Location: Houston, TX

Re: Pushover Plugin - push notifications

Post by whmoorejr »

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)
Bill
My Plugin: My People
User avatar
FlyingDiver
Posts: 7326
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Pushover Plugin - push notifications

Post by FlyingDiver »

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
davinci

Re: Pushover Plugin - push notifications

Post by davinci »

The plugin is not working anymore for me. Seems like a connection error.
Pushover works over the website directly.

I'm running the latest version 1.5.4.
Pushover Error Error in plugin execution ExecuteAction:

Traceback (most recent call last):
File "plugin.py", line 114, in send
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/IndigoPluginHost.app/Contents/Resources/PlugIns/requests/api.py", line 111, in post
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/IndigoPluginHost.app/Contents/Resources/PlugIns/requests/api.py", line 57, in request
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/IndigoPluginHost.app/Contents/Resources/PlugIns/requests/sessions.py", line 477, in request
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/IndigoPluginHost.app/Contents/Resources/PlugIns/requests/sessions.py", line 587, in send
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/IndigoPluginHost.app/Contents/Resources/PlugIns/requests/adapters.py", line 467, in send
ConnectionError: ('Connection aborted.', error(54, 'Connection reset by peer'))
Dual
Posts: 267
Joined: Tue Feb 05, 2019 6:01 pm

Re: Pushover Plugin - push notifications

Post by Dual »

I have a message sent via Pushover every hour. It has failed intermittently over the past several weeks. Yesterday 20 messages succeeded and 4 failed.


Sent from my iPhone using Tapatalk
vtmikel
Posts: 648
Joined: Fri Aug 31, 2012 12:45 pm
Location: Boston, MA
Contact:

Re: Pushover Plugin - push notifications

Post by vtmikel »

The api is down due to a DoS attack.


https://twitter.com/pushoverapp/status/ ... 48416?s=21




Sent from my iPad using Tapatalk Pro
Dual
Posts: 267
Joined: Tue Feb 05, 2019 6:01 pm

Re: Pushover Plugin - push notifications

Post by Dual »

I have a recurring error from Pushover in my log:

Code: Select all

2020-09-08 00:00:06.673	Pushover Error	Error in plugin execution ExecuteAction:

Traceback (most recent call last):
  File "plugin.py", line 121, in send
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 25: ordinal not in range(128)
It appears to be due to the degrees symbol included in my Pushover message:

Code: Select all

1.112 kWh energy used
83 °F west temperature
I am using the latest version of Pushover from the Plugin store 1.5.3.

I checked on GitHub (I am not a user of GitHub nor knowledgable re GitHub) and see Issue #26 fix - unicode error ... @FlyingDiver committed on Apr 27, 2019. There is a Release 1.5.4 @FlyingDiver released this on Apr 27, 2019. It is labelled Pre-release.

I am guessing the fix by @FlyingDiver would correct my problem. Why is it pre-release and not available from the Indigo Plugin Store? Can I download it from GitHub somehow and use it with Indigo, replacing version 1.4.3? How do I do this?

Cheers

John
User avatar
FlyingDiver
Posts: 7326
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Pushover Plugin - push notifications

Post by FlyingDiver »

Dual wrote: I checked on GitHub (I am not a user of GitHub nor knowledgable re GitHub) and see Issue #26 fix - unicode error ... @FlyingDiver committed on Apr 27, 2019. There is a Release 1.5.4 @FlyingDiver released this on Apr 27, 2019. It is labelled Pre-release.

I am guessing the fix by @FlyingDiver would correct my problem. Why is it pre-release and not available from the Indigo Plugin Store? Can I download it from GitHub somehow and use it with Indigo, replacing version 1.4.3? How do I do this?

Cheers

John
Just go to the Releases section of the GitHub project and download it from there.

I expect I was waiting on testing feedback and no one ever got back to me on it. Let me know if you have any issues.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
Dual
Posts: 267
Joined: Tue Feb 05, 2019 6:01 pm

Re: Pushover Plugin - push notifications

Post by Dual »

I downloaded and installed the 1.5.4 version.

My notification ran at the top of the hour error free.

Thanks @FlyingDiver for the fix and the help on how to get it from GitHub.

Cheers

John
Locked

Return to “Archives”