Linking Hubitat to tasker/android?

I have searched the forum but cant find a guide. Is there a way to create shortcuts on an android device with Autoit, Tasker, or macrodroid so I can make buttons that run automations? Some sort of way to tie into API?

There aren't any guides because Tasker is a fairly complex app with plugins etc so how you tie the 2 together would depend on what you are trying to accomplish.

That being said, I think the most basic way to do this is with the Hubitat Maker Api app. The Maker Api would allow you to control or change the state of a HE device via http calls. So essentially you will create a task that performs the http call you configure in HE.

For example, you can

  • Create a Virtual switch in HE
  • Then expose that switch to the Maker Api app
  • The app will give you the Http url you need to turn on and off the switch.
  • Next you setup a task in Tasker that executes the Http GET for the url above.
  • Test the task to ensure it is fact changing the virtual device state (on/off)
  • Lastly use an app like RM to tie the virtual devices state to the automation you need.
4 Likes

@stephack, did you forget your write-up on using Join? It's fairly detailed and I think would give the @lyonrt the shortcut buttons without ever creating a device in HE. Just by using the join to get the action buttons in the quick-tiles would probably satisfy your needs.

1 Like

Lol, no I didn't forget but figured it would be a bit of overload. Started with what I considered the most straight forward Hubitat-Tasker implementation. Kinda depends on what he/she would like to accomplish. Sometimes simple is better...especially since Join costs money.

2 Likes

Only if you want the API access though right? If you're just looking to create shortcut buttons, that would be free, right?

Also, something you might want to consider is a program called HTTP shortcuts. Along with the MakerAPI I have it set up to do some pretty complex functions with just a few taps.

Unless I'm mistaken, Join has a free trial but you have to pay to continue using it. I never really looked at the fine print because I only wanted it for the API anyway, so there's a good chance I'm wrong on this.

sorry to hijack but this is great info, most of which I think I follow, but what would be the easiest way to get a switch state into Tasker?

My use case is it I would like my garage door to close if I have forgotten to close it when I drive out of a geofence. I'm using a basic open closed sensor on my garage door which works well to tell me it status and a simple dry connect switch wired into my garage door opener

The challenge is there's only one HTTP get command to trigger the door to move and it's the same for both open and close

So ideally I would like Tasker to sense the status of the door and only fire the HTTP get command if the door is in fact open

Any thoughts?

Any thoughts?

Possibly an inefficient one. Why not get tasker to fire a webcore Piston, which (easily) senses the status?

I haven't used Tasker of HE for quite some time and I'm sure others can chime in with a current solution.

That being said...once you have configured Tasker to send the http call to activate a virtual switch in HE, then all the other checks can be handled within HE itself. So if you send the command to close the door, your RM automation will verify the current status of the door before actually sending the command to your opener. You could even configure it to send you a notification confirming whether the command was sent or not and why. Lots of options depending on how you want want accomplish the task.

1 Like

@paul11 - @stephack is on the money. The http endpoint you call in Tasker is just an RM trigger. As @stephack points out, the rest of the rule can do the checks needed. For example:

IF (Garage Door contact sensor is open) THEN
     Close Garage Door
END-IF

Which is what i said 2 hrs ago, but dont mind me :grin:

1 Like

First thoughts, not sure I would use any app to automatically close the garage door if I could not see it. While opening with automation could cause an unattended accidental opening and create a potential security issue. The accidental closing could be a safety concern if you do not know the doorway is unobstructed and no one is standing in it. I use an automation to tell me when my presence is no longer detected and the garage is still open. Then I pull up the camera view and manually trigger the closure.

That said, if you are intent on closing automatically, you could run the automation completely in HE using rule machine. If you want to use Tasker specifically, I would set up a virtual switch and have Tasker toggle that virtual switch based on geofencing location. (In location "home" = on, and out of location = "off".) Using that virtual switch as a trigger, then have RM check the status of the door and close it if it is open. You could also do this entirely with an HE presence sensor and leave Tasker out of the loop (This would not require internet connectivity where Tasker does).

