Created
July 25, 2020 10:05
-
-
Save adumont/0118b83f7993eacc04f5fd0ff55df8e8 to your computer and use it in GitHub Desktop.
Tasker tasks for TP-Link HS100
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<TaskerData sr="" dvi="1" tv="5.9.2"> | |
<Task sr="task92"> | |
<cdate>1483796022554</cdate> | |
<edate>1595670740258</edate> | |
<id>92</id> | |
<nme>Power On Plug 💡</nme> | |
<Action sr="act0" ve="7"> | |
<code>549</code> | |
<Str sr="arg0" ve="3">%TIMETOPOWEROFFPLUG</Str> | |
<Int sr="arg1" val="0"/> | |
<Int sr="arg2" val="0"/> | |
<Int sr="arg3" val="0"/> | |
</Action> | |
<Action sr="act1" ve="7"> | |
<code>130</code> | |
<Str sr="arg0" ve="3">Tp-link login</Str> | |
<Int sr="arg1"> | |
<var>%priority</var> | |
</Int> | |
<Str sr="arg2" ve="3"/> | |
<Str sr="arg3" ve="3"/> | |
<Str sr="arg4" ve="3"/> | |
<Int sr="arg5" val="0"/> | |
</Action> | |
<Action sr="act2" ve="7"> | |
<code>547</code> | |
<Str sr="arg0" ve="3">%token</Str> | |
<Str sr="arg1" ve="3">%TOKEN</Str> | |
<Int sr="arg2" val="0"/> | |
<Int sr="arg3" val="0"/> | |
<Int sr="arg4" val="0"/> | |
<Int sr="arg5"/> | |
</Action> | |
<Action sr="act3" ve="7"> | |
<code>547</code> | |
<Str sr="arg0" ve="3">%deviceId</Str> | |
<Str sr="arg1" ve="3">YOUR_HS100_DEVICEID_HERE</Str> | |
<Int sr="arg2" val="0"/> | |
<Int sr="arg3" val="0"/> | |
<Int sr="arg4" val="0"/> | |
<Int sr="arg5"/> | |
</Action> | |
<Action sr="act4" ve="7"> | |
<code>547</code> | |
<Str sr="arg0" ve="3">%state</Str> | |
<Str sr="arg1" ve="3">1</Str> | |
<Int sr="arg2" val="0"/> | |
<Int sr="arg3" val="0"/> | |
<Int sr="arg4" val="0"/> | |
<Int sr="arg5"/> | |
</Action> | |
<Action sr="act5" ve="7"> | |
<code>547</code> | |
<label>Prepare login payload</label> | |
<Str sr="arg0" ve="3">%payload</Str> | |
<Str sr="arg1" ve="3">{ | |
"method":"passthrough", | |
"params": | |
{"deviceId": "%deviceId", "requestData": "{\"system\":{\"set_relay_state\":{\"state\":%state}}}" } | |
} | |
</Str> | |
<Int sr="arg2" val="0"/> | |
<Int sr="arg3" val="0"/> | |
<Int sr="arg4" val="0"/> | |
<Int sr="arg5"/> | |
</Action> | |
<Action sr="act6" ve="7"> | |
<code>116</code> | |
<Str sr="arg0" ve="3">https://eu-wap.tplinkcloud.com</Str> | |
<Str sr="arg1" ve="3">/?token=%token&appName=Kasa_Android&termID=e933737a-9226-43db-a07d-6468912fb956&appVer=1.4.4.607&ospf=Android+6.0.1&netType=wifi&locale=es_ES</Str> | |
<Str sr="arg2" ve="3">%payload</Str> | |
<Str sr="arg3" ve="3"/> | |
<Str sr="arg4" ve="3">Dalvik/2.1.0 (Linux; U; Android 6.0.1; A0001 Build/M4B30X)</Str> | |
<Int sr="arg5" val="19"/> | |
<Str sr="arg6" ve="3">text/plain</Str> | |
<Str sr="arg7" ve="3"/> | |
<Int sr="arg8" val="1"/> | |
</Action> | |
<Action sr="act7" ve="7"> | |
<code>130</code> | |
<Str sr="arg0" ve="3">Get Plug State</Str> | |
<Int sr="arg1"> | |
<var>%priority</var> | |
</Int> | |
<Str sr="arg2" ve="3"/> | |
<Str sr="arg3" ve="3"/> | |
<Str sr="arg4" ve="3"/> | |
<Int sr="arg5" val="0"/> | |
</Action> | |
<Img sr="icn" ve="2"> | |
<nme>hd_aaa_ext_bulb</nme> | |
</Img> | |
</Task> | |
</TaskerData> | |
<TaskerData sr="" dvi="1" tv="5.9.2"> | |
<Task sr="task107"> | |
<cdate>1483796139357</cdate> | |
<edate>1595670734907</edate> | |
<id>107</id> | |
<nme>Power Off Plug 🔌</nme> | |
<pri>6</pri> | |
<Action sr="act0" ve="7"> | |
<code>549</code> | |
<Str sr="arg0" ve="3">%TIMETOPOWEROFFPLUG</Str> | |
<Int sr="arg1" val="0"/> | |
<Int sr="arg2" val="0"/> | |
<Int sr="arg3" val="0"/> | |
</Action> | |
<Action sr="act1" ve="7"> | |
<code>130</code> | |
<Str sr="arg0" ve="3">Tp-link login</Str> | |
<Int sr="arg1"> | |
<var>%priority</var> | |
</Int> | |
<Str sr="arg2" ve="3"/> | |
<Str sr="arg3" ve="3"/> | |
<Str sr="arg4" ve="3"/> | |
<Int sr="arg5" val="0"/> | |
</Action> | |
<Action sr="act2" ve="7"> | |
<code>547</code> | |
<Str sr="arg0" ve="3">%token</Str> | |
<Str sr="arg1" ve="3">%TOKEN</Str> | |
<Int sr="arg2" val="0"/> | |
<Int sr="arg3" val="0"/> | |
<Int sr="arg4" val="0"/> | |
<Int sr="arg5"/> | |
</Action> | |
<Action sr="act3" ve="7"> | |
<code>547</code> | |
<Str sr="arg0" ve="3">%deviceId</Str> | |
<Str sr="arg1" ve="3">YOUR_HS100_DEVICEID_HERE</Str> | |
<Int sr="arg2" val="0"/> | |
<Int sr="arg3" val="0"/> | |
<Int sr="arg4" val="0"/> | |
<Int sr="arg5"/> | |
</Action> | |
<Action sr="act4" ve="7"> | |
<code>547</code> | |
<Str sr="arg0" ve="3">%state</Str> | |
<Str sr="arg1" ve="3">0</Str> | |
<Int sr="arg2" val="0"/> | |
<Int sr="arg3" val="0"/> | |
<Int sr="arg4" val="0"/> | |
<Int sr="arg5"/> | |
</Action> | |
<Action sr="act5" ve="7"> | |
<code>547</code> | |
<label>Prepare login payload</label> | |
<Str sr="arg0" ve="3">%payload</Str> | |
<Str sr="arg1" ve="3">{ | |
"method":"passthrough", | |
"params": | |
{"deviceId": "%deviceId", "requestData": "{\"system\":{\"set_relay_state\":{\"state\":%state}}}" } | |
} | |
</Str> | |
<Int sr="arg2" val="0"/> | |
<Int sr="arg3" val="0"/> | |
<Int sr="arg4" val="0"/> | |
<Int sr="arg5"/> | |
</Action> | |
<Action sr="act6" ve="7"> | |
<code>116</code> | |
<Str sr="arg0" ve="3">https://eu-wap.tplinkcloud.com</Str> | |
<Str sr="arg1" ve="3">/?token=%token&appName=Kasa_Android&termID=e933737a-9226-43db-a07d-6468912fb956&appVer=1.4.4.607&ospf=Android+6.0.1&netType=wifi&locale=es_ES</Str> | |
<Str sr="arg2" ve="3">%payload</Str> | |
<Str sr="arg3" ve="3"/> | |
<Str sr="arg4" ve="3">Dalvik/2.1.0 (Linux; U; Android 6.0.1; A0001 Build/M4B30X)</Str> | |
<Int sr="arg5" val="19"/> | |
<Str sr="arg6" ve="3">text/plain</Str> | |
<Str sr="arg7" ve="3"/> | |
<Int sr="arg8" val="1"/> | |
</Action> | |
<Action sr="act7" ve="7"> | |
<code>130</code> | |
<Str sr="arg0" ve="3">Get Plug State</Str> | |
<Int sr="arg1"> | |
<var>%priority</var> | |
</Int> | |
<Str sr="arg2" ve="3"/> | |
<Str sr="arg3" ve="3"/> | |
<Str sr="arg4" ve="3"/> | |
<Int sr="arg5" val="0"/> | |
</Action> | |
<Img sr="icn" ve="2"> | |
<nme>hl_aaa_ext_bulb</nme> | |
</Img> | |
</Task> | |
</TaskerData> | |
<TaskerData sr="" dvi="1" tv="5.9.2"> | |
<Task sr="task152"> | |
<cdate>1497797522393</cdate> | |
<edate>1595670238025</edate> | |
<id>152</id> | |
<nme>Tp-link login</nme> | |
<pri>100</pri> | |
<rty>1</rty> | |
<Action sr="act0" ve="7"> | |
<code>126</code> | |
<label>Return if token is young (<1h)</label> | |
<Str sr="arg0" ve="3">1</Str> | |
<Int sr="arg1" val="1"/> | |
<ConditionList sr="if"> | |
<Condition sr="c0" ve="3"> | |
<lhs>%TIMES</lhs> | |
<op>6</op> | |
<rhs>%TOKENDATE</rhs> | |
</Condition> | |
</ConditionList> | |
</Action> | |
<Action sr="act1" ve="7"> | |
<code>547</code> | |
<label>Prepare login payload</label> | |
<Str sr="arg0" ve="3">%payload</Str> | |
<Str sr="arg1" ve="3">{ | |
"method" :"login", | |
"params" : | |
{"appType" :"Kasa_Android", | |
"cloudPassword" :"%TPLPASS", "cloudUserName" :"%TPLUSER", | |
"terminalUUID" :"%TPLTERM" | |
} | |
} </Str> | |
<Int sr="arg2" val="0"/> | |
<Int sr="arg3" val="0"/> | |
<Int sr="arg4" val="0"/> | |
<Int sr="arg5" val="3"/> | |
</Action> | |
<Action sr="act2" ve="7"> | |
<code>116</code> | |
<Str sr="arg0" ve="3">https://wap.tplinkcloud.com</Str> | |
<Str sr="arg1" ve="3"/> | |
<Str sr="arg2" ve="3">%payload</Str> | |
<Str sr="arg3" ve="3"/> | |
<Str sr="arg4" ve="3"/> | |
<Int sr="arg5" val="10"/> | |
<Str sr="arg6" ve="3">text/plain</Str> | |
<Str sr="arg7" ve="3"/> | |
<Int sr="arg8" val="1"/> | |
</Action> | |
<Action sr="act3" ve="7"> | |
<code>129</code> | |
<label>Extract token from response</label> | |
<Str sr="arg0" ve="3">var mtoken = JSON.parse(global("HTTPD")).result.token;</Str> | |
<Str sr="arg1" ve="3"/> | |
<Int sr="arg2" val="1"/> | |
<Int sr="arg3" val="45"/> | |
</Action> | |
<Action sr="act4" ve="7"> | |
<code>129</code> | |
<label>Extract token from response</label> | |
<Str sr="arg0" ve="3">var mtoken = JSON.parse(global("HTTPD")).result.token;</Str> | |
<Str sr="arg1" ve="3"/> | |
<Int sr="arg2" val="1"/> | |
<Int sr="arg3" val="45"/> | |
</Action> | |
<Action sr="act5" ve="7"> | |
<code>548</code> | |
<on>false</on> | |
<Str sr="arg0" ve="3">%mtoken</Str> | |
<Int sr="arg1" val="1"/> | |
</Action> | |
<Action sr="act6" ve="7"> | |
<code>547</code> | |
<Str sr="arg0" ve="3">%TOKEN</Str> | |
<Str sr="arg1" ve="3">%mtoken</Str> | |
<Int sr="arg2" val="0"/> | |
<Int sr="arg3" val="0"/> | |
<Int sr="arg4" val="0"/> | |
<Int sr="arg5"/> | |
</Action> | |
<Action sr="act7" ve="7"> | |
<code>547</code> | |
<Str sr="arg0" ve="3">%TOKENDATE</Str> | |
<Str sr="arg1" ve="3">%TIMES+300</Str> | |
<Int sr="arg2" val="0"/> | |
<Int sr="arg3" val="1"/> | |
<Int sr="arg4" val="0"/> | |
<Int sr="arg5"/> | |
</Action> | |
</Task> | |
</TaskerData> | |
<TaskerData sr="" dvi="1" tv="5.9.2"> | |
<Task sr="task132"> | |
<cdate>1485688103287</cdate> | |
<edate>1554360035428</edate> | |
<id>132</id> | |
<nme>Get Plug State</nme> | |
<pri>100</pri> | |
<Action sr="act0" ve="7"> | |
<code>130</code> | |
<Str sr="arg0" ve="3">Tp-link login</Str> | |
<Int sr="arg1"> | |
<var>%priority</var> | |
</Int> | |
<Str sr="arg2" ve="3"/> | |
<Str sr="arg3" ve="3"/> | |
<Str sr="arg4" ve="3"/> | |
<Int sr="arg5" val="0"/> | |
</Action> | |
<Action sr="act1" ve="7"> | |
<code>547</code> | |
<Str sr="arg0" ve="3">%deviceId</Str> | |
<Str sr="arg1" ve="3">YOUR_HS100_DEVICEID_HERE</Str> | |
<Int sr="arg2" val="0"/> | |
<Int sr="arg3" val="0"/> | |
<Int sr="arg4" val="0"/> | |
<Int sr="arg5"/> | |
</Action> | |
<Action sr="act2" ve="7"> | |
<code>116</code> | |
<Str sr="arg0" ve="3">https://wap.tplinkcloud.com/</Str> | |
<Str sr="arg1" ve="3">/?token=%TOKEN</Str> | |
<Str sr="arg2" ve="3">{ | |
"method":"passthrough", | |
"params": {"deviceId": "%deviceId", "requestData": "{\"system\":{\"get_sysinfo\":null},\"emeter\":{\"get_realtime\":null}}" | |
} | |
}</Str> | |
<Str sr="arg3" ve="3"/> | |
<Str sr="arg4" ve="3"/> | |
<Int sr="arg5" val="10"/> | |
<Str sr="arg6" ve="3">text/plain</Str> | |
<Str sr="arg7" ve="3"/> | |
<Int sr="arg8" val="0"/> | |
</Action> | |
<Action sr="act3" ve="7"> | |
<code>129</code> | |
<Str sr="arg0" ve="3">var data = JSON.parse(global("HTTPD")); | |
var result = data.result.responseData; | |
data = JSON.parse(result); | |
result = data.system.get_sysinfo.relay_state</Str> | |
<Str sr="arg1" ve="3"/> | |
<Int sr="arg2" val="1"/> | |
<Int sr="arg3" val="45"/> | |
</Action> | |
<Action sr="act4" ve="7"> | |
<code>548</code> | |
<Str sr="arg0" ve="3">%result</Str> | |
<Int sr="arg1" val="0"/> | |
</Action> | |
<Img sr="icn" ve="2"> | |
<nme>cust_notification</nme> | |
</Img> | |
</Task> | |
</TaskerData> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment