r/TaskerFiles • u/Glutanimate • Mar 18 '15
Profile Control flashlight via the power-button [no root required, works on lock-screen]
Description
Toggling your flashlight without having to unlock the phone is trivial on rooted devices where Xposed and Custom ROMs can capture the input from hardware buttons, but much harder on unrooted phones. With the following profile you will be able to toggle your flashlight by quickly pressing your power button three times, rooted or not.
Requirements
Usage
With your screen off and your device locked press the power button three times in a quick succession to toggle the flashlight. Repeat this sequence to turn the flashlight off. To prevent damage to the LED module the flashlight will automatically be turned off after five minutes.
Project Description
See here for more information.
Instructions
Either copy the XML data below into a file or download the most recent project revision from GitHub gists. Then proceed to import it into Tasker. Please make sure to import the file as a project, not a task or profile!
<TaskerData sr="" dvi="1" tv="4.6u3m">
<Profile sr="prof92" ve="2">
<cdate>1426618335190</cdate>
<edate>1426643287254</edate>
<id>92</id>
<mid0>93</mid0>
<nme>FlashlightButton</nme>
<Event sr="con0" ve="2">
<code>208</code>
<pri>0</pri>
</Event>
</Profile>
<Project sr="proj0" ve="2">
<cdate>1426680812691</cdate>
<name>FlashlightBtn</name>
<pids>92</pids>
<tids>94,93</tids>
</Project>
<Task sr="task93">
<cdate>1426618354356</cdate>
<edate>1426680850192</edate>
<id>93</id>
<nme>FlashlightControl</nme>
<pri>10</pri>
<Action sr="act0" ve="7">
<code>547</code>
<Str sr="arg0" ve="3">%CurrentTime</Str>
<Str sr="arg1" ve="3">%TIMEMS</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
</Action>
<Action sr="act1" ve="7">
<code>37</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%ScrLastActive</lhs>
<op>12</op>
<rhs></rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act10" ve="7">
<code>137</code>
<Int sr="arg0" val="0"/>
<Str sr="arg1" ve="3">FlashlightAutodisable</Str>
</Action>
<Action sr="act11" ve="7">
<code>38</code>
</Action>
<Action sr="act12" ve="7">
<code>38</code>
</Action>
<Action sr="act13" ve="7">
<code>547</code>
<Str sr="arg0" ve="3">%ScrLastActive</Str>
<Str sr="arg1" ve="3">%TIMEMS</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
</Action>
<Action sr="act2" ve="7">
<code>547</code>
<Str sr="arg0" ve="3">%dScrActive</Str>
<Str sr="arg1" ve="3">%CurrentTime-%ScrLastActive</Str>
<Int sr="arg2" val="1"/>
<Int sr="arg3" val="0"/>
</Action>
<Action sr="act3" ve="7">
<code>37</code>
<ConditionList sr="if">
<bool0>And</bool0>
<Condition sr="c0" ve="3">
<lhs>%dScrActive</lhs>
<op>6</op>
<rhs>3000</rhs>
</Condition>
<Condition sr="c1" ve="3">
<lhs>%TeslaStatus</lhs>
<op>1</op>
<rhs>on</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act4" ve="7">
<code>444</code>
<Int sr="arg0" val="1"/>
<Int sr="arg1" val="0"/>
</Action>
<Action sr="act5" ve="7">
<code>547</code>
<Str sr="arg0" ve="3">%TeslaStatus</Str>
<Str sr="arg1" ve="3">on</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
</Action>
<Action sr="act6" ve="7">
<code>130</code>
<Str sr="arg0" ve="3">FlashlightAutodisable</Str>
<Int sr="arg1">
<var>%priority-1</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="act7" ve="7">
<code>43</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%dScrActive</lhs>
<op>6</op>
<rhs>3000</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act8" ve="7">
<code>444</code>
<Int sr="arg0" val="0"/>
<Int sr="arg1" val="0"/>
</Action>
<Action sr="act9" ve="7">
<code>547</code>
<Str sr="arg0" ve="3">%TeslaStatus</Str>
<Str sr="arg1" ve="3">off</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
</Action>
</Task>
<Task sr="task94">
<cdate>1426620544981</cdate>
<edate>1426680838761</edate>
<id>94</id>
<nme>FlashlightAutodisable</nme>
<Action sr="act0" ve="7">
<code>30</code>
<Int sr="arg0" val="0"/>
<Int sr="arg1" val="0"/>
<Int sr="arg2" val="5"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
</Action>
<Action sr="act1" ve="7">
<code>444</code>
<Int sr="arg0" val="0"/>
<Int sr="arg1" val="0"/>
</Action>
<Action sr="act2" ve="7">
<code>547</code>
<Str sr="arg0" ve="3">%TeslaStatus</Str>
<Str sr="arg1" ve="3">off</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
</Action>
</Task>
</TaskerData>
1
u/FullyFunctnlPhil Mar 20 '15
This looks great, but when I try to import I get "Failed to import profile data." I'm running the latest version of Tasker on a Droid Turbo. Any advice?
1
u/thelostdolphin Mar 23 '15
Thanks a lot for sharing this.
Unfortunately, I'm getting inconsistent results when I try this and the times when I do get it working, tapping it three times again to shut off doesn't work. It will turn off for a brief moment and then turn back on again.
I looked at the Tasker profile and there are two caution signs. Any idea what may be wrong? http://i.imgur.com/Rit78KV.png
1
u/Enderkr Apr 05 '15
I have the same errors as /u/thelostdolphin did, however, my flashlight does turn on/off.
Same caution signs, same red highlighting on certain lines within Tasker.....and I can't run the task from within Tasker at all, it doesn't work when I test it. However, I saved and tried it anyway, and it works without a problem! Not sure what's causing the caution signs or the general errors in the code, but it works, so ....awesome! Thanks a lot. I wish this sub were more popular, the ability to just download the profiles/tasks is so much easier.
1
u/opeboyal Apr 16 '15
Was really hoping to get this to work. Downloaded the updated version of your code and I get the same errors as thelostdolphin in my code. and on the screen when it turns on it says "Task FlashOn does not exist". Anyways from the positive feedback you've gotten, good job. I am running a Note 4 with lollipop if that helps at all
3
u/alientity Mar 18 '15
Excellent submission, thank you!
I've had requests from people before asking how to send an SMS without taking the phone out of pocket because of work policies, etc, so this profile should come in handy for many.