Skip to content

Instantly share code, notes, and snippets.

@fanuch
Created February 25, 2018 00:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fanuch/2bd3348b7e982b4aad09cb2943e1cace to your computer and use it in GitHub Desktop.
Save fanuch/2bd3348b7e982b4aad09cb2943e1cace to your computer and use it in GitHub Desktop.
Tasker quick settings tile that uses a single tile to turn on, and off lights! Link: https://goo.gl/Uxq5KN
<TaskerData sr="" dvi="1" tv="5.0u7m">
<Task sr="task71">
<cdate>1519374941058</cdate>
<edate>1519519907982</edate>
<id>71</id>
<nme>Demo</nme>
<pri>100</pri>
<Action sr="act0" ve="7">
<code>547</code>
<Str sr="arg0" ve="3">%url</Str>
<Str sr="arg1" ve="3">https://CHANGE_ME:8123</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
</Action>
<Action sr="act1" ve="7">
<code>547</code>
<Str sr="arg0" ve="3">%address</Str>
<Str sr="arg1" ve="3">/api/services/light/toggle?api_password=CHANGE_ME</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
</Action>
<Action sr="act2" ve="7">
<code>547</code>
<Str sr="arg0" ve="3">%body</Str>
<Str sr="arg1" ve="3">{"entity_id":"CHANGE_ME"}</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
</Action>
<Action sr="act3" ve="7">
<code>129</code>
<Str sr="arg0" ve="3">var xhttp = new XMLHttpRequest();
xhttp.open( "POST", url+address, false);
xhttp.send(body);
//uncomment below for errors!
//flash(xhttp.responseText);
var result = JSON.parse(xhttp.responseText)[0].state;</Str>
<Str sr="arg1" ve="3"/>
<Int sr="arg2" val="1"/>
<Int sr="arg3" val="45"/>
</Action>
<Action sr="act4" ve="7">
<code>37</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%result</lhs>
<op>0</op>
<rhs>on</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act5" ve="7">
<code>162</code>
<Int sr="arg0" val="0"/>
<Str sr="arg1" ve="3">Demo</Str>
<Int sr="arg2" val="0"/>
</Action>
<Action sr="act6" ve="7">
<code>43</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%result</lhs>
<op>0</op>
<rhs>off</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act7" ve="7">
<code>162</code>
<Int sr="arg0" val="0"/>
<Str sr="arg1" ve="3">Demo</Str>
<Int sr="arg2" val="1"/>
</Action>
<Action sr="act8" ve="7">
<code>38</code>
</Action>
</Task>
</TaskerData>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment