[TUTORIAL] Using Tasker / KLWP together with Homey

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.

1 Like