The only reason to use Tasker (other than the novelty of playing with it) is to automate tasks that can only be done on a phone. The opening and closing of a garage is not something that you exclusively need your phone to automate.

Some examples:

-I use the Tasker Geofence to toggle my wifi and vpn on/off on my phone based on several locations (Home/work/certain other locations where I know I have Wifi available and already set up).
-I use Tasker to read notifications through my car when connected to Android Auto that AA has blocked while in car mode (One of which is the HE notification that I have left the house and the garage is open)
-I use Tasker to launch my music app when it detects my headphones and bicycle GPS connected by bluetooth. (Note: I use bone conduction headphones, so I am not riding without being able to hear my surroundings - before anyone gets bent outta shape on that)
-I use Tasker to trigger a good morning routine when I dismiss my alarm on my phone. Since I have a varied schedule, I do not get up on a regular schedule. So, I only need to have my alarm set and don't have to update routines in HE constantly. This is the only application where I need Tasker to talk to HE as there is no way for HE to know that I turned off my alarm on my phone app otherwise.

I'm curious about this one, could you expand on what you are doing? When you say read notifications, do you mean Tasker speaks them or do they show on your AA screen?

Tasker says them through my connected head unit. I have several apps where tasker just says "Notification from ". But with HE, I have it say " reports "

These are based on the pull down notifications. So, it is not reading the entire text of an e-mail or anything. So, I get notified when there is a notification from NEST, Outlook, Google Voice (Which I should turn off because AA sees them again), and a few other apps. With HE, I wanna know what the message says because sometimes that is important (Like the garage door was left open, or motion was detected inside while I was away)

Profile is Event-> UI Event -> Notification

Profile

Task has several steps for preventing erroneous messages I do not want and stopping the routine if I am not connected to a car (UI Mode Car).

Task

For the say step, you have to use variables for AppName and the text for the ones I want to have it read the notification text. You do not want a lot of the latter as it could get VERY busy. So, right now, it is just HE.

Thank you for the detailed response. So it actually speaks the notification.
I solved it another way, you might find it useful.
I configured Hubitat to notify me of certain events using the Telegram integration.
Telegram messages appear on AA with the text in full. That way you don't even need to use Tasker.

Thanks folks lots of great thoughts here.

I should first clarify I'm doing this on an android car deck (not a phone) with an 9 inch screen.

As mentioned a few options here, I will re-think the approach as it looks like it could be done a little differently than my first thoughts. A RM triggered geofence is a simple approach. But ideally I would like to stay with the way it works now which is that it provides the tasker on screen pop-up notification. Perhaps there is a different way to do that. As it is now the notification pops up stating the garage door will be closing and with 1 touch it can be interrupted. But sometimes I miss this and end up opening an already closed door.

But as suggested I could come at it more for a HE automation approach. I do like having the onscreen notification however.

@tray_e no safety concerns here as it is modern garage door with both type of sensors. Also no big security issues as we leave our doors unlocked at night here. But in the current implementation a video feed of the garage also comes up on the screen while the door is closing (mostly just to visually confirm that it has worked).

I will do some playing with it and let you know what direction I end up going.

Thanks again for all the feedback and great ideas.

For those of you who like me are migrating from Smartthings to HE. I have some devices like my arlo cameras that can't connect to HE directly so I can't ditch ST completely. I also use Sharptools on Android. So to keep tasker and be able to use the sharptools widgets working with HE I'm doing this:
Move your device (in my case this will apply to mostly switches) from ST to HE
Remove the device from ST
Create a virtual device in ST to represent the device in HE
Then in Sharptools.io in the rules engine create two rules, one for on and off
The basic rule is for 'on' is:
Trigger: if the switch in either system turns on.
Flow: If the ST switch is off then turn it on
If the HE switch is off then turn it on
Then create the second rule for off, with the on's and off's inverted.
The reason for the If statement is the prevent endless retriggering. In some cases even though the switch is on already when you send another on command that retriggers the event.
For other device types like motion or presents, you have to get creative :wink: You will have to represent those devices as switches on the ST side so the Sharptools.io rule can set it. So the trigger will be your motion or presents but it will set a virtual switch on the ST side.