Android: Control Home Automation with Tasker from Quick Toggles

4 Likes

Can you expand upon how you did this? Looks great!

Subscribed!

This is an awesome idea, but without an explanation and instructions it’s just a major tease… :grin:

Do us a solid @broesie and show us how you did it.

1 Like

Okay, Let me explain it…

Requirements: Tasker knowledge + AutoNotifcation or Custom Quick Settings…

First of all, you can do it by using 2 different plugins.
For people who knows me, they know I’m a big fan of the Autoapps. (you can see that in the tutorials I made on youtube, (made more then 100 tutorials for tasker)
I prefer to use the autoapps, because that bundle can do way more things, that you possible can think.
Autoapps contains AutoNotification, AutoVoice, AutoContacts, AutoRemote, AutoArduino, AutoShare, and way more…
In my case I use AutoNotification to control my Quick Toggles…
It can be used without root. Also my phone is running Android Nougat 7.0 (Nexus 6P)
AutoNotification can be found here: https://play.google.com/store/apps/details?id=com.joaomgcd.autonotification
I recommend to buy the unlocked version, or to get a subscription to AutoApps (full pack, all unlocked + betas + alphas)

Another way is using Custom Quick Settings. That can be also used for lower versions of android.
I dont prefer this method, because it has way less possibilities…
Custom Quick Settings can be found here; https://play.google.com/store/apps/details?id=com.quinny898.app.customquicksettings

I will explain the method of AutoNotification:
First create a toggle on your quick settings, you can create 20 different toggles if you want…

First you need to understand how to use Tasker to control your devices on HASS by using HTTP post and JSON.
You can find info on this post: Create your own personal assistent with Tasker (in multi language) + Google Now integration

What I did to create toggles like this:
I prefer to create two task (because I can use those tasks in other tasks as well).
Example: Control Living Lights, so I create a task ‘Living Lights ON’ and ‘Living Lights OFF’
Also for example I use the 2nd AutoNotifcation Toggle.

So my task for Living Lights ON would be like this:

- Action 1: AutoNotification Tiles: Tile 2, Command: Toggle=:=living, Icon: Icon choosen from the iconpack, State: Active, Label; Living Lights
- Action 2: HTTP Post: http://yourhost:8123/api/services/light/turn_on?api_password=xxxxx
inside DATA / File: {"entity_id":"your id of your device"}
content type: application/json
- Action 3: Set variable: %Livinglights to On

For the Living Lights OFF you do the same, but in action 1, you set as state Inactive, and in action two, you use light/turn_off, and action 3 would be Set variable %Livinglights to Off

So those 2 tasks can put your lights either on or off…

So let’s create now a toggle task. I call it for example: ‘Toggle Living Lights’
To do so, you need to create 5 actions. So the task will be like this:

Action 1: If %Livinglights ~ On
Action 2: Perform task: Living Lights OFF
Action 3: Else if %Livinglights ~ Off
Action 4: Perform task: Living Lights ON
Action 5: End If

So now you have created your toggle task for your light.

Let’s create another toggle to control other toggles as well, I call it eg: Toggle control
Inside that task, it contain the following actions:

Action 1: Perform task: Toggle Living Lights if %ancomm ~ living (this is the same on the right side of the =:= of the command earlier)
Action 2: if you have more toggles you can add here....

Now only 1 thing to do is create a profile to link the toggle task to it. That is by using AutoNotification

Profile > Event > AutoNotification
As message you type: Toggle

Link now your task Toggle control to it…

Summary: For each thing I created 2 task (because if I want I can use those task later on, in other tasks as well).
I created 1 toggle for the device. And I created 1 main task to control the commands of all my other toggles.

I also added some action, because I also can control it by KLWP if I want it, just by linking the right task to it…

If you use the Custom Quick Settings plugin, I would be similar, except, the 1st action in side your ON or OFF task would be replaced by the action of Custom Quick Toggles Settings…

7 Likes

Example of ON and OFF tasks:

Example of Toggles tasks:

Example of Toggle Control:

Choosing different AutoNotification Toggles:

RESULT:

1 Like

This is fantastic!! Thank you! However (doesn’t there always seem to be a “however” in these thank you posts), I seem to be having a problem with the Toggle task. I have my On and Off tasks setup and they run as expected when I test them in Tasker. When I test the Toggle task, it stops on the Perform Task for whichever condition tests true and pops up an error that the task doesn’t exist.

The task was selected from within the app by tappig the magnifying glass though, not manually typed in.

Any help or pointers would be greatly appreciated!

Just exit tasker, and then open tasker again, that way you ensure tasker that it will save… Sometimes when you creating new tasks, its not found, just get out of tasker, and open it again, and you will find your task…

That was it! Thank you again!

@atomicpapa and @broesie I am stuck and I don’t know why I cannot get it working. I have created two tasks. One to turn the light on and one to turn the light off. If I run then in Tasker they both work, no problem here.

Toggle Living Lights task also works. If I run it I get no error in my Tasker log, so I assume it’s OK.

The problem must be in Toggle Control Toggle in tasker profile. My Toggle control looks like this:

When creating a profile, according to instruction I should:

Profile > Event > AutoNotification
As message you type: Toggle

I don’t really know what is meant with this. I think it should be a filter and like in the @broesie screenshot?

My Quick Setting is shown correctly in notification area. When I click it, nothing happens.

Any help would be greatly appreciated.

Anybody else?

You rocks !
This solution is perfect thanks !

Hi, @broesie. I just implemented a few toggles in tasker and they work pretty good…I just wondered if it is possible to get the state of the light or other entitys from HA into tasker?

1 Like

I’m using Join. When something happen on HA, it will automatically send the variables to my tasker. When Tasker receive it, it will send it to my KLWP Homescreen, so it will immediatly change it there too…
So you need only one profile and one task in Tasker to retrieve the info from HA and you need to create multiple automations inside your HA.

2 Likes

Hi

I just got this to work. Nice solution, thanks!

Is it only for me that it takes like 2-3 seconds for the Tiles to update and execute the task? If I run the task one by one they will execute directly. But running from the notification menu takes 2-3 seconds. Sometimes it’s done directly. Activate (On) can take 2-3 seconds but disabling (Off) runs directly almost all the time. Also, if you pull up the notification menu directly after pressing a Tile the task won’t execute.

Anyone else with the same “issue”?

Br Qxlkdr

Thanks you. This is great.

I have the same issue as you and I am stuck at creating a profile then event etc.

Did you resolve the issue?

Maybe @atomicpapa or @broesie can help?

Thanks.

@SmartValley @atomicpapa @broesie anyone???

Yes, it can take sometimes a few seconds before it will update the tiles. I let the developer know, I worked together wih him, and now he is also the developer of tasker itself…

Stuck in creating a profile? Can you explain more in detail?