Skip to main content
  1. posts/

Getting Home Assistant to Nag Me with Due

·5 mins

I recently got a few reasonably priced smart door/window sensors (from Aqara, which I highly recommend) to help me do a few fun home automations around the house based on doors or windows opening or closing. I got two and put one on the garage door and one on the shed door. I had the rough idea of using these with Home Assistant and my Sonos Era 300 speaker to rig up a basic home security system, alerting me say if someone opened the garage door or shed at certain times. After (of course) accidentally triggering it by mistake one night, and scaring my family with a very loud siren blaring in the kitchen, I realized that the home alarm system might take a bit of work to get right…

In the meantime, I figured I could at least make a few automations to remind myself if I’ve left the garage or shed door open. Setting up the automations in Home Assistant is really straightforward: I just create a trigger that fires every day at 9:30, checks if the door is open, and fires me an alert (through the Home Assistant iPhone app) if it’s open, reminding me to close it.

Simple enough—except iOS notifications are one-time only. I might see it, get distracted, and forget. Next thing you know, raccoons are making a home in my shed.

Enter Due #

I’ve used the Due app, for macOs and iOS, for many years to remind me of important things I don’t want to forget. The secret to due is that it will keep notifying you until you say it’s done. The default is every 5 minutes, but you can configure this per task. You can also choose to “snooze” a task by 1 hour, 1, day, etc, if you know you just can’t get to it right now but don’t want to forget later. It really felt like the perfect app for the job. One problem: getting Home Assistant to talk to Due.

Paging Rube Goldberg #

Due is a very good iOS / macOS citizen, so it plays very nicely with the Shortcuts app, letting you do pretty much anything you can do in the app through Shortcuts. Shortcuts seemed to be the easiest route creating a Due action. But I still needed to figure out how to get Home Assistant to call the Shortcut. There’s really no reliable way to remotely trigger an iOS shortcut. But… you can trigger a Mac short remotely. And Due happens to also have a Mac app that syncs over iCloud to the iOS app very reliably. And… I just happen to have an always on Mac mini!

macOS actually lets you trigger its shortcuts over the command line, even from SSH. So my initial thought was to get Home Assistant to send a terminal command over SSH to the Mac mini telling it to run a Shortcut to create a Due reminder. The shortcut itself would accept an input value, which I would use to create the text of the Due reminder. So I could have one automation that says “Close the shed door” and another that says “Close the garage door” without having to create new shortcuts / shortcut calls each time.

I tested out the Shortcut which worked reliably, and I could even trigger it from my MacBook Air (the Mac mini has the public SSH keys for both my MacBook Air and the Raspberry Pi 5 that runs my Home Assistant instance.) The problem was, I could not get Home Assistant to successfully send the SSH command. After a bit of digging, I realized that the way I was running Home Assistant (as a container) didn’t really let me run SSH commands without a bit of tinkering.

So I was kind of back to square one for calling the Shortcut. But then I remembered that Home Assistant could call preconfigured web-hooks which could be used in automations. And I just happened to have something on my Mac mini that could accept web hooks - Keyboard Maestro!

Keyboard Maestro is sort of like a Swiss Army knife of Mac automation. I won’t get into the full details of what it can do, but basically anything you want to automate on your Mac, in any way it can do—including running Shortcuts!

So… then it was a matter of configuring that webhook as a Home Assistant service in my configuration.yaml file that looks like this:

rest_command:
  km_make_due:
    url: "http://<keyboardMaestroUsername>:<keyboardMasetroPassword>@<macHostname>.local:4490/action.html?macro=<keyboardMaestroMacoUUID>&value={{ input | urlencode }}"

From there that would be available as an action in Home Assistant automations. The {{ input | urlencode }} part meant that I could send a value (“Close Shed Door”; “Close Garage Door”; etc) which would get passed to Keyboard Maestro, which would pass it to Shortcuts, which would pass it to Due… which would notify me until it was done!

After configuring the automation, a quick test confirmed it worked! I saw a Due reminder on my phone about 10 seconds after it was fired (I mean, that’s not too bad considering the amount of hops that are happening.)

Wrap-Up #

So to sum up, every night at 9:30, two automations fire that check if my shed door or garage door are open and if so go through a very convoluted workflow that will force my phone to nag me until I confirm it’s done.

Was any of this necessary? Absolutely not. Am I channeling Big Casey Liss energy? Absolutely. But like most things Home Assistant, it was fun as hell to set up. And I can sleep comfortably knowing racoons aren’t partying in my shed all night.