Pushover Notifications Driver [Slightly Enhanced]

Thanks for the clarification.
I 'assume' that the [E] had to to after the [HTML] as that is what triggered the interpretation of the Pushover embedded codes.
I'll check the other setttings, didn't realize I would create an avalanche of messages; thought it just made the message push on through the phone DND stuff.

You can use the [H] command and do the same as long as you set the appropriate settings in the pushover phone app, without the repeat notifications.

Feel free to modify the latest and greatest version and send it to me in a private message. I'll happily update the GitHub Repo.

Note: It does feel like trying to implement the entire Pushover API in this embedded ASCII encoded format is getting a bit unruly. Not sure if there really is a better solution, though, as Hubitat's standard Notification capability is pretty simple.

3 Likes

Agreed. I like being able to set message priority. Most things beyond that are of passing fancy.

3 Likes

I'm not good enough to do #1. I don't understand how Pushover wants that parameter.

I'll attempt #2.

I agree. I also have another idea, which I think is within my capabilities. Let me tinker over the next week or so, and I'll get back.

1 Like

@ogiewon Nevermind. I figured it out. I've currently implemented it in my testing as [selfdestruct=x] where x is in seconds. Cue Mission Impossible. Messages disappear as if by magic!

1 Like

All right, here's what I've done this week.

  1. added message auto-delete (time to live)
  2. added custom, user-definable open/close tags for HTML
  3. added a standard, scalable method for options in addition to the use of special symbols (backwards compatible with current release)
  4. Added comments and more debugging lines
  5. rearranged code to accommodate changes above
  6. added a testing mode to see HTML tags as text
  7. added function to check monthly message limit, remaining messages, and limit reset date.
  8. process certain options only when applicable, e.g. emergency retry and emergency expire only apply to messages with emergency priority

Couple things I need others to do:

  1. work on the custom html open/close character sanitizing, i.e. define additional characters that cannot be used as a custom open/close character.
  2. After months of trying, I still have not figured out how to update a preference from a variable. So, if #1 is sanitized or returned to default (Lines 127-134), how does that go back into displaying in the Preferences pane?
  3. Convert the Post into an asynchronous Post. I've noticed my devices and hub slows considerably when internet is lost or inconsistent. Research last week indicates the wait for a response with regular Post halts everything else on the hub.

Pushover Enhanced Test

I've renamed the driver so you can beta test without affecting all of your devices.

And finally, @ogiewon I've found that groups don't pass the key validity check in line 67. There is something different about a group/app vs. a user account with devices. A group/app is treated as just another device in the account, sort of. This impacts the display of the preferences and ability to set option defaults. For me, that's not a problem because I specify all of my custom options in the message text. However, I think others like @kahn-hubitat might want to set defaults for group devices. Maybe determine if the key is for an account vs group/app and then display appropriately?

My next project is to simplify the instructions in the original post to make it easier to see and understand all of the messaging options.

1 Like

Wha? I don't even use Pushover. I should, but I just don't feel like setting it up.

Sorry. Got my wires crossed when tagging. Fixed it. While you're here, its quite simple to set up, so this mis-tagging might have been the stars telling you that you should. :wink:

1 Like

lol. You should be using it. It is awesome.

I guess I should mention how to use this!

