1

I've been looking through the various npms that mention MyQ and HomeKit to try and find a way to trigger flows when my garage door opens or closes, but everything I've found seems to just support querying for status and sending open/close commands. I'd rather not have to poll my garage door every 30 seconds to be able to trigger flows to run upon open/close events.

I have homebridge installed. I can thus control my garage door with Siri. There are 3 things that (can) happen when my garage door opens or closes:

  1. I get an email from chamberlain
  2. I get a push notification from chamberlain
  3. I get a push notification from HomeKit

Since I added the garage door to homebridge, I had the thought that there might be a homekit node I could add that could receive the event notifications from homebridge.

Aside: I kind of also thought that by adding a homekit node that is configured to talk to homebridge, that I might be able to automatically create nodes that can send commands to homebridge so that I can control all the devices configured in homebridge. That would be a bonus. However, I tried out one of the homekit nodes and I'm not sure that they have the functionality I imagine they would.

So, is there a homekit or myq node that can receive open/close events that I can use to trigger flows?

A work-around to demonstrate what I'm looking for... I was thinking that I could rig a hacky solution for this using the email notification. I already have a mail rule (in Apple's Mail.app) to send an email to IFTTT when I receive an email from chamberlain. I could setup a webhook post to webhookrelay in order to trigger a flow in nodered, but I don't like having to rely on Apple Mail running on an always on computer...

2 Answers 2

1

I'm not familiar with homebridge but a quick search indicates there is an MQTT add-in which together with Mosquitto on the Pi should enable you to accomplish everything you require using node-red

7
  • How do you do that exactly? What part of your answer receives the notification from homebridge? I haven’t tried mqtt before. I had looked into mqtt in the past and it required the garage door to send some sort of mqtt message, which would require coding...? I’m looking for a Node that can receive an existing push that I can use as a trigger. Can an mqtt node receive a push from homebridge? And what does mosquito do?
    – hepcat72
    Commented Apr 28, 2019 at 17:16
  • According to Stoinov's answer here: stackanswers.net/questions/… it seems that communication between node-red and homekit/bridge is only one-way. I'm guessing that homebridge doesn't receive notifications that the garage door is opening or closing... although I'm skeptical. The home app is commanding the garage door to open via homebridge... so homebridge at least gets the commands from the home app. But if I open the garage via the MyQ app, does the push that the Home app show me get sent to homebridge? I'm guessing not.
    – hepcat72
    Commented Apr 28, 2019 at 17:36
  • Is there any help here ? github.com/cflurin/homebridge-mqtt/wiki/garageport
    – Bra1n
    Commented Apr 28, 2019 at 18:06
  • It doesn’t look like it does what I need to do. All of the communication from homebridge is in the form of a response to communication to homebridge as far as I can tell. There is nothing in the form of “listen” for events so that I can act on them as triggers. An example of what I’m after is webhookrelay. I can POST Webhooks to a public endpoint from IFTTT which is relayed with payload to my instance of nodered, evaluate the payload, and take the appropriate action. I just set up the Apple Mail workaround I mentioned where I listen for garage door open events from webhookrelay & act on them.
    – hepcat72
    Commented Apr 28, 2019 at 21:09
  • So my garage door emails me, Apple Mail catches the email with a rule to match the sender and subject, and sends an email with the hashtag “garage_opened” to IFTTT. I have an IFTTT applet with the email trigger that watches for the hashtag and when it gets that email, it POSTs to webhookrelay with JSON describing the event (I.e. garage door opened). In my flow, I have a webhookrelay node that sees the JSON about the garage door opening and switches on it to do whatever I want, like if on a weekday evening, turn on the AC, or if in the morning, set my slack status to “waiting on the bus”.
    – hepcat72
    Commented Apr 28, 2019 at 21:15
1

Given the existing actionable signals (email and push notification), the only ways to trigger node-red flows that I've discovered are the following (which trigger an IFTTT webhook POST to nodered via webhookrelay):

  • IFTTT Office 365 Mail (using the "new email from" trigger). You must include the subject in the JSON POST in order for Node Red to decide what to do with it.^
  • Apple Mail Rule that runs an AppleScript to send an email (with a specific subject) to [email protected] when new mail meets rule criteria. Again, you must include the subject in the JSON POST in order for Node Red to decide what to do with it.
  • Code-up a bluetooth app that can act on push notifications^^
  • Use a physical sensor that is capable of detecting the garage state and of triggering NodeRed via something like MQTT or webhook POST

The IFTTT Gmail service used to be the perfect solution, but IFTTT's Gmail service no longer fully meets Google's API security standard, and the ability to trigger via received email that matches search criteria is going or has gone away (which was the event that prompted this stack question in the first place).

The downside of the Apple Mail Rule solution is that it must be on a computer that is always running. Apple's iCloud Email web app does not have the ability to run the applescript necessary for propagating the triggering event.

(Note, it's likely also possible to simply issue the webhook post to webhookrelay directly from the AppleScript, but you wouldn't be able to as easily enable/disable the automation from anywhere.)

I have opted for the Apple Mail solution, and it works well, though be away that the subject ingredient removes hashtags automatically in the trigger that receives any mail sent to [email protected].

I look forward to a future app that can use push notifications as triggers for actions. (Android actually has this capability, from what I saw during my search.) And honestly, I'm surprised that there's not a "notification to webhook" app out there that can convert any notification into an action.

^The IFTTT Office 365 Mail solution cannot be configured specifically for subjects containing a search term, but there may possibly be an IFTTT ingredient that allows you to include the email subject in some JSON of a webhook POST.

^^ It turns out that iOS push notifications are encrypted and the only codified way of being able to know what notifications are what is to write code for a bluetooth device. Apple supports display of encrypted notifications on Bluetooth devices so that things like AppleWatch can display the notification. All other ways of intercepting push notifications are locked down for security reasons. (See https://www.quora.com/Is-there-a-way-for-an-app-to-detect-any-incoming-push-notifications-on-iOS)

4
  • Just found this, which may be interesting to check out: stackoverflow.com/questions/7954905/…
    – hepcat72
    Commented Apr 29, 2019 at 23:08
  • So I discovered that my Apple mail rule fails at running the AppleScript when the screen is locked (even though the computer is logged in and not sleeping). It marks the message as read and moves it to the trash, but either the AppleScript doesn’t run or it fails even though manually testing it succeeds. I will update my answer once I’ve figured out what’s going on and how to fix it.
    – hepcat72
    Commented Apr 30, 2019 at 13:43
  • Disregard my previous comment. Looks like it works. I had to allow the Apple Mail app to be able to run automations.
    – hepcat72
    Commented Apr 30, 2019 at 16:02
  • I also tried adding a gmail app called "Email Studio" to forward emails matching search criteria to [email protected], but it didn't work in the test I tried. Not sure why.
    – hepcat72
    Commented Apr 30, 2019 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.