[TUTORIAL] Using Tasker / KLWP together with Homey

tutorial

#1

What are these tutorials for?

If you need to read this, then this tutorial is probably not for you. I’m going to assume you know your way around Tasker (Android Automation App) and / or KLWP (configurable live wallpaper) and you know how to create Profiles and Tasks within Tasker or how to edit your live wallpaper within KLWP. If so, with these tutorials you should get an idea on how to use Tasker in combination with the Homey API. Occassionaly I’ll be using some other tools as well, mostly from the AutoApps collection.

Index of Tasker Use Cases

The possibilities for using Tasker (and related automation apps for Android) are endless! If you use Tasker yourself, please share your use cases in this thread as it might help other people as well.


Widget app
#2

Replace the Homey presence detection with the more reliable Tasker presence detection

In this tutorial I’m going to set the presence of a user based on a Profile event within Tasker (for instance, being connected to you Home Wifi network). In the next post a tutorial on how to add Homescreen shortcuts to trigger flows will follow.

Prerequisites

  • A working Homey
  • An Android smartphone with Tasker installed
  • A Tasker plugin called RESTask installed which enables an extra plugin in Tasker
  • The external URL to your Homey (it looks something like this: https://ID.homey.athom.com/ and can be found by going to my.athom.com and login to your Homey from outside your own network)
  • Your bearer token (can be found by going to my.athom.com and inspect the URL linked to the Homey icon. The url contains a parameter called bearer_token which is the token you need to have)

Creating “At Home” Task

Add a new task in Tasker called something like “At Home”. Create a new action within the task and select the RESTask plugin (it’s under the plugins category). Click on the configuration button and use the following settings for configuring the RESTask action where you replace the tags with your own external URL and bearer token.

Settings Tab of new RESTask action

  • Request Type: PUT
  • Host: https:// ID .homey.athom.com/api/manager/presence
  • Enable Custom Body: Yes
  • Custom Body: {“present”: true}

Header Tab of new RESTask action

  • Add new header with name “Content-Type” and value “application/json” (without the quotes)
  • Add new header with name “Authorization” and value “Bearer <<token>>” (without the quotes and replace <<token>> with your token and leave a space between the word Bearer and your actual token)

Save and test the action, you should now be able to set the presence of the user with the bearer token you used as being at home.

Creating “Away” Task

Add a new task in Tasker called something like “Away”. Create a new action within the task and select the RESTask plugin (it’s under the plugins category). Click on the configuration button and use the following settings for configuring the RESTask action where you replace the tags with your own external URL and bearer token.

Settings Tab of new RESTask action

  • Request Type: PUT
  • Host: https:// ID .homey.athom.com/api/manager/presence
  • Enable Custom Body: Yes
  • Custom Body: {“present”: false}

Header Tab of new RESTask action

  • Add new header with name “Content-Type” and value “application/json” (without the quotes)
  • Add new header with name “Authorization” and value “Bearer <<token>>” (without the quotes and replace <<token>> with your token)

Save and test the action, you should now be able to set the presence of the user with the bearer token you used as being away.

With these Tasker Tasks you can create a profile in Tasker that will trigger these actions, for instance based on your smartphone being connected to your Home Wifi network. But better yet, this is just an example on how to use Tasker in combination with the Homey API. You can use the BetterLogic app with it’s API to create any kind of variable that you like which you can set with Tasker based on events on your smartphone and you can then create flows within Homey based on the change of this variable.


#3

Creating shortcut buttons for Homey through Tasker by Android

This tutorial will explain how to create shortcut buttons in Android using Tasker for Android. These buttons can be placed on your Homescreen and trigger any flow you want. In the future this functionality will probably be part of the Homey Android app but for now you can use this tutorial.

Prerequisites

  • A working Homey
  • An Android smartphone with Tasker installed
  • A Tasker plugin called RESTask installed which enables an extra plugin in Tasker
  • The external URL to your Homey (it looks something like this https://ID.homey.athom.com/ and can be found by going to my.athom.com and login to your Homey from outside your own network)
  • Your bearer token (can be found by going to my.athom.com and inspect the URL linked to the Homey icon. The url contains a parameter called bearer_token which is the token you need to have)
  • BetterLogic app installed and a variable created that you want to update

Create “Set variable x” task

Add a new task in Tasker called something like “Set variable x”. Create a new action within the task and select the RESTask plugin (it’s under the plugins category). Click on the configuration button and use the following settings for configuring the RESTask action where you replace the tags with your own external URL and bearer token.

Settings Tab of new RESTask action

Header Tab of new RESTask action (needed from BetterLogic v0.9.0 and higher)

  • Add new header with name “Authorization” and value “Bearer <<token>>” (without the quotes and replace <<token>> with your token and leave a space between the word Bearer and your actual token)

Create a shortcut on a Homescreen which sets the variable

Go to one of your Homescreens and start the “Add a shortcut” wizard (most likely by long pressing on your Homescreen and selecting the right option). In the list for adding a shortcut select Task Shortcut with the Tasker logo. In the next list select the task you have just created. Note: you might have to add a task icon to the task before being able to set it as a shortcut by selecting the icon at the bottom right and setting an icon.

Once done you now have a button on your Homescreen which will set the BetterLogic variable to it’s desired value. Based on the change of this variable to a specific value you can trigger any flow within Homey!


#4

Send commands from Homey to Tasker

Previous tutorials where about sending information from your Android phone to Homey. This tutorial describes how you can send information from Homey to Tasker (the other way around). You can use this to do stuff on your phone based on triggers on Homey.

Prerequisites

  • A working Homey
  • The HTTP app installed on Homey
  • An Android smartphone with Tasker installed
  • An app called AutoRemote (paid app which is a part of the incredibable AutoApps suite) installed which enables an extra plugin in Tasker

Install and setup AutoRemote

AutoRemote enables you to send message and notification to your smartphone from external sources. Install it from the Play Store and have a look here to send your first test message to confirm the app has been set up correctly and your smartphone can receive the external message. After visiting your personal URL (which can be found on the homepage of the AutoRemote app) all you need to do is enter a message and click the send button. Check the log in the AutoRemote app to confirm your message has been received.

Create a Homey flow that triggers a message

If you have confirmed you can receive messages you can set up a flow in Homey. Make a test flow with some kind of voice trigger. Use the HTTP Get card of the HTTP app action card and paste in the URL which you can copy from your personal message page where you have send the test message. At the very end of that URL is the actual message you will be sending to the phone. Make it descriptive as this will be the trigger within Tasker to do stuff on your phone. Once you have saved the flow you can test it by testing/running the Homey flow and check the AutoRemote log if the messages are still received.

Configure Tasker

Once you have confirmed you can send message from Homey to your smartphone it’s time to setup Tasker. AutoRemote comes with a Tasker plugin. Create a new Tasker profile and select: Event > Plugin > AutoRemote > Autoremote as trigger for this Tasker profile. In the configuration for the trigger all you need to edit is the “Message Filter”. This is where you need to enter the exact message you are sending from Homey (which is at the end of the URL in the HTTP Get action card). You have now set the trigger in Tasker which listens to incoming messages from Homey and you can define your Tasker actions for this profile.

The possibilities for using AutoRemote to send information from Homey to your Android smartphone are endless. In a following tutorial I will show you how to create a dashboard on your phone homescreen using AutoRemote to send info to your smartphone and KLWP to show this on your home screen.


#5

Using wallmounted tablet as security camera with Tasker and IP Webcam

I recently installed a wallmounted tablet with Homeydash which allows me to control stuff. But I figured the tablet was useless while I’m not at home. Not anymore, I’m now using it as a security cam as well which automatically switches on when nobody is at home.

So the goal of this tutorial is to switch on a security webcam on an Android device when Homey detects nobody is at home and switch it off again when somebody gets home (and for instance switch back to Homeydash when somebody gets home)

Prerequisites

  • A working Homey with the following apps installed:
  • A way to detect the presence of household members (there are numerous topics about this but I’m gonna assume here you have found a way for Homey to detect presence and can trigger flows based on this).
  • An Android device (preferably already in use as wallmounted tablet) with the following apps installed:

Configure the apps on Android

I’m gonna assume you know how to setup Tasker. AutoRemote does not really need any further configuration after installation, but you could optionally set a password in the settings for extra security. You can ignore the google short URL, we are going to use the WiFi service which enables access to the tablet over your local network. How to configure IP Webcam is described here.

Setup Tasker

In it’s most basic form you will need threeTasker profiles, both with .

  • Profile 1 with trigger “event -> plugin -> AutoRemoteLite” with message filter “home” and under this profile an IP Webcam task to stop the server (and optionally start Homeydash, I use Fully Kiosk Browser for this, excellent app with motion detection to automatically turn the screen on)
  • Profile 2: with trigger “event -> plugin -> AutoRemoteLite” with message filter “away” and under this profile an IP Webcam task to start the server (and optionally first shut down anything else used when somebody is home like Homeydash)
  • As mentioned, we are going to use the WiFi service of Autoremote to be able to send messages to the tablet through the local network. This requires the WiFi sevice to be started after every reboot. So create a tasker profile with trigger “Device boot” and a AutoRemoteLite task to start the Wifi service. Remember to manually run it now so the WiFi service is started.

Configuring Homey

Only a couple of flows are needed to switch the Android device between the home state (with something like HomeyDash) and the away state with IP Webcam. Setup the following flows or something similar:

  • A flow which is triggered when presence of a household member is detected. In the action column add a HTTP app GET action card and fill in the following, where you replace IP with the IP of your Android device and optionally fill in the password when configure within AutoRemoteLite: http://<<IP_ANDROID>>:1817/?message=home<<&password=your_autoremote_password>>; . This action card will trigger the Tasker profile on the Android device to start the action to stop the IP Webcam security camera (and optionally start Homeydash).
  • A flow which is triggered when no presence of any household member is detected. In the action column add a HTTP app GET action card and fill in the following, where you replace IP with the IP of your Android device and optionally fill in the password when configure within AutoRemoteLite: http://<<IP_ANDROID>>:1817/?message=away<<&password=your_autoremote_password>>; . This action card will trigger the Tasker profile on the Android device to start the action to start the IP Webcam security camera (and optionally stop Homeydash).

Now you have Homey setup to start the IP Webcam security camera when nobody is at home. Of course you would like Homey to know when motion or maybe even sound is detected. For this to work you will need to add the IP Webcam security camera as device under Homey using the Android IP Webcam app for Homey. After adding this device (make sure the camera is active when adding it as device) you will have all sorts of trigger cards (like motion detected etc.) to setup several security related flows. And that’s it!


#6

@vaderag You wanted a guide for Homey, Tasker, AutoRemote and KLWP. Check the post below this. It contains a short video on what can be achieved.


#7

Create a home automation dashboard on your Android home screen using AutoRemote, Tasker and KLWP

This tutorial builds on previous tutorials like sending information from Homey to your smartphone using KLWP. At least read them before diving into this one. This tutorial is just a showcase of what’s possible with Homey, Tasker, AutoRemote and KLWP and not a tutorial on how to create a completely featured dashboard. I’ll leave that up to your own creativity. The tutorial will also not go into every detail on every tool used. There is a lot of information on how to use these tools on the internet. I’ll link to some information but do also use Google.

Here is a short video on what can be achieved with this tutorial. It’s a small dashboard that will show user presence, the surveillance mode and alarm state from the Heimdall app and the lock status of a Nuki lock, inside temperature, solar generation, energie usage and gas usage. I’ll only be focusing on Heimdall surveillance and energie generation for the sake of this tutorial.

Prerequisites

  • A working Homey
  • The HTTP app installed on Homey
  • An Android smartphone with Tasker installed
  • An app called AutoRemote (paid app which is a part of the incredibable AutoApps suite) installed which enables an extra plugin in Tasker
  • An app called KLWP installed which is free with ads or paid adfree and which also enables an extra plugin in Tasker)

Install and setup AutoRemote

AutoRemote enables you to send message and notification to your smartphone from external sources. Install it from the Play Store and have a look here to send your first test message to confirm the app has been set up correctly and your smartphone can receive the external message. After visiting your personal URL (which can be found on the homepage of the AutoRemote app) all you need to do is enter a message and click the send button. Check the log in the AutoRemote app to confirm your message has been received.

Install and setup KLWP

KLWP uses an awesome WYSIWYG editor to create live wallpapers with pretty much any information you like. If you are completely new to KLWP first start with watching the videos from the beginners series from this website. Keep watching the videos until you understand how KLWP works and you are capable of making changes to your own live wallpaper.

Push or pull strategy

When adding data to your live wallpaper from Homey you can choose for a push or pull strategy. Which is best depends on the data you want to show. Let me explain.

Push from Homey to your smartphone

If data does not change very often (like the presence of a user) it’s best to push changes from Homey to your smartphone when it happens. This way you receive a change immediately and limit the amount of traffic. You can achieve a push mechanisme by using actions cards with GET requests (HTTP app) on Homey which send messages to the AutoRemote server on your phone. You can then use Tasker on your phone to update variables in KLWP which in it’s turn show it on your home screen dashboard.

Pull from Homey to your smartphone

If data changes very often but you do not need to know every change but just want to update the value on a time based interval (like the daily generation or usage of energy) it’s best to use a pull strategy. Sending every change would be bad for performance and it’s best to just ask Homey the latest value on a time based interval. You need to create a flow in Homey with a GET trigger card (HTTP app) that returns the value from a tag or a Bettter Logic variable or something. KLWP can be configured to send the GET request to Homey and parse the result to show on your home screen dashboard.

Show Heimdall surveillance

This is about showing Heimdall surveillance but the concept can be used for any data that does not change very often and can be pushed to your smartphone from Homey.

  • Create a flow in Homey (or use an existing flow) that is triggered when Heimdall’s surveillance mode is changed. Add a HTTP GET action card and use it to send a request to your personalized AutoRemote service. You can create the correct URL on the personalized test page which you can access from the AutoRemote app on your phone. In the message to send you can add a parameter which you can filter out on your phone. My messages look like this: armed=:=surveillance heimdall and disarmed=:=surveillance heimdall. I use the word Heimdall to filter out the message and the word surveillance as parameter to set and use in Tasker and KLWP.
  • Create a profile in Tasker. Choose AutoRemote as trigger and set the filter to the word heimdall (or what other filter word you used in the message send to the AutoRemote service). Under the advance settings of the AutoRemote plugin in Tasker select the Comm Params Prefix and enter the variable you want to receive, in my cased called surveillance.
  • Create a new action for this profile and select the KLWP Send Variable plugin. In the ‘Tasker Text’ field enter the variable like this %surveillance() and in the Kustom variable field give it a name to use in KLPW. For the sake of this tutorial I’ll name it klwp_surveillance.
  • Add a text field in KLPW and edit it to show the status of the variable klwp_surveillance like this br(tasker, klwp_surveillance) . You can now test the setup by triggering the Homey flow which sends the request to AutoRemote. You should now see the value appear on your KLWP live wallpaper.
  • Now that you can receive status changes from the Heimdall surveillance mode you can do all sorts of stuff in KLWP. In the video with the example dashboard I’m using it to show an font icon based on the surveillance mode and also give this icon a color is surveillance mode is (partially) armed. Read up on the KLWP documentation to do stuff like this.

Show generated energy

This is about showing generated energy from my solar panels but the concept can be used for any data that changes very often but only needs to be updated on a time based interval and can be pulled by your smartphone from Homey. Although KLWP is capable of executing requests and parsing any returned data its not possible to use KLWP for this as we need to send an Authorization header with your Homey bearer token. KLWP is (currently not capable of sending request headers so we are going to use Tasker for this.

  • Either create a Better Logic variable to holds the data you want to retrieve and use the Better Logic API to request the value of the variable (see app store description from the Better Logic app) or create a flow that uses a HTTP GET trigger card with a HTTP GET action card that calls the AutoRemote service similar as in the push example. You can than use a global tag to send as parameter in the GET request to AutoRemote. The following steps are based on retrieving data from a Better Logic variable.
  • In Tasker create a profile with a time based condition, for instance every 5 minutes depending how often you want to update the data. Obviously the more often you retrieve data the more battery resources it will take. Then add an action for retrieving the content of a Better Logic variable similar as described in a previous tutorial. But now use a GET request and parse the returning data (the value of the Better Logic variable is in .result.value) and save it in a Tasker variable.
  • Add another action in the same profile to send the variable to KLWP similar as in the push example.

That’s it. You have now mastered all the skills to create your own live wallpaper showing a dashboard with all kinds of information from Homey.


Heimdall - Let Homey watch over your home
#8

Did someone make its own dashboard using Tasker? How well does it work?

I am thinking of building a dashboard, as I noticed that Homeyd.ash has not enough functionality (for me) and the development is currently frozen. Thus i am looking for alternatives…


#9

The tutorial right above your post explains the basics on how to do this.


#10

I know. I am looking for user experience, before I end up investing a large amount of effort in something that doesnt work, or demands much work to maintain.

I have Tasker & several plugins running in combination with homey. As I understand if I want to build my own dashboard, I have to build a flow for every single device (and maybe even every possible state change?) to send a push requests to Tasker/AutoRemote? (which means a large amount of effort…)


#11

Using the complete Web API would require a whole lot more effort on the Tasker side. Probably nearly impossible to code on mobile device. So creating a fully featured dashboard with these tools to replace something like HomeyDa.sh is not recommended.


#12

Thanks! That is all i wanted to know :slight_smile:


#13

Reading about the Tasker + KLWP possibilities, would it be possible to have a dynamic widget on my android phone that shows the number of people at home?


#14

Sure, there is also KLWP which uses the same WYSIWYG editor as KLWP but creates widgets instead of a live wallpaper. The approach is the same.


#15

That is great! I will investigate the KLWP App soon!

Not sure what you mean here…


#16

I meant to say, KWGT is the same as KLWP but creates widgets instead of live wallpapers.