Priority still works the same [E] , [H] , [N] , [L] , [S] -- Must be at the beginning
[HTML] -- flags the message as an HTML message
[TITLE=messagetitle] -- message title (equivalent to ^messagetitle^)
[SOUND=soundname] -- custom notification sound (equivalent to #soundname#)
[DEVICE=devicename] -- send to specific named Pushover device (equivalent to *devicename*)
[URL=http://google.com] -- clickable URL (equivalent to §http://google.com§)
[URLTITLE=Google] -- short display name for the URL (equivalent to ¤Google¤)
[IMAGE=imageurl] -- url and path to replacement notification icon (equivalent to ¨imageurl¨)
[EM.RETRY=x] -- for emergency priority, how often does it get "sent" in x seconds (equivalent to ©retryinterval©)
[EM.EXPIRE=y] -- for emergency priority, when should repeating stop in y seconds, even if not acknowledged (equivalent to ™expirelength™)
[SELFDESTRUCT=z] -- auto delete message in z seconds (no equivalent)
\n -- line breaks in HTML messages. can also use ≤br≥ using the custom HTML characters feature below.

Set the custom HTML open and close characters to use additional HTML formatting. The default character is ≤ and ≥ (equivalent to [OPEN] and [CLOSE])

  • ≤b≥ and ≤/b≥ -- for bold
  • ≤i≥ and ≤/i≥ -- for italics
  • ≤u≥ and ≤/u≥ -- for underline
  • ≤font color="FF0000"≥ and ≤/font≥ -- for red colored text

There is a preference called Testing. Turning this on does all of the formatting above, but does not send the message as HTML. Useful for troubleshooting, testing, or code examples.

There is a command to get messaging limits and when the limit resets. Can be used in a Rule. The results are stored in attributes and are also accessible in Rules.

Please give feedback. Next week, I'll make a request to incorporate acceptable changes into the next release.

2 Likes

Can you provide me an example of how to use the sound code?
I've been having an issue with a specific message and trying to figure out how to re-code based on this re-written driver.

[HTML]:sweat_drops: Pool Pump started on [OPEN]b[CLOSE][OPEN]font color="#0fe8f4"[CLOSE]LOW[OPEN]/font[CLOSE][OPEN]/b[CLOSE] for 1 hour on final run today, at %time%. #Splash#

Somewhere in the code is a bug where it only sends me ":sweat_drops: Pool Pump started on" and cut's off the entire rest of the message and removes the custom attached sound "Splash".

Does this make sense?

[HTML]:sweat_drops: Pool Pump started on ≤b≥≤font color="#0fe8f4"≥LOW≤/font≥≤/b≥ for 1 hour on final run today, at %time%. [SOUND=Splash]

Here's an example that works to send the "bike" sound the old way ... haven't tried it the other way.

[E]©300©™3600™^Pond Alert:^%device% was %value% at %time% on %date%. #Bike#

My code above with the original style of html markup, the splash custom sound works.

[HTML]:sweat_drops: Pool Pump started on [OPEN]b[CLOSE]LOW[OPEN]/b[CLOSE] for 1 hour on final run today, at %time%. #Splash#

even the new code without the font html code works and sound still comes through.

[SOUND=Splash][HTML]:sweat_drops: Pool Pump started on ≤b≥ LOW ≤/b≥ for 1 hour on final run today, at %time%.

However, something in the font color code breaks the entire message and only sends me half of my message and no sound attached. If I remove the font color html code, it works again.

EDIT: After multiple attempts, I decided to push the sound code to the front and put the ≤b≥≤/b≥ code within the font color code, and it resolved my issue. Using the modified driver definitely seems cleaner for HTML tagged messages. The new way of using the sound code is a bit lengthier than previously and will take getting used to.

[SOUND=Splash][HTML]:sweat_drops: Pool Pump started on ≤font color="#0fe8f4"≥≤b≥ LOW ≤/b≥≤/font≥ for 1 hour on final run today, at %time%.

1 Like

I pushed a tiny little update to log what's going on with the sound. I've never been able to use sound and get the pushover app to actually play it, so that was probably the least tested. I tried to ensure that old and new tags can be mixed, so use whatever floats your boat! :grin:

Most likely, order of processing for color will have to be adjusted. It's likely that one of the lines looking for tags is a little too greedy. Regardless, I remember having initial trouble with color, but when it finally worked, I tested a number of variations but couldn't break it.

Post examples of messages (old or new or mixed tags) that should work but don't, and I will try to fix it. You can also PM me the examples.

@ogiewon had messaged me quite a while back saying he was busy and wasn't able to look over my work or test out my changes at the time.

I figured out the issue here. The color has a # which is also used to tag a sound using the original tag. When there is no sound, color may work. However, if there is also sound at the end old or new tagging, the message gets cut off. I'll try to fix it.

Pushed a fix just minutes ago for when there is a font color and a sound. This should work now. The sound tag can be anywhere, isn't required to be at the beginning as a workaround anymore.

Pushover Enhanced Test 2025-06-11-2

1 Like