No unfortunately I did not made any progress, still stuck on the current status part.
I did managed to flip the switch.
Reinstalled my phone today and will start over tomorrow. Will share my project once I got it working.
/Edit
I see that another guide is updated recently, maybe this will help you? I will use that tomorrow.
Hi everyone !
A year ago, I posted a tutorial showing how to use Tasker with Home Assistant.
After more that 10 thousands views, I’ve decided to update the tutorial so it’s easier to follow, with better screenshots and better ways to identify problems
It also uses new features of Tasker, such as HTTP headers.
Let’s get started !
1. Create a token
First of all, go the the “Long-Lived Access Tokens” section at the bottom of the Profile page of your Home Assistant. This page can be ac…
1 Like
@jockebq
Got it working.
Follow the first 3 steps from here: ⚙️ Using Tasker with Home Assistant (V2)
And then import this task and change icon for it: Test_Floorlight.tsk.xml https://pastebin.com/U79JT09s
Add tile and it should work.
1 Like
Thanks @schumi2004 I followed the guide the first 3 steps. And I downloaded your Test_Floorlight.tsk.xml
and imported it to Tasker task section. But there seems to be something wrong with it, because when I click the task I cannot edit it, it asks me to select another task?
That is strange.
Maybe this works better using images?
Note : Floorlight has changed to Woonkamer or Kamer in my situation.
Task overview:
First 2 steps are from other topic, 3 - 8 from fanuch
Change task icon at bottom, mine has a lightbulb now.
Step 1
Step 2
Tasker Quick Settings Task
1 Like
nelbs
January 9, 2020, 10:44pm
45
Is there a way to set two quick settings task that act like toggles? When i try this the second toggles interacts strangely enough with the first one.
jockebq
January 10, 2020, 5:57am
46
Thank you so much! It is almost working for me. I can toggle a device on and off but the state is not returned. It will flash off both when it is turned on or off. And the switch won’t change from active to not active either. This is how I get the state {{ states(“switch.livingroom_tv”) }}
And I followed your guide for everything!
If you did what I did then it should work.
I would suggest to make separate TEST tasks and follow the suggestion done in linked topic under section:
4. Create your own tasks
Part 1 - Calling a service
If you’re not familiar with Home Assistant services, I suggest you go to the Developper tools > Services page of your Home Assistant and try doing things first.
I used the developer tools services page to show me the current status reported back so i could test the actual code to use in Step 2
@nelbs
Only thing i can think of is that you’r linking tasks to each other?
Can you explain your tasks/setup you created and your goal?
I only have 1 toggle but i have a feeling you created more then 1?
jockebq
January 10, 2020, 9:24am
48
Got it to work, it was actually the state of the switch I tested with that did not respond quick enough. So I set a 5 sec wait and now it works great.
I have the same question as @nelbs
Added a second quick setting and when I click it, it will change the first toggle to the same as the one I clicked. It seems you can only have one toggle switch in quick settings? Is there any way to add more than one?
I think you can do using AutoNotification.
hazio
February 13, 2020, 11:00pm
51
I’m trying to turn on two lights using the ‘group.’ entity, it works but isn’t great as the lights don’t turn on and off in order, and it’s either 1 light on and the other off, different state with each toggle.
Also, I’m getting the error: Error 400: {'message": "Error rendering template: Template SyntaxEr- ror: unexpected char at 10")
each time I press the toggle.
Any ideas? thanks
Can you post your task xml?
hazio
May 6, 2020, 7:08pm
53
Hi, here are the call-service, an templates below, I also get a toast message showing ‘%result’ after execution.
Call Service:
<TaskerData sr="" dvi="1" tv="5.9.3.beta.4">
<Task sr="task35">
<cdate>1484639103661</cdate>
<edate>1588791685341</edate>
<id>35</id>
<nme>HA call-service</nme>
<pri>100</pri>
<Share sr="Share">
<d>Call a Home Assistant service</d>
<p>false</p>
<t></t>
</Share>
<Action sr="act0" ve="7">
<code>37</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%par1</lhs>
<op>13</op>
<rhs></rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act1" ve="7">
<code>523</code>
<Str sr="arg0" ve="3">Service is undefined</Str>
<Str sr="arg1" ve="3">Call this task from a "Perform Task" action, and set the service in %par1</Str>
<Str sr="arg10" ve="3"/>
<Str sr="arg11" ve="3">HA Error</Str>
<Img sr="arg2" ve="2"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
<Int sr="arg5" val="3"/>
<Int sr="arg6" val="0"/>
<Int sr="arg7" val="1"/>
<Int sr="arg8" val="0"/>
<Str sr="arg9" ve="3"/>
</Action>
<Action sr="act10" ve="7">
<code>43</code>
</Action>
<Action sr="act11" ve="7">
<code>523</code>
<Str sr="arg0" ve="3">Error</Str>
<Str sr="arg1" ve="3">%http_data</Str>
<Str sr="arg10" ve="3"/>
<Str sr="arg11" ve="3">HA Error</Str>
<Img sr="arg2" ve="2"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
<Int sr="arg5" val="3"/>
<Int sr="arg6" val="0"/>
<Int sr="arg7" val="0"/>
<Int sr="arg8" val="0"/>
<Str sr="arg9" ve="3"/>
</Action>
<Action sr="act12" ve="7">
<code>38</code>
</Action>
<Action sr="act2" ve="7">
<code>137</code>
<Int sr="arg0" val="1"/>
<Str sr="arg1" ve="3"/>
</Action>
<Action sr="act3" ve="7">
<code>38</code>
</Action>
<Action sr="act4" ve="7">
<code>590</code>
<Str sr="arg0" ve="3">%par1</Str>
<Str sr="arg1" ve="3">.</Str>
<Int sr="arg2" val="0"/>
</Action>
<Action sr="act5" ve="7">
<code>592</code>
<Str sr="arg0" ve="3">%par1</Str>
<Str sr="arg1" ve="3">/</Str>
<Int sr="arg2" val="0"/>
</Action>
<Action sr="act6" ve="7">
<code>339</code>
<se>false</se>
<Bundle sr="arg0">
<Vals sr="val">
<net.dinglisch.android.tasker.RELEVANT_VARIABLES><StringArray sr=""><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES0>%http_data
Data
Data that the server responded from the HTTP request.</_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES0><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES1>%http_file_output
File Output
Will always contain the file's full path even if you specified a directory as the File to save.</_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES1><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES2>%http_response_code
Response Code
The HTTP Code the server responded</_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES2><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES3>%http_cookies
Cookies
The cookies the server sent in the response in the Cookie:COOKIE_VALUE format. You can use this directly in the 'Headers' field of the HTTP Request action</_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES3><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES4>%http_headers()
Response Headers
The HTTP Headers the server sent in the response. Each header is in the 'key:value' format</_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES4><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES5>%http_response_length
Response Length
The size of the response in bytes</_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES5></StringArray></net.dinglisch.android.tasker.RELEVANT_VARIABLES>
<net.dinglisch.android.tasker.RELEVANT_VARIABLES-type>[Ljava.lang.String;</net.dinglisch.android.tasker.RELEVANT_VARIABLES-type>
</Vals>
</Bundle>
<Int sr="arg1" val="1"/>
<Int sr="arg10" val="0"/>
<Int sr="arg11" val="0"/>
<Str sr="arg2" ve="3">%HA_ADDR/api/services/%par1</Str>
<Str sr="arg3" ve="3">Authorization:Bearer %HA_TOKEN</Str>
<Str sr="arg4" ve="3"/>
<Str sr="arg5" ve="3">%par2</Str>
<Str sr="arg6" ve="3"/>
<Str sr="arg7" ve="3"/>
<Int sr="arg8" val="30"/>
<Int sr="arg9" val="1"/>
</Action>
<Action sr="act7" ve="7">
<code>126</code>
<Str sr="arg0" ve="3">%http_data</Str>
<Int sr="arg1" val="1"/>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%http_response_code</lhs>
<op>0</op>
<rhs>200</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act8" ve="7">
<code>37</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%http_response_code</lhs>
<op>12</op>
<rhs></rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act9" ve="7">
<code>523</code>
<Str sr="arg0" ve="3">Error: %http_response_code</Str>
<Str sr="arg1" ve="3">%http_data</Str>
<Str sr="arg10" ve="3"/>
<Str sr="arg11" ve="3">HA Error</Str>
<Img sr="arg2" ve="2"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
<Int sr="arg5" val="3"/>
<Int sr="arg6" val="0"/>
<Int sr="arg7" val="0"/>
<Int sr="arg8" val="0"/>
<Str sr="arg9" ve="3"/>
</Action>
<Img sr="icn" ve="2">
<nme>mw_action_http</nme>
</Img>
</Task>
</TaskerData>
Template:
<TaskerData sr="" dvi="1" tv="5.9.3.beta.4">
<Task sr="task37">
<cdate>1484639103661</cdate>
<edate>1588791693407</edate>
<id>37</id>
<nme>HA template</nme>
<pri>100</pri>
<Share sr="Share">
<d>Retrieve data from Home Assistant</d>
<p>false</p>
<t></t>
</Share>
<Action sr="act0" ve="7">
<code>37</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%par1</lhs>
<op>13</op>
<rhs></rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act1" ve="7">
<code>523</code>
<Str sr="arg0" ve="3">Template is undefined</Str>
<Str sr="arg1" ve="3">Call this task from a "Perform Task" action, and set the template in %par1</Str>
<Str sr="arg10" ve="3"/>
<Str sr="arg11" ve="3">HA Error</Str>
<Img sr="arg2" ve="2"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
<Int sr="arg5" val="3"/>
<Int sr="arg6" val="0"/>
<Int sr="arg7" val="1"/>
<Int sr="arg8" val="0"/>
<Str sr="arg9" ve="3"/>
</Action>
<Action sr="act10" ve="7">
<code>43</code>
</Action>
<Action sr="act11" ve="7">
<code>523</code>
<Str sr="arg0" ve="3">Error</Str>
<Str sr="arg1" ve="3">%http_data</Str>
<Str sr="arg10" ve="3"/>
<Str sr="arg11" ve="3">HA Error</Str>
<Img sr="arg2" ve="2"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
<Int sr="arg5" val="3"/>
<Int sr="arg6" val="0"/>
<Int sr="arg7" val="0"/>
<Int sr="arg8" val="0"/>
<Str sr="arg9" ve="3"/>
</Action>
<Action sr="act12" ve="7">
<code>38</code>
</Action>
<Action sr="act2" ve="7">
<code>137</code>
<Int sr="arg0" val="1"/>
<Str sr="arg1" ve="3"/>
</Action>
<Action sr="act3" ve="7">
<code>38</code>
</Action>
<Action sr="act4" ve="7">
<code>590</code>
<Str sr="arg0" ve="3">%par1</Str>
<Str sr="arg1" ve="3">"</Str>
<Int sr="arg2" val="0"/>
</Action>
<Action sr="act5" ve="7">
<code>592</code>
<Str sr="arg0" ve="3">%par1</Str>
<Str sr="arg1" ve="3">/ "</Str>
<Int sr="arg2" val="0"/>
</Action>
<Action sr="act6" ve="7">
<code>339</code>
<se>false</se>
<Bundle sr="arg0">
<Vals sr="val">
<net.dinglisch.android.tasker.RELEVANT_VARIABLES><StringArray sr=""><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES0>%http_data
Data
Data that the server responded from the HTTP request.</_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES0><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES1>%http_response_code
Response Code
The HTTP Code the server responded</_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES1><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES2>%http_headers()
Response Headers
The HTTP Headers the server sent in the response. Each header is in the 'key:value' format</_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES2><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES3>%http_response_length
Response Length
The size of the response in bytes</_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES3></StringArray></net.dinglisch.android.tasker.RELEVANT_VARIABLES>
<net.dinglisch.android.tasker.RELEVANT_VARIABLES-type>[Ljava.lang.String;</net.dinglisch.android.tasker.RELEVANT_VARIABLES-type>
</Vals>
</Bundle>
<Int sr="arg1" val="1"/>
<Int sr="arg10" val="0"/>
<Int sr="arg11" val="0"/>
<Str sr="arg2" ve="3">%HA_ADDR/api/template</Str>
<Str sr="arg3" ve="3">Authorization:Bearer %HA_TOKEN</Str>
<Str sr="arg4" ve="3"/>
<Str sr="arg5" ve="3">{"template":"%par1"}</Str>
<Str sr="arg6" ve="3"/>
<Str sr="arg7" ve="3"/>
<Int sr="arg8" val="30"/>
<Int sr="arg9" val="1"/>
</Action>
<Action sr="act7" ve="7">
<code>126</code>
<Str sr="arg0" ve="3">%http_data</Str>
<Int sr="arg1" val="1"/>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%http_response_code</lhs>
<op>0</op>
<rhs>200</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act8" ve="7">
<code>37</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%http_response_code</lhs>
<op>12</op>
<rhs></rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act9" ve="7">
<code>523</code>
<Str sr="arg0" ve="3">Error: %http_response_code</Str>
<Str sr="arg1" ve="3">%http_data</Str>
<Str sr="arg10" ve="3"/>
<Str sr="arg11" ve="3">HA Error</Str>
<Img sr="arg2" ve="2"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
<Int sr="arg5" val="3"/>
<Int sr="arg6" val="0"/>
<Int sr="arg7" val="0"/>
<Int sr="arg8" val="0"/>
<Str sr="arg9" ve="3"/>
</Action>
<Img sr="icn" ve="2">
<nme>mw_action_http</nme>
</Img>
</Task>
</TaskerData>
Thanks