Create Android Widget (Button) to perform action on Hubitat

Note: There may be better ways to do this, but this was my newbie way of getting something working.

I searched and have not seen this so I thought I would post. There may be a better way to do this but this was logical for me. (Sorry if I missed some minor description. This was from memory once I had completed the button.) Andoid 10 on Pixel 3 fully updated as of 5/15/2020.

I am a refugee from Wink and my primary use of Wink was time-based rules and widget buttons to perform tasks on my phone. The Hubitat app does not offer these so I did some tinkering. The first thing I wanted to do was push a button on my phone and lock my front door.

Step 1:

Create a IFTTT.com account

Step 2:

Add the IFTTT App and select what devices should integrate with IFTTT

Step 3:

Search Hubitat in IFTTT.com and Connect the Hubitat. This will prompt for Hubitat login, devices to integrate etc.

Step 4:

Download the IFTTT App on Android and login.

Step 5:

Make your own applets from scratch and add a new applet. Click + by first this. Click on Button Widget then Button Press. Click + by That. Search for Hubitat. Click the tile and select action and device to change.

Step 6:

Long press on your home screen and press widget. Find IFTTT and select the widget you prefer. I chose the 1x1 widget. Press and drag to the home screen. Select the action you defined above.

You now have a button to perform an action similar to the way Wink would run a shortcut via button press. I have not worked on calling scenes or multi-device actions. There is a bit of a lag due to cloud aspect of this occuring.

1 Like

Wouldn't Tasker or something like AutomateIt be better (using a widget to drive an html get command into Maker API on Hubitat)? It would avoid having to go via the IFTTT 3rd party service which can often be quite slow.

Very Possibly. I am not familiar with tasker and have used IFTTT for some other basic server management tasks in the past. I may tinker with that as some point in the future. This was a quick and dirty way to make it work and it is no slower than the Wink used to respond, when it responded.

Mainly I wanted to get something out there in case others had a similar use case and were looking for a quick solution to needing widgets.

I added a note to say there may be better ways to accomplish this. I have had my hubitat for less than 24 hours so I am definately still learning.

No worries. If it works, it works!

First, Welcome to the Hubitat World.

If you ever get the urge, take a look at Tasker. It can do as @Angus_M described and probably quicker and more reliably than IFTTT. However, it is a paid app (i believe $4 currently) and there is a learning curve. However, doing what your describing with Tasker is probably not much more complicated than what you set up w/ IFTTT.

If you do get curious, please ask. I am by no means a Tasker expert but I do use it in unison with Hubitat for a few things.

Tasker can be used to create some pretty amazing integrations

Anyone know a way to do this without IFTTT, using Maker API all we need is a android app than can make a widget using a url

Tasker

Seems a bit over the top for a simple task, used to use tasker years ago but just got annoyed with it

Found what I was looking for https://play.google.com/store/apps/details?id=com.idlegandalf.httprequestwidget

2 Likes

Fair enough. I use tasker for lots of things so it makes sense for me. I used to have a pretty cool setup with widgets that updated based on state.

It's not ready yet but I should have widget support ready to try out in a few days. I'm going to start small - a 1x1 widget that represents a single Hubitat device. Clicking on it will toggle your device on/off. I'd like to be able to prompt the user in some cases - such as locking a door - in case of an accidental click.

Also, because of the way Widgets work the icon state won't be able to be fully in sync with the device (ie: the widget might show the light as 'on' even when it's actually off). So, I'll have to figure out how to represent this best.. but, I'm open to suggestions too

2 Likes