Trying to send notification with Pushover


#1

I attempting to send a notification to my iPhone. I have created a Pushover userID and the application API Token. I also created a Virtual Device in Hubitat and used the Pushover Driver. In the device I put in my User Key and API Token.

My script is very simple. Define variables of Token (API Token/Key), User (User Key), Message, Sound (bike), Priority (0), and Title (Test Send Message).

In my script I have a time comparison to send the notification.

And the Notification command is written like this:

Make a POST request to https://api.pushover.net/1/messages.json with FORM encoded data (Token,User,Message,Sound,Priority,Title)

When it runs I get no notification.

From the job log I see this,

1/4/2023, 12:16:00 PM +68ms
+7ms â•”Received event [Home Sweet Home].time = 1672852560000 with a delay of 68ms, canQueue: true, calledMyself: false
+58ms â•‘RunTime initialize > 57 LockT > 1ms > r9T > 41ms > pistonT > 38ms (first state access 8 m:15 8 49)
+64ms â•‘Runtime (6649 bytes) initialized in 41ms (v0.3.114.20221228_HE)
+75ms â•‘â•”Execution stage started
+86ms â•‘â•‘Comparison (time) 44160000 happens_daily_at (time) 44160000 = true (0ms)
+87ms â•‘â•‘Time restriction check passed
+90ms â•‘â•‘Condition #2 evaluated true (8ms)
+97ms â•‘â•‘Requesting time schedule wake up at Thu, Jan 5 2023 @ 12:16:00 PM EST (in 86399836ms) for 2 (st:0)
+100ms â•‘â•‘Condition group #1 evaluated true (condition changed) (19ms)
+121ms â•‘â•‘Sending asynchttpPost web request to: api.pushover.net/1/1messages.json
+124ms â•‘â•‘Executed virtual command httpRequest (14ms)
+127ms â•‘â•‘Requesting wake up at Wed, Jan 4 2023 @ 12:16:24 PM EST (in 23998ms) for 3 (st:4)
+133ms â•‘â•šExecution stage complete. (57ms)
+208ms â•‘Setting up scheduled job for Wed, Jan 4 2023 @ 12:16:24 PM EST (in 23983ms),with 1 more job pending
+211ms â•šEvent processed successfully (205ms)

For the life of me I can’t figure out what I’m doing wrong. I would upload my simple script but every time I do a copy to clipboard it doesn’t copy to the clipboard.

I’ve read and reread post on how to do this and still can’t figure out what’s wrong.

Please help…


#3

I’m out sure what the problem is, but it would be worth logging the http status code returned, and also the contents of 1message.json, after the call to see if that gives any further details of what’s going on. Also have you tried the command from a browser to confirm all values are set correctly etc?


#4

How do you issue the command through a Browser?


#5

I’m not sure, however, there are examples using windows or unix command line options on the pushover web site. I’d probably check the $httpStatusCode, $response after the http call. Also, do you need to define a variable 1messages, to hold the json returned?


#6

I assume you’ve read https://docs2.hubitat.com/en/devices/pushover
I’ve not tried using it myself. My understanding would be that there is no need to make the http call, you can use your virtual pushover device directly to send the notifications to your phone.


#7

Yep, I’ve read that a couple of times. All steps were executed as stated in the doc.

I can use Powershell send a simple message to my phine but I still can’t get it to send the message in a webCoRE script.

Anyone, any ideas why?


#8

I have Pushover set as a Notifcation device in Webcore

Then just send device notification


#9

Well break through this morning. Many thanks to @Mebejedi for his sample.

One thing I didn’t have was my Virtual Notification device defined for use in webCoRE. The second thing I noticed is that the Post request did not have “with” statement before it.

Did both items and sure enough my notifications are coming to my iPhone.

image