Interactive Notifications to directly control devices or execute rules

Wanted to share something cool I did, well I think it's cool at least...hopefully someone will find it useful.

What it does:

Creates an 'actionable' notification that can be used to send a device command and/or execute a rule via Maker API or a local/cloud endpoint trigger, respectively.

This way when I get a warning, I don't have to open the hubitat app up, find the right dashboard, find the device, send the command, etc., etc.

I use the same method (having tasker intercept a notification from HE) for a few different things, but the easiest to explain is the warning I have set up for my front door lock. I used to have it lock automatically after a set amount of time, but that gets annoying because sometimes I don't want it to lock. When I took the autolock off, I found people (including myself) were forgetting to lock the front door. Now I have a notification sent if the door has been unlocked for 10 minutes, and a button to lock the door directly from that notification. If I don't want the door to lock, I can ignore or dismiss the notification.

What you need:

  • Android device with Tasker + Autonotification
  • A way to send notifications from HE (I use Pushover)

Keep in mind there are many different ways to skin a cat. This is the method I use, but I'm sure the same thing could be accomplished in different ways. I stuck with what I am used to.

  1. Create a link to the device you want to control in Maker API and get the url of the command you are going to want to send directly from the notification.

If you want to execute a rule instead of control a device, create a rule (eg. rule locks the door) and make the rule trigger a local or cloud endpoint, and get the url.

In the case of devices that are critical to your home security, I would recommend executing this through a local or cloud endpoint that executes a rule. That way if for whatever reason someone gets ahold of your phone and finds their way into Tasker, they won't be able to compromise security by changing the 'lock' command in a Maker API http request to 'unlock'. I'm no expert, but it seemed more secure that way to me.

  1. Create a notification in HE. I use the Notification app and send to Pushover. Make the notification say something that is distinct. I like to add "Notifying Tasker" at the end of these (to be used later for more generalized notificaiton interception). You could use tags or something as well. It just needs something that won't be sent for other reasons. For my example I have HE send a notification to Pushover if the front door has been unlocked for 10 minutes that says "Front Door Lock unlocked for 10 minutes. Notifying Tasker"

  2. Create tasker profile to intercept the HE notification. Make the trigger Event > Plugin > Autonotification > Intercept. Select the app (in my case, Pushover) and fill in the "Text Filter" to the message you had HE create, select Exact to make sure it doesn't pick up any other notifications.

  3. Create an action to send a notification from Tasker/Autonotification. Do Plugin > Autonotification > Autonotification. Give the notification a title and text. If you haven't played around with Autonotification, you can customize a ton of things in the notification, icon, color, actions, buttons, etc.

  4. Go to the buttons menu (while still in the configuration screen from the above step) and configure button 1. Make the button's action something aribtrary (this is a command that will be used later to perform an action). I use lockfrontdoor as the action for this. Make the button label the text you want. I use "Lock" for this.

  5. Create another tasker profile called the action you want the button to perform. Mine is called "Lock front door". Make the trigger Event > Autonotification > Autonotification. Put the action name created above (lockfrontdoor) as the command filter. In the actions for this task, add Net > HTTP Request. Put the Maker API or Local/Cloud Endpoint URL in the URL field. Method should be 'get'.

You are done, and now you can control a device directly from a notification on your android device! There are other fun things you can do like cancel the notification once the door is locked. Play around with autonotification. There are a lot of possibilities.

I also use autonotification to intercept and clear ALL of my Pushover messages to they don't clutter my notifications. I use the Pushover widget as a kind of 'log' to see HE notifications.

6 Likes

Nice work, here's another Tasker integration for me to add to my list, can't wait to try it out.

One to bookmark. Excellent idea!

I'm trying to do a very similar thing, with a RPI.
As soon as I get an email from my Amcrest camera, I'm trying to turn on a virtual motion sensor.
I haven't got it to work yet, but it's coming along.
(It's been done before, search ipcamemapi)

I just wanted to share that I did this with Tasker and AutoNotification. Nothing else needed.

  • Send HE push notification, formatted specially for intercept. (like "garage door door left open!\close?\ENDPOINT")
  • AutoNotification intercepts/cancels the real HE alert, displays it's own similar, (as shown in OP)
  • Once you click a button (can have several,) it dismisses the recreated notification.
  • Can easily add feedback on completed actions.
  • No need to add custom buttons, actions, or anything on the Tasker side. Just slip the data into the alert text.

3 Likes

I don't always check back so often, so wanted to give you the barebones of the Tasker setup.

When I dismiss the real HE notification, I steal it's notification ID and set the replacement with the same. That's how I can easily dismiss it later when I push an action button.

The wait command is in the wrong spot, and was simply intended to make the alert and actions easily distinguishable audibly.