(This article is also available via the short link tomrei.ch/pushover)
A few weeks ago I wrote about using IFTTT as a notification service for HomeSeer . I also lamented my concerns with the Android version of the IFTTT app as it seemed that notifications had not been implemented correctly, causing some notifications to go undelivered. Fast forward to now and, while the app seems to deliver notifications correctly about 90% of the time, I'm looking for something closer to 100%. Fortunately for some, I can report that IFTTT does seem to work 100% of the time on iOS, as far as I can tell. But I'm an Android guy, so let's examine Pushover as an alternative.
Getting things set up is pretty self explanatory. Start by downloading the app and creating an account. Once loaded, the app will display your user key. Next head over to Pushover.net and log in. Follow the instructions to register an "Application". Call it whatever you like, the important thing is the API token that gets generated on creation; you'll need this later. For now, though, the user key and API Token will be all you need to send push messages. Note that there's some more advanced configuration that can be done here -- user groups, etc -- but we'll stick to the basics for now.
Unlike IFTTT, Pushover unfortunately requires a POSTed message rather than a simple HTTP GET. While I believe that HomeSeer's scripting language does support POST, it appears to URL-encode the POSTed data. This complicates things as it causes Pushover's API to return 400 errors. Admittedly, I didn't mess around with this much before reaching to my swiss-army-knife alternative: PowerShell.
Calling PowerShell from HomeSeer is simple, at least in the Windows environment. Windows has a bult-in version (powershell.exe, the one I'll be using) but you can also download an updated version, pwsh.exe, which is also cross-platform. Aside from the executable location, the command should be the same regardless of which version you choose.
In HomeSeer, start by adding a "THEN" action, then select "Run another Program or Process". In the Application Path, assuming you want to use the built-in version of PowerShell enter:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Note that you'd replace this with the path to pwsh if you're using a newer version of PowerShell, or if you're running in the Linux environment. Next, in the Parameters section, enter:
-Command "Invoke-WebRequest -Uri https://api.pushover.net/1/messages.json -Method POST -Body (@{'token'='enter app token here';'user'='enter user token here';'message'='Test message to push'} | ConvertTo-Json) -ContentType 'application/json'"
...making sure to enter the API token and User Token in the proper spots. Notice how here you're actually creating a PowerShell object and then converting it to JSON rather than just entering JSON directly. I find this solution to be safer and less prone to errors, and if you're attempting to debug via the PowerShell command line, it'll give you feedback if you enter something incorrectly.
When it's all said and done, it should look like this:
Pushover provides a more Android-friendly alternative to IFTTT for Push Notifications from HomeSeer, in addition to some other advantages. The full-featured API provides a lot more customization options as well, allowing you to restrict certain messages to a group of users, set message priorities, change sounds and icons, etc. These advantages may also entice iOS users as well. Should I find any additional quirks with the app, I will be sure to make further updates.