Home Assistant on WearOS via Tasker

The official Home Assistant Android app is getting support for WearOS. The feature is available for beta testing, but in the meantime you can achieve some control via Tasker.

The first thing you need to do is install the Home Assistant plugin for Tasker.

You’ll need to configure the plugin. You can do that when you first need it for an action, but it’s a good idea to set up a test action to get it working. In Tasker, go to the tasks tab and add a new task. Add an action, select the plugin category, and pick the Home Assistant plugin.

Select “Call Service” and then the pencil icon to edit the configuration. That will take you to a screen where you can configure the service call. Tap the plus icon next to the drop down selection field to add your server.

Choose a name for your server – this can be anything you like, as it’s just a label that you’ll use to select it. Add the external URL of your Home Assistant instance if you have one – if you use the internal IP address it will only work when you’re on your home network.

If you’re not comfortable with setting up dynamic DNS, port forwarding, and SSL certificates, then take a look at Nabu Casa.

You’ll also need an access token, which you create within Home Assistant. Go to your profile and scroll down to the Long Lived Access Token section. Click on “Create Token”, name your token:

Then copy the resulting token string:

Note that you won’t be able to see this token once it’s created, so copy it into Tasker straight away. If you use a password manager, that would be a good place to store it in case you need to configure the plugin again.

You should now be able to test a service call. For example to toggle a light, click the pencil button to edit the task, select “light.toggle” as the service and enter the service data:

Note that the service data is sent as JSON.

To tie this in to WearOS, you can use the screens feature that I discussed last time. The options are endless, but I’ll start off with screens to toggle lights and switches.

Start off by adding the “Home” app to your app list by going into the Autowear settings on your watch, selecting “Launcher Apps” and toggling on the “Home” app:

Now create a list screen as follows:

  • Command to launch %APPOPENEDHOME%
  • Items: Lights,Switches
  • Commands: listlights,lightswitches

Next, create another list screen that is launched by the “lightlights” command. Use a prefix for the command option, and use the Home Assistant entity names in the command list.

  • Command to launch: lightlights
  • Items: comma separated light of light names
  • Commands: comma separate list of light entity_ids without the “light.” prefix.

You could use the entire entity ID here – so “light.study” instead of “study” – but that can make the comma separated list a bit unwieldy if you have a lot of lights.

If that’s all worked, you should now have the home icon in your app list. Launching the app should bring up the screen showing the list of options. Selecting “Lights” should then show the list of lights:

Tapping on a light will send a command in the form “prefix=:=parameter” – for example, “light=:=study”.

Now you need to set up a profile to respond to the command. In the main Tasker app, create an event profile, select the AutoWear plugin and set “light=:=” as the command filter:

The parameter – i.e. the name of the light – will be available through the %AWCOMM variable.

Add a “Call Service” task from the Home Assistant plugin. Within the configuration, select the server that you configured earlier. Use “light.toggle” for the service and configure the data using the %AWCOMM variable:

This will call the toggle service, replacing %AWCOMM with the selected light.

You can now repeat for your switches.

It’s a fairly basic user interface, as you can’t see the current state of your lights and switches, but it does give you a quick and easy way to toggle them from your watch.

in Home Automation

Add a Comment

Your email address will not be published. All comments will be reviewed.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts