An “Accessory is turned on” notification with Pushover

Apple Shortcuts application‘s logo
Apple Shortcuts application

A question came across on my Twitter feed today morning where a guy asked: “Is it possible to receive notification on the iPhone whenever an accessory is turned on? The device by the way is controllable over HomeKit.

Unfortunately, there are no out of the box solution neither in the HomeKit framework nor the Shortcuts, but I found a workaround to solve this.

The solution is leveraging a 3rd party solution called Pushover. This service provides easy to use API to send a real push notification to any supported platforms (including iOS). Pushover provides a free tier for home users (including 7500 notifications per month), no limitation in applications and even it can be used via email. The caveat is that you need to purchase (IAP – 5$) the application on the target platform after a 7 days long free trial. I really recommend it, very handy in many use cases.

I assume that you have already created an account at Pushover, you have downloaded the application, now ready to create the automation.

Create an application at Pushover

  1. On the site, down below the “Your Applications” section, create a new one by clicking “Create an Application/API Token” link.
  2. Provide a name (mandatory) and an icon if you want, then click “Create Application” button.
  3. Application created, now need to save your token displayed on the top of the page.

That’s it, now head to the phone.

Create a HomeKit automation with Home

  1. Open the Home app on your iPad or iPhone, and select “Automation” on the bottom.
  2. Create a new one.
  3. Select “An Accessory is Controlled” on the next page.
  4. Select the accessory you want to monitor. In my example, I’ll use my living room television.
  5. Set the conditions (turned on/off, any time, any people etc.)
  6. When you are on the scenes page in Home app, scroll down to the bottom and there you will see a “Convert to Shortcut” button. Click on it. A Shortcuts editor UI will open.
  7. Remove the default action, and add a new one: Web category – Get Contents of URL. Setup template is on my screenshot. Details (when you add fields to the body (token, user, title, message; all of them Text type):
    • URL: https://api.pushover.net/1/messages.json
    • Method: POST
    • Request body: JSON
      • token: the value of your application token generated in the previous step
      • user: your user token can be found on Pushover’s dashboard
      • title: whatever you want to see in the notification’s title section
      • message: the body of the notification
  8. Once you set it up, click Next and Done.

If you configured everything right, now it’s time to test. In my case, a I’ll receive a notification everytime the TV in the living room is turned on.