[MOD] %Battery Drain/Hr Widget using Tasker and Minimalistic Text - Android Software/Hacking General [Developers Only]

Cool %Battery Drain/Hr Widget using Tasker and Minimalistic Text
Minimalist widget that displays:
- % of battery drain or charge per hour... ie "-6.89 /hr"
- time in hours remaining till fully charged or discharged at the accumulated average % drain per hour... ie "14.2 hrs"
- % of battery lost or gained in hours since plugged in or unplugged... ie "-2% in 0.29"
Requires Minimalistic Text App from Market: https://market.android.com/details?id=de.devmil.minimaltext&hl=en
If anyone has any suggestions on how to simplify it... let me know.
4 Profiles Total:
Profile 1 - OnBoot - Clears and sets variables for new battery drain/charge stats
Profile 2 - PluggedIn (AC or USB) - Clears and sets variables for new battery drain/charge stats
Profile 3 - BattCharging - Calculates %charge/hr, time till 100% charge and %battery increase since start of charging
Profile 4 - BattDraining - Calculates %drain/hr, time till 0% charge and %battery decrease since start of discharging
The first two profiles are designed to clear and reset the battery% and timestart variables when the phone boots up or when the power profile changes. The first one is the OnBoot profile which is a useful profile to have in the first place. You can have your phone start a program or do some other useful task when your phone first starts up.
The second one will activate when the phone is plugged in either via usb or the wall plug. This is also a useful profile for other reasons... for example you can make your timeout longer when the phone is plugged in and make it go back to a shorter timeout when it's unplugged with the exit task.
I would imagine some people already have an OnBoot and a Charging profile, so just add the following tasklist to them to keep from cluttering up your tasks if it's viable, otherwise just create the profiles as they are below.
Profile 1: OnBoot
Context: Event > System > Device Boot
Task:
1. Variable Clear: %BATTSTART
2. Variable Clear: %TIMESTART
3. Variable Set: %BATTSTART To %BATT
4. Variable Set: %TIMESTART To %TIMES
5. Minimalistic Text: Configuration - %BATTDRAIN = Please
6. Minimalistic Text: Configuration - %BATTLEFT = wait...
7. Minimalistic Text: Configuration - %TIMEBATT = (blank)
Profile 2: PluggedIn
Context: - Choose State > Power > Power > Source: Any
Task:
1. Variable Clear: %BATTSTART
2. Variable Clear: %TIMESTART
3. Variable Set: %BATTSTART To %BATT
4. Variable Set: %TIMESTART To %TIMES
5. Minimalistic Text: Configuration - %BATTDRAIN = Please
6. Minimalistic Text: Configuration - %BATTLEFT = wait...
7. Minimalistic Text: Configuration - %TIMEBATT = (blank)
Exit Task:
1. Variable Clear: %BATTSTART
2. Variable Clear: %TIMESTART
3. Variable Set: %BATTSTART To %BATT
4. Variable Set: %TIMESTART To %TIMES
5. Minimalistic Text: Configuration - %BATTDRAIN = Please
6. Minimalistic Text: Configuration - %BATTLEFT = wait...
7. Minimalistic Text: Configuration - %TIMEBATT = (blank)
The next two profiles are where all the math is done. One profile is setup for when the phone is plugged in and charging. The other is setup for when the phone is unplugged and discharging. An IF statement was implemented because Tasker seems to track battery changes very frequently even when the actual battery percent hasn't changed. So a variable called %BATTPREV was created to do a quick check... If the battery % hasn't changed then it doesn't do anything until it does change. Also... I personally have the results written to a battlog.txt file because I found it handy to see a log of data.
I used the Variable Section task to drop one of the decimal points... Precision to 3 decimals is not necessary I don't feel, but there is no way to round it to 1 or 2 decimals yet. I think to the 10ths is plenty for this application.
Profile 3: BattCharging:
Context: Event > Power > Battery Changed
Context: State > Power > Power > Source: Any
Task:
1. If - %BATT !~ %BATTPREV
2. Variable Set: %BATTUSED To %BATT - %BATTSTART - Check "Do Maths"
3. Variable Set: %TIMEBATT To (%TIMES - %TIMESTART)/3600 - Check "Do Maths"
4. Variable Section: %TIMEBATT From 1 Length 4
5. Variable Set: %BATTDRAIN To %BATTUSED/%TIMEBATT - Check "Do Maths"
6. Variable Section: %BATTDRAIN From 1 Length 4
7. Variable Set: %BATTLEFT To (100-%BATT)/%BATTDRAIN - Check "Do Maths"
8. Variable Section: %BATTLEFT From 1 to Length 4
9. Minimalistic Text: Configuration - %BATTLEFT = %BATTLEFT hrs
10. Minimalistic Text: Configuration - %BATTDRAIN = +%BATTDRAIN /hr
11. Minimalistic Text: Configuration - %TIMEBATT = +%BATTUSED in %TIMEBATT
12. OPTIONAL - Write File: battlog.txt Append:On - Text:"CHG: %DATE, %TIME, %BATT, +%BATTDRAIN / hr %UPS"
13. End If
14. Variable Set: %BATTPREV To %BATT
Profile 4: BattDraining:
Context: Event > Power > Battery Changed
Context: State > Power > Power > Source: Any INVERT!!
Task:
1. If - %BATT !~ %BATTPREV
2. Variable Set: %BATTUSED To %BATT - %BATTSTART - Check "Do Maths"
3. Variable Set: %TIMEBATT To (%TIMES - %TIMESTART)/3600 - Check "Do Maths"
4. Variable Section: %TIMEBATT From 1 Length 4
5. Variable Set: %BATTDRAIN To (%BATTUSED/%TIMEBATT)*-1 - Check "Do Maths"
6. Variable Section: %BATTDRAIN From 1 Length 4
7. Variable Set: %BATTLEFT To %BATT/%BATTDRAIN - Check "Do Maths"
8. Variable Section: %BATTLEFT From 1 to Length 4
9. Minimalistic Text: Configuration - %BATTLEFT = %BATTLEFT hrs
10. Minimalistic Text: Configuration - %BATTDRAIN = +%BATTDRAIN /hr
11. Minimalistic Text: Configuration - %TIMEBATT = -%BATTUSED in %TIMEBATT
12. OPTIONAL - Write File: battlog.txt Append:On - Text:"CHG: %DATE, %TIME, %BATT, -%BATTDRAIN / hr %UPS"
13. End If
14. Variable Set: %BATTPREV To %BATT
Finally.... Create a Minimalistic Text Widget size of 1x1 to display the data on your homescreen
Setup a Custom Layout with 3 Levels...
Level 1: Add Local Variable from the Misc tab: Variable Name: %BATTDRAIN, Style: Normal Override Size: 15
Level 2: Add Local Variable from the Misc tab: Variable Name: %BATTLEFT, Style: Normal, Override Size: 15
Level 3 (OPTIONAL): Add Local Variable from the Misc tab: Variable Name: %TIMEBATT, Style: Normal, Override Size: 10

Thanks man.
You have no idea how long I was investigating somethig light and easy way to show discharge rate on the home screen.
I test your build and can confrim, that it works as prescribed even after 2 years you wrote first post.
Anyway I hope you did not stop to work on it and you can improve it. After few first days I am planning to study deeper your original work. I am new not new to Tasker but I never work with variables.
I would like to improve and add some stuff:
1. I want to see current discharge rate of last 1%.
2. show time in format "X hours X minutes"

Lol... blast from the past
Actually I still use it... but I've made some modifications and tweaks since.
I've simplified it a bit and changed what it watches for...
When it is draining it keeps track of:
Drain/hr... (ex) -2.5 %/h
Estimated time remaining: (ex) 10h 53m
Screen on time accumulated/total screen time expected: (ex) 0.48 / 4.58
When it's charging it keeps track of the first two things... charge per hour and estimated time till 100% and the bottom figure counts how many % have charged since plugged in and how long it's been.
Works reliably still... I've been meaning to program it in java and make a tiny app independent of these 3rd part apps... but eh.
Glad you like it.
Sent from my SM-N900T using Tapatalk

This is how it looks now while discharging.
Sent from my SM-N900T using Tapatalk

This is on my home screen
Do you mind sharing version with screen on time?

Give me a day or two and I'll write a detailed update for the profiles.
I really should just learn to program this sometime. It would be a lot easier.
Sent from my SM-N900T using Tapatalk

It's too much too type... I exported the profiles. Remember... you need minimalistic text to display the information on your home screen. I'm including the profiles and the minimalistic text profile as well. You can figure out how to import tasker profiles and the minimalistic folder is accessed from within the program... you have to save it to the sdcard/Minimalistic TextPreferences folder on your phone to be accessed.
Good luck!!
There are six profiles.
1. BatteryDraining - Tracks when your phone is unplugged and only performs a % drain / hour calculation when the battery % goes down and displays on the minimalistic text widget.
2. BatteryCharging - Tracks when your phone is plugged in and only performs a %charge / hour calculation when the battery % goes up and displays on the minimalistic text widget.
3. PluggedIn - Resets the variables used by the BatteryCharging profile in order to track charging % / hour statistics. When phone is unplugged variables are again reset for the BatteryDrain profile to track drain % / hour. (You may want to edit this profile because I have it set my screen time out to 15 minutes when it's plugged in and goes back to 30 seconds when unplugged. Also writes the stats to a text file on the phone storage... this is not necessary, but it's interesting for logging purposes to me.)
4. OnBoot - Resets all variables and will automatically calculate and display % drain or % charge wether phone is plugged in or not. (This profile also appends some information to the same battery log on the phone memory.)
5. ScreenOn - simple profile that sets the time that the phone screen is turned on
6. ScreenOff - another simple profile that sets the time that the screen is turned off and appends cumulative screen time and calculates an estimate of maximum screen on time which displays via minimlalistic text widget when phone is unplugged.
Alright... it works really well and I use it constantly. Next to zero battery drain because it only does anything when the battery actually changes. There is no active "monitor" mechanism.. it works entirely on reports of the system of battery changes.

Thanks for profiles, but i have a problem.
PluggedIn profile points to BattFull Profile Status...
I have exclamation mark on that profile, under Profile Status.
I set it to PluggedIn, and I'm testing it right now.
Will report later

It works fine, thanks again

Oh yeah... BattFull is another profile I created. It is very simple... when battery hits 100% it makes a sound and then turns itself off. When you plug in the phone it activates BattFull again. You can just delete that task... or make battful
Sent from my SM-N900T using Tapatalk

I'm not trying to do this exactly but something similar and maybe you can help me.
What I'm trying to do is make tasker alert me if my battery drops more than 2% per hour during my workday.
This is a little long so please bear with me:
I have 2 profiles. The first happens at 8:45 AM. The second happens every hour from 9:30AM to 4:30PM
Profile 1)
Variable Set %BATTLEVEL to %BATT
Profile 2)
Variable Set %CURRENTBATT to %BATT
Variable Set %BATTDIFF to %BATTLEVEL - %CURRENTBATT (do maths checked)
Alert - Notification LED - If %DIFFBATT > 2
This should happen at the 1/2 hour mark in each hour, but it is not performing the Variable Set tasks. The thing is I know these profiles are active and working because I have them doing other things like turing my data off, setting ringer volumes...and all those things are working.
The battery was at 56% at 2:15 PM when i set this up. So at 2:45PM I ran a test task Flash %BATTLEVEL, and Flash %CURRENTBATT, it gave me 56% for both. Then I purposefully drained it to 53% by 3:15PM so that I could test to see if it was working. I was expecting it to start flashing my notification light at 3:30PM. But it did not, so at 3:45 PM I checked the test task and the %BATTLEVEL and %CURRENTBATT are still at 56. So it just never ran the Variable Set commands. I don't understand why it wouldn't run those. Any suggestions?

Is that Calendar widget Tasker-based? If so, do you mind sharing?

Has anyone got a profile for estimating how long until the battery is fully charged?

Is there anyway to display the battery stats in a notification instead of a widget?

Please guide me how to add current mA to this settlement

Related

[Q][TASKER] Several Questions

I have a few questions.
I tried to make my own Juice Defender replacement:
Data Check -
Contexts:
Time
From 6:30
every 15 min
To 01:00
Power
Any
Inverted
Tasks:
Stop
if %SCREEN ~ ON
Stop
if %CELLSIG < 1
Mobile Data
On
Auto-Sync
On
Wait
2 min
Auto-Sync
Off
Mobile Data
Off
For some reason I can't set an end task, but I think I got around it. What this should do is when my screen is off and I have service it should check for any sort of notifications (facebook, mail), correct? Also, will I still get texts and calls instantly or does Mobile Data include these?
you shouldn't use the wait there as while tasker is waiting those 2 min nothing else can run.
I posted my tasks for this in another thread recently: http://forum.xda-developers.com/showpost.php?p=11097712&postcount=14
Is there anything else I can use instead of wait? I don't really want to make 4 profiles. Also I tried doing something else and it's not working. I attempted to make a Night Mode, however it doesn't turn on:
Nightenable:
Contexts:
From 1:00 Till 6:29
Tasks:
Variable Set %NIGHT, 1
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Night Mode:
Contexts:
Variable Set %NIGHT, 1
Tasks:
Lower Volume, etc.
why don't you want to use 4 tasks? That's the most ellegant way to do it
for the night mode don't set the variable but set the stuff you want straight away
I would do it in one task except I also have this:
Power Mode:
Contexts:
Power On
Tasks: (Menu)
(Night Mode) Variable Set %NIGHT, 1
(Normal Mode) Variable Set %NIGHT, 0
Vulf said:
I have a few questions.
I tried to make my own Juice Defender replacement:
Data Check -
Contexts:
Time
From 6:30
every 15 min
To 01:00
...
...
For some reason I can't set an end task, but I think I got around it. What this should do is when my screen is off and I have service it should check for any sort of notifications (facebook, mail), correct? Also, will I still get texts and calls instantly or does Mobile Data include these?
Click to expand...
Click to collapse
How I do this:
Profile: Sleep
Time
From 23:00
un-checked
To 05:59
---------------------------------------
Tasks: Sleep
Notification Pulse
Off​Ringer Volume
5​Mobile data
Off​WiFi
Off​Bluetooth
Off​Auto-Sync
Off​Display Brightness
15​---------------------------------------
Exit Tasks: Awake
Notification Pulse
On​Ringer Volume
15​Auto Brightness
On​
I utilize a whole other Project with several Profiles to control the Wifi & Mobile Data usage. now working on a BT radio policy

[TUT] Tasker CPU Control V5|Frequency/Governor Customisable Profiles|SetCPU with OCD

INSTALLATION INSTRUCTIONS ADDED TO POST #2
For those of you not familiar with Tasker, it’s a pretty damn amazing application that works toward fully automating your Android phone.
You can pick up a free trial version from here.
This thread is to show, assist and learn (from your input) how to fully utilise the newly introduced CPU controls, with the ultimate goal of preserving battery life without using additional applications such as SetCPU or other power saving scripts. This may look like a beast of a tutorial, but it really doesn't take that long to set up. Honest...
Tasker can be a little daunting at first, but a quick read through the manual, some tweaking of the profiles and step-throughs on the Tasker wiki and you’ll be up to speed in no time.
In order to control the CPU, you’ll need a rooted device and a compatible kernel. A quick acronym lesson can be found here. In brief, you require the following Governors (or as many of them as you can get!):
Performance (keeps the CPU frequency always at the maximum. Most power-hungry, most responsive)
Ondemand (when the CPU is needed, immediately sets it to maximum frequency. Slowly reduces the frequency back down to the minimum as time passes. Responsive, reasonable power usage).
Interactive (like Ondemand, but more responsive with slightly more battery usage)
Conservative (when the CPU load is needed, slowly increases the frequency to maximum. When the CPU is no longer needed, immediately drops back to the minimum. Less power-usage than Ondemand or Interactive, less responsive).
If there isn’t such a kernel for your device, then I can only suggest you beg and plead with a Dev in your device’s forum!
You can check the following in a file explorer to see your available frequencies and governors of your current/updated Kernel:
sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
I have a Desire and am running an Oxygen AOSP ROM. I’m therefore using vorkKernel detailed here. There’s a detailed breakdown in the first post of that thread showing the kind of kernel you’re looking for.
WARNING! DO NOT ENABLE THE PROFILES UNTIL YOU HAVE DOUBLE CHECKED THEY DO NOT EXCEED YOUR PHONE’S CAPABILITIES!! I TAKE NO RESPONIBILITY IF IT SETS ON FIRE! BE CAUTIOUS TO BEGIN WITH. IF THE AVAILABLE FREQUENCIES I DETAIL ARE NOT IN YOUR KERNEL, USE YOUR COMMON SENSE AND APPLY SIMILAR ONES! Ok? Right, ready to blow your phone up…? Just kidding….! Maybe….
Before you import the profiles, make sure you disable/archive/uninstall SetCPU or any other similar applications or scripts that could take precedent over the CPU control.
You’ll also need a couple of tools to see/hear your progress at a glance/listen:
A widget that shows CPU frequency, with regular refresh intervals would be handy. (If you don’t have one, I suggest you use Process Monitor available for free on the market here . The widget refreshes every 5 seconds from the home-screen).
As they’ll be some ‘screen-off’ states, it's very useful to have a speech engine so you can be told what’s happening without having to turn the screen on and therefore changing the state! (I use Pico TTS)
The application CPU Spy can be helpful to show you how these profiles combined with the Data Sync profiles will increase the amount of time your device will be spending in 'deep-sleep' and at lower frequencies. Thanks leftAlone for pointing this app out.
In Tasker, the main triggers for the CPU controls are as follows:
Display Off
Display On
Battery Low
Battery Hot
Phone Charging
In call (added in V2)
End Call (added in V2)
Initial Boot (added in V2)
Application Launched (added in V2)
In my set-up, these triggers become intertwined as there is often more than one active state to consider. Here we go....
READ THE REST OF THIS POST, BUT INSTALL WITH INSTRUCTIONS FROM POST TWO!
The speech profile (CPU-SayState) is the first one to download – it’s set up to tell you every 5 minutes (in very clear English), your frequency and governor. Not only will this confirm that your screen-off state is working correctly by just listening, but when you are performing other routine tasks, it will alert you if for some reason you find yourself overclocking/underclocking when you don’t want to be and you'll know something is wrong (the alternative to this is good old fashioned log files).
Next, CPU-BatteryHot. It's stand alone. You’ll see that the ‘Event’ is simply ‘Battery Overheating’. If this event occurs, then the governor is set to conservative and the frequencies to 245 and 422,400. Let’s be honest, if you do have an overheating battery, you’re more likely to panic and put the phone in the fridge rather than rely on this profile to resolve it, but it’s a simple start and provides a useful notification should this ever occur.
Next, CPU-DisplayOff. This is a good chance to save some battery life. The event is ‘screen off’ and the task sets a tiny vibrate notification so you’ll know it’s applied whilst the screen is off. An icon will be present in the status bar when you turn the screen back on. Conservative governor and frequency of 245 and 384. You of course should tweak these to whatever you wish - that's the point of this! The other tasks within the profile are removing the notification of other CPU profiles that may have been active prior to the screen turning off.
Next, let’s set up CPU-BatteryLow. It’s relatively stand alone again, triggered by an event of the ‘battery level’ being less than 25%. Conservative governor, with frequencies of 245 and 499,200 with an added IF statement at the bottom confirming the battery level. A popup on the screen will tell you the battery is low, which will go away on its own or can be pressed to dismiss. All other notifications of previous states are cancelled and finally a ‘stop’ is applied IFthe battery goes above 35%. At this point a task is performed that matches the governor and frequency of what will be your ‘regular ***’ CPU settings (again, these should be whatever you wish). This will end once the screen is turned off so the profile returns to CPU-DisplayOff.
Next, CPU-ChargingAny. Triggered by the 'power' state, the first task checks the battery level being above 50%. If it isn’t, an interactive governor is applied (to concentrate on charging), if it is, a performance governor is applied pushing the frequency up to 1075200. A status bar notification/icon and a vibrate pattern alert you that you are overclocking. Other notifications are killed.
Now we have to look at cancelling the overclocking once the phone is no longer charging/on external power. This isn’t totally straight forward, as the preferable states (inverted) of ‘no usb connected’ or ‘battery not charging’ relate to most of the time you use your phone.
The answer is to use an ‘exit task’, which will activate once the current state no longer applies e.g. the charge is removed. At this point, we need to check the current state of the phone, by applying tasks in order of their priority. The first task checks if the screen is off (therefore assuming the phone is no longer being used). If it is, it applies the DisplayOff profile. Secondly, if the battery level is now greater than 25%, it applies the DisplayOn profile (shown below). Finally (assuming the other two tasks states were not true), it applies the BatteryLow profile. The current task is instructed to ‘stop’ once a true state is found.
Finally, CPU-DisplayOn. The event is of course ‘display on’ and it applies the governor and frequencies that you would consider your ‘regular profile***’ for your normal phone usage. For me this is interactive with frequencies of 245 and 998,400. It of course first checks that the battery is not less than 25%, otherwise the BatteryLow profile would have already been activated and should be left to do so. A status notification and the killing of existing notifications is included at the end.
You’ll need to create a manual ‘regular profile’ (mine is called CPU-InteractiveManual in the .zip folder) that you can leave unchecked. This is named to match the *** above. It’s also there in case circumstances require you deactivate all of the other profiles and just run your regular profile (because you want to).
Very finally (!), I have a manual MaxOverclock profile, which I activate when I’m going to be using certain applications – A ROM Emulator for example.
Added in Version 2
CPU-DeviceBoot. I noticed that the Kernel I'm using boots as standard using a conservative governor (this surprised me a little) and overclocking to max frequency (I assume to help boot speed). This profile waits 30 seconds on initial boot and then checks the phone state before applying the correct profile from above.
CPU-DuringCall. During a call, my proximity sensor turns the screen on and off. When inputting numbers on a call (Voicemail for example), this caused the CPU-DisplayOff and CPU-DisplayOn profiles to be constantly flicking on and off unnecessarily. This profile deactivates all CPU profiles until the call is finished.
CPU-EndCall. Once the call is finished, the profiles are activated once again.
An obvious way (so obvious I previously didn't include it) to preserve battery life is to set individual CPU profiles for individual applications. Tweaking of these if you suffer lag, will help you find the minimal settings for each application.
STEP-THROUGH INSTRUCTIONS
With Tasker currently ristricting the import of CPU actions, I've had to strip them out of the profiles, meaning you have to add them in manually for the time being. Shouldn't take too long... Follow these instructions:
Download the latest 'Tasker CPU Profiles STEP-THROUGH.zip' and Unzip the profiles into sdcard/Tasker/profiles - Import them individually from the menu options. There should be 11:
CPU_BatteryHot
CPU_BattertLow
CPU_ChargingAny
CPU_DeviceBoot
CPU_DisplayOff
CPU_DisplayOn
CPU_DuringCall
CPU_EndCall
CPU_InteractiveManual
CPU_MaxManual
CPU-SayState
There is one additional stand-alone task:
MTVar
Ensure they remain unchecked until we've added all of the CPU activities below.
Before applying your custom CPU profiles, it would be highly recommended that you observe your current kernel's/ROM's/device's behaviour using home-screen widgets and the speech task included. My device (Desire), has custom kernels that use different governors to get the best performance out of the device. Please understand which governor(s) your kernel dev has focused on and if the voltage and/or governor(s) are changed in certain states. This will be well documented in your Kernel thread.
Overclocking
Please be more than aware that overclocking your device is not without its risks. Within the profiles Overclocking will occur only when the screen is on, the device is on charge and the battery is above 50% to ensure this is intentional. Should your screen go off, you will have to manually restart overclocking by unplugging and replugging the charger. Using a 'Performance' governor, will increase the CPU frequency to the maximum available and remain at that level. This is unecessary unless you are using a particularly high resource application such as a ROM emulator. Using an alternative governor that allows maximum frequency when required, but does not remain there when not, should be considered.
Instructions
The CPU settings have been replaced by actions entitled 'Type'. The text says 'Insert Frequency and Governor here'. In addition, they may be instructions to tick the 'IF' statement and add the values included in the text. Remove the 'Type' entries as you go, replacing them with the following suggested entries:
(CPU action entries are contained under 'Misc'
Select Edit
Press +
Select Misc
CPU)
Tap CPU-DisplayOn
Tap on CPUDispOn - Replace action #6 | Interactive | 128,000 | 998,400
Tap CPU-DisplayOff
Tap on CPUDispOff - Replace action #7 | Conservative | 128,000 | 245,000
Tap CPU-BatteryLow
Tap on CPUBatLow - Replace action #2 | Conservative | 128,000 | 998,400
Tap CPU-ChargingAny
Tap on CPUCharg - Replace action #2 | Interactive | 128,000 | 998,400
Replace action #3 | Performance | 128,000 | 1,075,200
Tap CPU-BatteryHot
Tap on CPUBatHot - Replace action #1 | Conservative | 128,000 | 422,400
Tap CPU-InteractiveManual
Tap on CPUManual - Replace action #1 | Interactive | 998,400 | 128,000
Tap CPU-MaxManual
Tap on CPUMaxMan - Replace #1 | Performance | 128,000 | 1,075,200
----------------------------------------------------------------------
Enable all APART FROM CPU-MaxManual and CPU-InteractiveManual, click 'On', then apply and turn the screen off and on and you should be up and running!
I assume you'll need to add your own icons in to each of the notifications.
-----------------------------------------------------------------------
Minimalistic Text Widget
Also included in the tasks and the V5 download is a profile for Minimalistic Text showing the Tasker variables all of my profiles use. Drag it into the Minimalistic Text folder on the SD card and it will be there in the preference manager. It you don't use all of my other profiles (why the hell not?!) you can delete the entries that are not applicable to you. My other profiles are in my signature btw. I've no idea where my signature is though... Not using Minimalistic Text?? It's a great low resource home-screen widget with Tasker integration. Check out the XDA thread here
I DON'T WISH TO USE THE MINIMALISTIC TEXT PLUGIN!
Then delete the following 'Perform Task MTVar' entries:
CPUDispOn - Action #9
CPUDispOff - Action #14
CPUCharge - Action #10
CPUBatLow - Action #8
CPUEndCall - Action #2
CPUBatHot - Action #6
CPUManual - Action #5
CPUMaxMan - Action #5
Conclusion
I’ve never used so much battery working these out!! It may well be that the amount of tasks, or the way they are structured, actually uses more battery life than controlling the CPU could save. I’ll be running some tests over the coming days to monitor it. If that does prove to be the case, I'll still be glad I’ve done this and learnt more about this fantastic application and look forward to it making me even more lazy.
Let me know your feedback please folks, inconsistencies, errors, I’m all ears and feel free to use the 'thanks meter'
harmohn said:
Battery life:
Without brandall's profiles: ~9hrs
With brandall's profiles: ~16hrs!
Click to expand...
Click to collapse
torsrex said:
my batterylife has GREATLY improved!
Without tasker: 10h 21% left, with tasker: 15h 67% left..!
Click to expand...
Click to collapse
MadeUpPost said:
Since using your profiles, I haven't had to charge my battery in 23 days and I'm having much better sex with my wife! Thanks!
Click to expand...
Click to collapse
FAQ
Q) I'm getting missing plug-in errors on V5? What do I do?
A) Read the bottom of post #2 and delete the Minimalistic Text actions if you do not wish to use it.
Q) Which profiles do I leave unticked and ticked again??
A) See this post
Q) I get a CPU Action Not Available error - why?!?
A) See the bottom of this page (thanks wanfauzan)
Q) Why doesn't Overclocking start again when the display is turned on and the phone is on charge?
A) Best solution see here. Credit Matrix72
Q) The icons you use are rubbish. How do I use my own?
A) See this post
Q) I have many other Tasker questions, can I post them here??
A) To avoid clutter, probably best to use this official Google group
Q) My phone is sluggish when the 'battery low' profile is active.
A) Be cautious, but adjust the frequencies and maybe governor until you find the perfect settings for your phone.
Change Log
Code:
[B][U]V2[/U][/B]
Added [B]CPU-DuringCall[/B] profile to V2 .zip
Added [B]CPU-EndCall[/B] profilie to V2 .zip
Added [B]CPU-DeviceBoot[/B] profile to V2.zip
Changed how [B]CPU-DisplayOn[/B] behaves when battery level low
Changed how [B]CPU-ChargeAny[/B] behaves when battery is less than 50%. Also added sound effect and matching vibrate pattern because I'm childish.
Added wait task to [B]CPU-BatteryLow[/B] until charge reaches 35%
Added [B]CPU-Navigation[/B] example profile to V2 .zip
Changed how cancelled notifications are handled for aesthetic reasons.
[B][U]V2.1[/U][/B]
Added missing IF statement to vibrate pattern of 'Overclocking' on [B]CPU-ChargeAny[/B]
[B][U]V2.2[/U][/B]
Changed collision handling of [B]CPU-BatteryLow[/B] to consider wait task
[B][U]V3[/U][/B]
Updated [B]CPU-DuringCall[/B] to create an 'in call' variable ([B]%INCALL[/B]), that can be used in other tasks.
Updated [B]CPU-EndCall[/B] to create an 'in call' variable ([B]%INCALL[/B]), that can be used in other tasks.
Changed notification handling to include specific titles, so not to cancel notifications of other Tasker profiles.
Removed Overclocking Sound and chilled the vibrate pattern.
[B][U]V4[/U][/B]
The below update [COLOR="Red"]*REMOVED AS IN V5*[/COLOR] prevents the quick screen off/screen on changes between [B]CPU-DisplayOff[/B] and [B]CPU-DisplayOn[/B] which can cause lag and echo errors. This was a headache to resolve due to too many reasons to list, but I've resolved it by adding a 5 second wait before the display off CPU settings are applied - if within that 5 seconds you turn the screen back on, the display off settings will not apply, consequently neither will the display on settings reapply. Someone needs to donate me some paracetamol...
It's achieved with an additional variable [B]%CPUSS[/B] (CPU sleep state) which is set to a value of 1 within the 5 second wait and a value of 2 after (once the CPU screen off settings have applied). This way, the CPU display on settings know whether to activate, or they remain active and therefore don't reapply....
[B][U]V5[/U][/B]
* So many I've forgotten them all.... Oops!
Bugs
All totally fixed in V5 (I hope).
Feature Requests
Consider states for 'smartass' governor.
Thanks
torsrex - Risking device and limb testing
-----------------------------------------------------------------------------------------------------
Due to the amount of changes, there is no 'step-through' update for users of the lower versions. Delete the profiles you have and it's a lightening quick addition of the CPU entries from post #2!
------------------------------------------------------------------------------------------------------
The thanks meter lets me know I'm appreciated!
I've used a lot of battery working out similar profiles myself
Will have to check yours out when I get home. Having voice overs for frequency and governor is a good addition!
I used CPU control with tasker and since then I uninstalled SetCPU that was a great soft but Tasker give me so much freq control for each application.
Example Book reader don't need the full juice and you can set automaticaly a low frequency.
Tasker is a great tool.
harmohn said:
I've used a lot of battery working out similar profiles myself
Will have to check yours out when I get home. Having voice overs for frequency and governor is a good addition!
Click to expand...
Click to collapse
Since I've stopped playing around quite so much, my battery life does seem to have improved! Could be just wishful thinking though...
enotar said:
I used CPU control with tasker and since then I uninstalled SetCPU that was a great soft but Tasker give me so much freq control for each application.
Example Book reader don't need the full juice and you can set automaticaly a low frequency.
Tasker is a great tool.
Click to expand...
Click to collapse
I've added an example of setting the CPU profiles for individual applications just in case.
Let me know your feedback! I assume no news is good news!? V2 updated in change log.
I get error trying to import any of your profiles, I'm I doing something wrong??
goz5000 said:
I get error trying to import any of you profiles, I'm I doing something wrong??
Click to expand...
Click to collapse
What is the error? I'll start with the obvious:
Have you checked you're running the latest version of Tasker? Mine is 1.0.20u3m
Have you unzipped the files into sdcard/Tasker/profiles ?
import failed, task contains actions unsuitable for import.
I got cpu end call, cpu device boot, and cpu during call to import but the others will not.
I'm using the vork kernel on CM7
goz5000 said:
import failed, task contains actions unsuitable for import.
I got cpu end call, cpu device boot, and cpu during call to import but the others will not.
I'm using the vork kernel on CM7
Click to expand...
Click to collapse
You're absolutely right - I just tried to import them myself and got the same result! Ok... I'll find out what's causing the problem...
Wow, I don't know much (anything) about the app, but I'm surprised you're allowed the level of control over the OS from userland like this without root privileges.
Syndacate said:
Wow, I don't know much (anything) about the app, but I'm surprised you're allowed the level of control over the OS from userland like this without root privileges.
Click to expand...
Click to collapse
The CPU controls are only for rooted devices unfortunately. The are many other customisations within Tasker that don't require root though. It's worth a free trial
brandall said:
The CPU controls are only for rooted devices unfortunately. The are many other customisations within Tasker that don't require root though. It's worth a free trial
Click to expand...
Click to collapse
Ah, that makes sense. I didn't catch the 'it needs to be rooted' part when I read the OP.
Syndacate said:
Ah, that makes sense. I didn't catch the 'it needs to be rooted' part when I read the OP.
Click to expand...
Click to collapse
I'll add it in, as I don't want it to be misleading...
Thanks.
goz5000 said:
import failed, task contains actions unsuitable for import.
I got cpu end call, cpu device boot, and cpu during call to import but the others will not.
I'm using the vork kernel on CM7
Click to expand...
Click to collapse
Tasker didn't allow the import of the CPU actions. For now, a step-through guide is added to post two to get these working. Please download the new .zip file.
Your feedback would be appreciated.
Adjust the following profiles as follows:
Tap CPU-DisplayOn
Tap on INT DISP ON
Select Edit
Press +
Select Misc
CPU
interactive
245000
998400
Tick IF
Click on lable icon, select Battery Level
Click on '-' select Maths:Greater Than
Enter 25 in box
Done
Drag to position 3
Done
Tap CPU-DisplayOff
Tap on CPU CON 384/245
Select Edit
Press +
Select Misc
CPU
conservative
245000
384000
Done
Drag to position 1
Done
Tap CPU-BatteryLow
Tap on CPU CON 254/499
Select Edit
Press +
Select Misc
CPU
conservative
245000
499200
If
Click on lable icon, select Battery Level
Click on '-' select Maths:Less Than
Enter 25 in box
Done
Drag to position 1
Click on tools icon - ensure Collision Handling is set to 'Abort Existing Task'
Done
Tap CPU-ChargingAny
Tap on CPU PER 998
Select Edit
Press +
Select Misc
CPU
interactive
245000
998400
Tick IF
Click on lable icon, select Battery Level
Click on '-' select Maths:Less Than
Enter 50 in box
Done
Drag to position 1
Press +
Select Misc
CPU
performance
245000
1075200
If
Click on lable icon, select Battery Level
Click on '-' select Maths:Greater Than
Enter 50 in box
Done
Drag to position 2
Ensure the Carstart.wav (included in the .zip) is selected (if you want it) under 'Music Play' - Otherwise just delete the entry.
Done
Tap CPU-BatteryHot
Tap on CPU CON 422/245
Select Edit
Press +
Select Misc
CPU
conservative
245000
422400
Done
Drag to position 1
Done
Tap CPU-InteractiveManual
Tap on CPU INT 245/998
Select Edit
Press +
Select Misc
CPU
interactive
245000
998400
Done
Drag to position 1
Done
Tap CPU-MaxManual
Tap on CPU-MAX
Select Edit
Press +
Select Misc
CPU
performance
245000
1075200
Done
Drag to position 1
Done
Tap CPU-Navigation
Tap on CPU-NAV 245 998
Select Edit
Press +
Select Misc
CPU
interactive
245000
998400
Done
Drag to position 1
Done
Tap on CPU INT 245/998
Select Edit
Press +
Select Misc
CPU
interactive
245000
998400
Done
Drag to position 1
Done
So after I do the above...do I just enable CPU-MaxManual and CPU-InteractiveManual...or all.
Action unavailable
RESOLVED. found the user guide at the bottom of this page
http://tasker.dinglisch.net/userguide/en/cpu.html
hello,
I can't set the CPU setting. Tasker said, that action is unavailable on this device. I am using HTC Magic 32b rooted with this rom [ROM]Enomther's TheOfficial D/S - v2.14.2 - 12/28/2010
http://forum.xda-developers.com/showthread.php?t=538456
What could be the problem?
Thanks
brandall said:
Tap CPU-Navigation
Tap on CPU-NAV 245 998
Select Edit
Press +
Select Misc
CPU
interactive
245000
998400
Done
Drag to position 1
Done
Tap on CPU INT 245/998
Select Edit
Press +
Select Misc
CPU
interactive
245000
998400
Done
Drag to position 1
Done
----------------------------------------------------------------------
Enable all APART FROM CPU-MaxManual and CPU-InteractiveManual, click 'On', then apply and turn the screen off and on and you should be up and running!
I assume you'll need to add your own icons in to each of the notifications.
-----------------------------------------------------------------------
Click to expand...
Click to collapse
For the last step, the variables for CPU INT 245/998 are already keyed in before.
Thanks for the tutorials. I think I'll simplify it for my tastes, but this was a very helpful place to start. Looking forward to seeing how your performance/battery pans out.
Regarding the default setup:
Charging + turning display back on + >50% battery: you go back into "CPU interactive" when I would expect to go back into "Overclocking" since it is still plugged in.

[TUT] The Ultimate Noob/Beginners Guide to Tasker

My motivation for writing this thread is seeing the sometimes negative feedback on the Market about Tasker and the lack of simple beginner documentation to get users up and running.
I’m a massive fan of the application as you may already know, but once I too was thrown in the deep end as a noob, being pointed only to the technical documentation and the rather lacking and out-of-date step-throughs on the Tasker Wiki. There was too much head-scratching involved and it’s unsurprising that some users will give up before they’ve even started.
The dev of Tasker will hold his hands up to this, but he also has a very, very large list of things to do, that more seasoned Tasker users would like him to focus on, rather than spending his time writing a much needed how-to-guide
So, over the coming months I will gradually add to this thread with basic and useful profiles and explain them in as much detail as I possibly can in the hope that you will pick up on Tasker tips and tricks, which then may give you a step in the right direction to using this application to its full potential.
If you are already a regular Tasker user, please do get involved and volunteer to share and explain a profile that will help the beginners; as you once were. Collectively, it won’t take us long to demonstrate the basic building blocks that all profiles are built from. Your Tasker community needs you!
Let’s get started then!
New to Tasker? Download a free trial here
-----------------------------------------------------------------------
-----------------------------------------------------------------------
Index
The Concept of Building a Tasker Profile - by strictlyrude27
Finding Your Way Around Tasker by neo1691
Using Tasker for your SMS Notification Management by brandall
Creating Useful Variables | SPLITS | SETS | FLASH | LISTS | CLEARING & MORE! by brandall
Using Tasker with the Minimalistic Text Plugin by brandall
Variable Split Demonstration by strictlyrude27
Your First Speaking Clock by Sokudoningyou
Using Tasker for Media Control by Deejaylobo
Basic Linux/Shell Commands to Create a Technical Battery Widget by brandall
Advanced Flow Control and IF concepts by strictlyrude27
BIG thanks to all those that have contributed so far. Please don't forget to use the thanks meter on their individual posts, it'll keep more helpful tutorials coming
Using Tasker for your SMS Notification Management
What you will learn
Basic pattern matching
IF actions
Profile Aim
Play individual notification sounds for chosen contacts.
Simple Preparation
The included icons in Tasker are pretty basic. Head to this link on the Wiki and download the ones of your choice, unzipping them into the folder sdcard/Tasker/.icn. The BlueOrbHD are my personal favourite…
Make sure you have your notification sounds saved in a folder sdcard/Notifications. If you are short of notification sounds, check out this link for a download. Place them in the notifications folder on the sdcard.
Profile and Task Explanation
As we are going to get Tasker handle our notification sounds, we need to disable them being handled by Android. From the home screen, select menu/settings/Sound/Notification ringtone and select ‘Silent’. If you didn’t do this, the standard notification sound would play as well as the tone we are to set up in Tasker.
In Tasker, select ‘New’ and then ‘Event’. Under ‘UI’ will be the option of ‘Notification’, select that. Leave the ‘Priority’ as normal and do not select an ‘Owner Application’. Under the ‘Title’ field, type ‘*Voicemail*’ and select done. You may then get a pop-up requesting that Tasker be given permission for ‘Accessibility’ – tick the box as we want to give Tasker permission to do everything automatically!
To clarify, we need Tasker to recognise that a new voicemail has been received and play a notification sound. There is currently no specific option for ‘Voicemail Received’ built-in to Tasker, so we are simply going to look for the word ‘Voicemail’ appearing in the notification bar and the profile will be triggered from there. The ‘*’ you put at the beginning and end is a ‘wild-card’ function, so that if for example the notification reads ‘You have a new Voicemail to listen to’ the text before and after the word ‘Voicemail’ will not prevent the context from triggering. Without the ‘*’ ONLY the word ‘Voicemail’ on its own will trigger the profile.
Once you’ve selected done, you will be prompted to select an existing Task from the list or select ‘New Task’ from the top. Select ‘New Task’ and name it ‘VoicemailSound’. Once inside the task, click on the icon button and select a suitable one, then click on the + button, select ‘Tasker’ and then ‘Stop’ and then ‘Done’. Click ‘Done’ again inside the Task and then click ‘Apply’ in the main Tasker screen which will close Tasker.
Q) Why did you just exit out of Tasker?
A) All too often you can make a mistake when creating a profile/task or something can happen that doesn’t apply the changes you’ve made. Applying out of Tasker in this way will ensure that no matter what happens, your created context, task name and icon are saved. You only have to accidently hit ‘cancel’ out of a task that you’ve spent 30 minutes creating to see that NOTHING remains of it, including the triggering context! It's good practice to this as standard every time!
Load up Tasker again and select the ‘Tasks’ button. From the list select the previously created ‘VoicemailSound’. Click on the + and select ‘Media’. Select ‘Music Play’ and hit the magnifying glass. Navigate to the ‘Notifications folder’ you have (or have created in your preparation) and select the tone you want. Ignore ‘Start’, ‘Loop’ and ‘IF’ and select ‘Done’.
Back in the Task screen, you’ll have a ‘Stop’ action and then the ‘Music Play’ action. If you left the task like this, it would simply stop! So, click and hold on ‘Music Play’ and once it’s given a short vibrate, drag it above ‘Stop’ so it’s in position 1. Click on ‘Done’.
There you have it! Tasker will now play your selected notification sound when you have a new voicemail!
Q) But hold on… (<-- I’ve decided that is going to be my tagline), what happens if I’ve set my device to silent? Will it still play the sound?
A) YES. Tasker is God on your device and will ignore and override almost all inbuilt settings due to the permissions you give it.
So, we need to deal with that.
From the main Tasker screen, click on ‘Tasks’ and select ‘New Task’. Name it ‘TEST TEST TEST’, add in the ‘Stop’ action and give it an icon as detailed above and save all the way out of Tasker to make sure it is always there.
Go back in, select the task and click +, select ‘’Alert’ and ‘Flash’. In the ‘Text’ field, type %SILENT (it must be in capitals) and select ‘Done’. Drag it above the ‘Stop’ action and press the ‘Test’ button to run the task. A pop-up will appear on the screen saying either ‘off’, ‘on’ or ‘vibrate’. If you want, you can change your device to vibrate and confirm the inbuilt variable %SILENT registers the change by pressing ‘Test’ once again.
Exit out of TEST TEST TEST (you’ll be using that task again a lot when creating your own profiles!) and head back into VoicemailSound. Click and hold on the ‘Stop’ action in position number 2 and drag it back up to position 1. Click on it so it opens and tick the ‘IF’ check box. When an IF statement is present in any action, this action will ONLY run if the IF statement is ‘true’. IF it isn’t true, Tasker will ignore the action and continue on to the next one.
Click on the label icon which will bring up a list of Tasker’s inbuilt variables (and any you have already created that are presently populated) and scroll down to click on ‘Silent Mode’. %SILENT will be populated in the first box. Next to it, click on the ‘~’ icon. This is the ‘condition’ of which you are comparing to %SILENT. As we are looking for the text of ‘on’, we need to select ‘Matches’ and then manually type ‘on’ (in lower case!) in the end box. Select done and you’ll be returned to the task screen showing that the ‘Stop’ action now has an IF action showing in it.
To recap, as the task currently stands, it will start on the context of a notification appearing in the notification bar with the word ‘Voicemail’ somewhere in it. It will then trigger the task VoicemailSound which will first check to see if the device is in silent mode. IF it is, it will simply stop. IF it isn’t, it will carry on to action number 2 and play the notification sound! Sorted!
Q) But hold on… What if the device is set to vibrate only? Will it still play the sound?
A) A good question! YES, it will… We need to deal with that next.
You probably wish to have a vibrate alert when you receive a voicemail anyway, so let’s assume you do for now and continue. Go back into VoicemailSound and click on +, select ‘Alert’ and ‘Vibrate Pattern’. Click on the question mark at the top and read the notes about this action, which will explain how it works with a wait time and a vibrate time in milliseconds so you can personalise it to your hearts content. To keep it simple for now, enter ‘200,200,200,200’ in the ‘Pattern’ field, which will equate to two short vibrates with a small pause between them.
Select ‘Done’ and back in the task you will now have Stop, Music play and Vibrate pattern in that order. Let us ponder for a moment. First we need to make sure that the device is not on silent. That is done in action 1 and it will stop IF it is – sorted. Next we need to make sure that the device isn’t only set to vibrate, BUT, whether it is or not, the ‘Vibrate Pattern’ we’ve just created is good to go! So, drag it to position number 2! All we have left to do now is STOP the ‘Music Play’ action IF the phone is in vibrate only mode… Did the bold clues help you!? I hope so… There are actually a number of ways we could do this. We could tick the IF statement in the ‘Music Play’ action and set it so %SILENT ‘does not Match’ ‘vibrate’, but let’s keep it simple and just add another ‘Stop’ action before music play, with the IF statement ticked and %SILENT ‘matches’ ‘vibrate’ (in lower case). Did you add that in ok and drag it to the right position? Good.. (Sorry if I sound patronising, just trying to leave no stone unturned).
Ok, so there you have it, Tasker is going to consider if the phone is set to silent before it vibrates and consider if it’s set to only vibrate before it plays the notification sound. For good measure, I always add in another ‘Stop’ action at the end of every task I create. Sometimes you’ll have testing actions such as ‘variable flash’ below this stop that you can drag up (to use) and back down (below the stop) when you need to.
Let’s hurry on to the personalised SMS sounds!
In the main Tasker screen, select ‘New’ and then ‘Event’. Under ‘Phone’ will be the option of ‘Received Text’, select that.
Under ‘Type’ leave it as ‘Any’ so it includes SMS and MMS. Click the magnifying glass next to the ‘Sender’ field and select ‘A Single Contact’. Scroll down, select the mobile number of the contact you wish to have a personalised notification for.
But hold on…. Before you select ‘Done’ to continue, click on the magnifying glass again and select another contact. After you have selected it, you’ll notice that the two contact names are now listed and separated by a ‘/’ with no spaces. This is your first introduction to pattern matching and lets Tasker know that the profile should be activated by the receipt of a text from either of these contacts. Once we’ve done the basics of this profile, you’ll need to go back and add in every contact you want to have a personalised tone for.
After you’ve clicked ‘Done’, select ‘New Task’ and name it ‘TXT-Custom’. As suggested above, select a suitable icon, add in the quick stop action and save out before returning to the task again.
Learning from the voicemail task above, we know that we need to consider the states of vibrate and silent, so add those in first. A ‘Stop’ in action #1 IF %SILENT matches on and a universal vibrate pattern in postion #2. Action #3 will be another stop action IF %SILENT matches vibrate and now it’s time to start creating our individual SMS sounds. Click on + and select Music Play. Using the magnifying glass, select the SMS tone you want for a certain contact. Check the IF button and click on the label icon. Scroll down the variables until you see ‘Text From’. Clicking on it, you’ll see that the first box is now populated with the inbuilt variable %SMSRN (which stands for SMS received name). Select matches and then manually type in the name of the contact you wish this tone to apply to. You of course have to make sure it exactly matches the format it appeared in when you originally selected the contact using the magnifying glass in the triggering context. Select ‘Done’. Repeat this process (creating a new action every time) for each individual contact you wish to have a personalised SMS sound for. It would be a good idea to save out of the task and out of Tasker every few minutes to ensure that if you do accidently press ‘cancel’ or your phone freezes, your hard work won’t be lost!
Make sure that every personalised entry you create, the contact name appears in the original triggering profile separated by a ‘/’. Sorted!
Q) But hold on… What happens if I get a text from a contact that isn’t listed? Android has been told to be silent, so will no sound play at all for them?
A) YES! Well spotted, we need another profile to account for receiving a text from anyone not in the personalised list.
Create another new profile with a context of a new text message received (new/event/phone/received text). This time, leave all the fields blank and click done. Select a new task and name it SMS-Default giving it an icon and a stop action for good practice. Return back into the task and add in the actions as you’ve done before.
#1) Stop IF %SILENT matches on
#2) Vibrate pattern
#3) Stop IF %SILENT matches vibrate
#4) Music Play (which will be your standard notification for all normal text messages).
Sorted!
Q) But hold on… What’s to stop that notification sound playing if I get a text message from a contact that has a custom sound? Will Tasker not try and play both?
A) YES! Good thinking… We need to set up an ‘exclude list’!
The quickest way to do this is to wait until you’ve finished your custom notification task. Once that’s complete, the context will have all of the contacts listed and separated by a ‘/’ (in the triggering profile). Click on the field and copy the contents to use in a moment.
In the custom SMS task, we’ve already set a vibrate pattern and a custom tone, so we therefore need to STOP Tasker from doing either of these in the default task. Simply add in another STOP task in action #2 (so it’s before vibrate) and tick the IF checkbox. Using the variable %SMSRN matches, paste in the ‘/’ separated names of the contacts and select done!
And now you really are done… Tasker is intelligently managing your personalised SMS notifications, always considering your system sound settings.
Extras
Q) But hold on… I always want to have a vibrate and notification sound if my wife texts. It might be something important…
A) That’s not a problem.
Assuming you’ve set up a custom notification for her in the task TXT-Custom, you can simply drag her individual Music Play action to position #1, so the phone’s state of silent or vibrate won’t be considered. If you want the device to vibrate too, simply add another vibrate pattern action to position #1 or #2 (as long as it’s above the first stop action) and make sure it has an IF statement so it will only vibrate IF %SMSRN matches your wife’s contact.
I hope that helped folks!? If it did, the thanks meter is the only way I'll know!
Creating Useful Variables | SPLITS | SETS | FLASH | LISTS | CLEARING & MORE!
What you will learn
Variable Splits
Variable Sets
Variable List
Variable Clear (Good housekeeping)
Flash Variables
Writing to a text file
Exit Tasks
The Meaning of Life
Overview
When creating your own profiles and tasks, there will be conditions that you will use over and over again. Checking that the device isn’t on silent before playing any notifications would be a good example. Another may be location based, such that you want your device automatically on silent IF you are at work.
Profile Aim
I will walk you through how to set up your own most commonly used variables so you can see how they are created and ways in which you can use them.
Simple Preparation
Make yourself a cup of tea.
Profile and Task Explanation
Let’s start out with a very basic context of ‘being on the phone’. This will prove useful to you in many future profiles such as ones that toggle your data connection. For example, if you have a battery saving profile that is triggered when your battery level drops below 25% and its first action is to switch the phone from 3g preferred to 2g only, you really don’t want this talking place if you are on the phone at the time – it will cut you off! There is no built in variable to use within an IF statement for ‘phone in use’, but there is a context we can use, so let’s create a variable using that.
From the main Tasker screen, select ‘New’ and ‘Event’. Select ‘Phone’ and ‘Phone Offhook’. Press the ‘?’ at the top of the screen to read a description of when this context will apply – For all intents and purposes; it’s when you are on the phone.
Leave the priority as normal and select ‘Done’. The Task Selection list will be displayed, select ‘New Task’ from the top, name it ‘InCall’, give it a relevant icon, add a STOP entry (+, Tasker, Stop) and select ‘Done’ and ‘apply’ out of Tasker to ensure that your work so far is saved if anything goes wrong.
Go back into Tasker and select ‘Tasks’ and from the list select your created task ‘InCall’. Now, in the future it may be that you wish Tasker to perform some actions when you are on the phone, but for now, all we are interested in is creating a variable we can use when the condition of ‘being on the phone’ is true!
Click the + and select ‘Variable’ and ‘Variable Set’. In the name field we want to call it something memorable, so let’s go for %INCALL (always must be capitals). So, we know this task we are creating will be triggered when a phone call is taking place, so in the ‘To’ field put the number ‘2’. Select ‘Done’ which will return you to the task screen. Click on + and select ‘Alert’, ‘Flash’ and in the ‘Text’ field type %INCALL. Press ‘Done’.
In the task, press and hold the original ‘Stop’ action you created and drag it down to position number 3. Your task should then be:
#1 Variable Set (with the description showing)
#2 Flash (with %INCALL showing)
#3 Stop
Press the ‘Test’ button which will simulate the task being triggered (you are on the phone) and on the screen should appear the number ‘2’. Every time you now are on the phone, Tasker will set the variable you have just created %INCALL to a value of 2.
Let’s imagine in another task you are creating, you’ve just selected an action to change the phone to 2g only. This would result in the radio turning off briefly and would end a call if you were on one. In that circumstance, you would use the variable we’ve just created to only switch to 2g IF %INCALL ‘does not = 2’. This way, if you were on the phone and %INCALL = 2, Tasker would skip that action. Sorted?
Q) But hold on… %INCALL has been set to 2 when I just pressed ‘Test’, will it automatically change from 2 when I finish the call?
A) Good question! NO! We need to do this ourselves…
From the main screen, click on ‘New’ and select ‘Event’. Click on ‘Phone’ and select ‘Phone Idle’ (read the ? if you want an explanation). Leave the ‘Priority’ as normal and select ‘Done’. Select ‘New Task’ when the selection list is displayed, name it CallEnd, select the same icon as InCall (to keep things tidy), add your Stop action and save out of Tasker to preserve what you’ve done.
Going back into the task CallEnd, we know we need to change the value of the variable we created %INCALL to something else other than ‘2’. Select +, Variable, Variable Set. In the name field put %INCALL and in the ‘To’ field put the number ‘1’. Press Done. As you did above, add in an Alert, Flash, %INCALL action and make sure the actions are in the same order as we did in the task InCall. Press the ‘Test’ button and you’ll see the number 1 flash up on the screen.
We now have the variable %INCALL to use whenever we need to consider the phone’s state and is ready to use in any IF statement to ensure an action will only take place IF %INCALL = 1 (I’m not on the phone). Sorted!
Q) But hold on… Why did you use the values 1 and 2? Why not 1 and 0 or another option?
A) I always avoid using zero when applying a value to a variable. The simple reason is that when you start creating more complex tasks, you may well wish to add %COMPLEX-TASK to %VERY-COMPLEX-TASK. Adding ‘zero’ to something will not make a change and therefore I always give my created variables a value of 1 or above.
There are other options such as setting %INCALL to 1 when we are in a call and then ‘Variable Clearing’ it when the call is ended. This would result in %INCALL having no value applied to it when no phone call was taking place. Tasker has the option to check for this in an IF statement – you can say IF %INCALL ‘is not set’. Conversely, there is an option to ask IF %INCALL ‘is set’. I prefer to always use a value; the reason being that a variable that hasn’t populated correctly will also contain nothing. At any point I can ‘Variable Flash’ any of my created variables and see that it has a value and know therefore it is working (it may be the wrong value of course – but at least you’ll know!).
Ok, let’s move on. Drag the ‘Flash’ actions below the ‘Stop’ action, as there’s no need for them to appear on the screen every time the phone is used and save back to the main screen. Let’s move on to something that works on the same basis, but is a little more complicated.
You may have read about using cell towers to trigger location based profiles, such as automatically sending your wife a text when you leave the locality of the office, IF the %TIME is greater than 5pm - but there are other ways you can let Tasker know where you are or aren’t.
The obvious choice would be the SSID (wireless name) of the wireless router you are connected to. We can easily set up our own variables so that %IM-AT-HOME is set to a value of 2 when Tasker becomes connected to the SSID of your home wireless BELKIN23456 (for example). The same can be done for other locations such as work. When it’s no longer connected, it sets %IM-AT-WORK back to 1.
Having such variables are useful within IF statements of other tasks. If you have a battery preserving profile that is set to turn off WiFi after a certain period, you may not want it to do this when you are near your charger at home. So, having an IF statement within the action of ‘set wireless off’ IF %IM-AT-HOME ‘does not = 2’ would stop the disconnection.
These variables are also useful for triggering other profiles, such as your work or home profile. My device is currently set up to sync every 30 minutes (using Tasker) and therefore within 30 minutes, Tasker will know if I am at home/work/parents/gym etc etc and can apply any specific actions/profiles accordingly.
Let’s say I’m at the gym. I always listen to music on my device when I’m there, so I don’t want any notifications coming through the headset and interrupting the playback or deafening me! I therefore want Tasker to put the phone to vibrate only. This is very easily done.
The triggering context will be Tasker spotting the variable %ATGYM (we will create shortly) has been set to a value of 2. Let’s set that up - Click on New and select Event. Select variable and variable set. In the Variable field, type %ATGYM and enter the value as 2. Click done and select New Task, naming it GymProfile, select an icon and add in a quick Stop action before saving and returning.
Back in the task GymProfile, click on + and select Audio and Silent Mode. Select vibrate and press Done. Drag the action up to position #1 and select Done. Job done!
Q) But hold on… When did it realise I was in the gym and change %ATGYM to = 2?
A) It didn’t! We need to create that profile now.
Now, this is where it’s going to start getting a little bit tricky, but I will explain it as simply as I can (apologies if I patronise). Unfortunately, the current version of Tasker does not have %SSID as an inbuilt variable. We therefore have to get this from somewhere else.
Create a new task and call it SSID, choose your icon and add a quick stop action in before exiting to preserve. Back in the task, we need to have a look at the data held inside another variable that contains the SSID. This variable is %WIFII (which stands for WiFi Information (I assume!)). You’ll need to be connected to a wireless network to be able to follow along with the next steps. If you’re not or can’t be right now, again I’ll try and explain the best I can.
There are a few ways to view the data stored in a variable. We used variable flash above, but as the name suggests, this doesn’t stay on the screen for long enough to study. We are going to write the data to a basic text file on the root of the SDcard. In the task SSID, press +, File, Write File. In the ‘File’ field, type SSID.txt and in the ‘Text’ field type %WIFII. Do not tick the ‘Append’ checkbox. Press done and drag this write file action into position #1 above the stop. Press Test. You’ll notice when you press ‘Test’ a button will appear that says ‘Kill All’. This will appear and disappear very quickly in a small task such as this, but if it remains, it may suggest you have done something wrong and the task has gone into a loop or is trying to resolve itself. The other alternative is that another profile/task is running, so don’t be too eager to press Kill until you’ve checked!
Assuming that worked without issue, in a file explorer navigate to the root of your storage card and locate the file we created SSID.txt. You have just learnt that if you try and write to a file that doesn’t already exist, Tasker will create it. The ‘Append’ tick box in the write file action gives you the option to overwrite the file if unticked, or add more data to the bottom of the existing file if it is ticked (appended). Open up the text file and you should see something like this:
>>>CONNECTION<<<
BELKIN45678
Mac: 00:1b(the remainder of your Mac address)
IP: 192(the remainder of your IP address)
Sig: 8
Spd: 54Mbps
Congratulations, you’ve just written your first data file using Tasker! In future, you can easily pull any data/RSS feed from the Internet under the option +, Net, HTTP GET using the ‘Output File’ field at the bottom.
Let’s carry on – So, we have the above data, but we only want the SSID out of it, which in this example is ‘BELKIN45678’. As usual, there is more than one way of doing this, but I want to show you variable splits, so that is how we shall proceed.
Back in the task SSID, we want to ‘split’ apart the data above that is held in %WIFII. It’s good practice to transfer this data to your own created variable to start with, for a few reasons that I won’t go into now! Let’s do that – hit +, variable and variable set. In the ‘Name’ field type %SSIDD which will standard for 'SSID data'. In the ‘To’ field, type %WIFII and press done. Drag this to position #1 and whilst you’re at it, drag the Write File action below the stop as we don’t need that again. What we’ve just told Tasker to do, is transfer any data that is held in %WIFII to %SSIDD. ‘Flashing %SSIDD would show you this if you wanted.
We have to decide where to ‘split’ the data in order to just leave us with the SSID we are after. When doing variable splits, it’s important to put as much information in the ‘split’ field as possible as this is how Tasker will dissect the data. For example, if we asked Tasker to split the data at the letter ‘S’ it will do so and create a number of split variables for each time it encounters the letter ‘S’ and create them in order in %SSIDD1, %SSIDD2, %SSIDD3 and so on and so forth for the number of times it encounters and splits at the letter ‘S’.
Looking at the example above, you would end up with a split at ‘Sig: 8’ which would populate one of the created variables (%SSIDD23 for example) as ‘ig: 8’ as after the ‘8’ it will encounter another ‘S’ at the start of ‘Spd’. So, let’s see where we want to split the data. Before the SSID, we have >>>CONNECTION<<< so, we’ll use that! Now we have to look at where we want the split to stop – after the SSID it lists the Mac address, so we’ll stop the split at ‘Mac:’. Let’s do it…
In the task SSID, hit +, Variable, Variable Split. First it asks for the name of the variable we want to dissect, so type %SSIDD (we transferred the data from %WIFII remember?). In the ‘Splitter field’ type ‘<<<’, leave the ‘Delete Base’ box unchecked and press done. Drag this action to position #2 under the original variable set. To see what the first split is going to do to %SSIDD, insert a +,variable, variable list action into position #3 (above stop). A variable list action will show on the screen ALL of the current user created variables that are populated. Your task should look like this:
#1 Variable Set %SSIDD to %WIFII
#2 Variable Split %SSIDD - Splitter <<<.
#3 Variable List
#4 Stop
Press Test.
For a short while on the screen the list of variables will show you that we now have %SSIDD’parts’.
NOTE: If the screen has just flashed up a load of variables that you have created in the past and not ‘cleared’ and you can’t see any %SSIDD# entries, you’ll need to clear these. You can either do this manually but using individual ‘variable clear’ actions and typing the names of all of the variables you see, or you can leave the ‘Name’ field blank in the variable clear action and it will clear ALL of your created variables. Be warned; If some of your existing profiles trigger from %A-VARIABLE ‘is not set’ then they will start!
The original %SSIDD remains and as we won’t need the full data set again, go into the variable split action and tick ‘Delete Base’ and press Test again. Doing that ‘cleared’ %SSIDD and you should see now that %SSIDD2 starts at your SSID with more data on the end and %SSIDD1 is the data before the split of ‘<<<’. Let’s insert a variable clear action for %SSIDD1 in position #3 (before we list) as we don’t need this. Pressing test again you’ll see that all that remains is %SSIDD2. As discussed above, let’s split that at ‘Mac:’ where our SSID ends. Insert that variable split into position #4, ticking ‘delete base’ as we won’t need the original. Your task should now look like this:
#1 Variable Set %SSIDD to %WIFII
#2 Variable Split %SSIDD - Splitter <<<. (with delete base ticked)
#3 Variable Clear - %SSIDD1
#4 Variable Split %SSIDD2 – Splitter Mac:
#5 Variable List
#6 Stop
Press Test.
Listed on the screen I hope you’ll see that %SSIDD21 now shows nothing but your SSID!? Job done! We’ll continue on to use that again in a moment, but first we need to do some housekeeping and clear up our mess to make sure there are no ‘variable parts’ that have been left - these can build up over time. Pressing test again, you’ll see that a variable %SSIDD22 was created – insert a variable clear action in position #5 to take care of that – Tidy files, tidy mind… The last thing to tidy up would be the fact that our SSID is stored in the variable %SSIDD21 – that’s hardly memorable is it…? So let’s transfer it to %SSID by doing a variable set ‘Name’ %SSID to %SSIDD21 and that only leaves us to variable clear %SSIDD21 as it’s no longer needed.
Your final task should look like this:
#1 Variable Set %SSIDD to %WIFII
#2 Variable Split %SSIDD - Splitter <<<. (with delete base ticked)
#3 Variable Clear - %SSIDD1
#4 Variable Split %SSIDD2 – Splitter Mac: (with delete base ticked)
#5 Variable Set %SSID to %SSIDD21
#6 Variable Clear %SSIDD21
#7 Stop
#8 Variable List
Action #8 below Stop, will never be ‘actioned’ but I tend to always leave such things there for testing purposes, so if ever something goes wrong, or you need to adapt a profile, your ‘testing actions’ are still there waiting to be dragged up and back into ‘action’!
So, let’s recap. By running the task SSID, we will extract the current SSID we are connected to. We can use this SSID to trigger location profiles.
Q) But hold on… What triggers this task? It’s great that it can get the SSID I’m connected to, but when does it start?
A) Well spotted! We need a context to trigger this.
In the main screen, click on New and State. Select WiFi Connected and leave all of the fields blank.
Q) But hold on… There’s a field there for SSID! Why did we just do all of the above if we can just stick in that box!? Do you actually know what you’re talking about?!
A) Well, that’s a little bit rude, but yes, honest, I do.
Admittedly, there are many different ways to get a desired result when setting up profiles and tasks in Tasker. The above was good (hopefully) for educational purposes, but the main reason that what we’ve done is useful, is because the extracted SSID (%SSID) can now be used in any IF statement in any action. Just because this particular context can identify an individual SSID, doesn’t mean that you can reference it elsewhere in Tasker… As a further example, the same can be said for mobile data – as a triggering context, there are 2g, 3g, 4g etc ‘connected to’ tick boxes, but no such specific conditions when looking at the inbuilt variables. I hope that made sense?
Where were we? Oh yes, so we’ve left all of the fields blank in the Wifi Connected context. Select done and select New Task naming it WIFIOC, which will stand for WiFi is on AND connected. To clarify again, this context triggers when WiFi is CONNECTED to a network – NOT when WiFi is ‘just’ switched on…
In the task we want to set variables depending on SSID. From the context above, we know that when this task triggers, WiFi must be connected to a preferred network – but which one? To complete this task, you’ll need the SSIDs of all of your preferred networks. With WiFi switched on, these will be detailed in the Android settings menu/settings/Wireless & networkds/Wi-Fi settings. We are going to use an IF statement for each one of these; the number depending on how many preferred networks you regularly connect to, or more importantly, which of these you may wish to trigger a profile….
We are going to create memorable variable names for each place such as %WIFIHOME, %WIFIWORK, where you connect to a wireless network. So, let’s assume you are connected to your home wireless which has the SSID of BELKIN45678. Select +, select variable and variable set ‘Name’ %WIFIHOME to ‘2’ and then tick the IF box – and using our created variable above %SSID ‘matches’ BELKIN45678 and select done. There! Tasker will now know that you are at home when %WIFIHOME is set to a value of 2! Sorted!
You need to repeat this individual action for every preferred SSID you want to use:
#1 Variable Set %WIFIHOME to 2 IF %SSID ‘matches’ XXXXXX
#2 Variable Set %WIFIWORK to 2 IF %SSID ‘matches’ XXXXXX
#3 Variable Set %WIFIGYM to 2 IF %SSID ‘matches’ XXXXXX
#4 Variable Set %WIFIBLAR-BLAR-BLAR to 2 IF %SSID ‘matches’ XXXXXX
Etc, etc…
In action #2 above you’ll see that %WIFIGYM has been set to 2 and this will trigger the profile we ran through way back when at the beginning… Although I think I called it %ATGYM back then, but hey, you know what I mean!
Q) But hold on…
A) Jesus, what now?
Q) This task was triggered by WiFi being connected but it doesn’t check the SSID, so how does it know which one to set to 2 IF it hasn’t checked?
A) Well spotted… Before Tasker can start deciding which %WIFI-BLAR it sets to a value of 2, it needs to extract the SSID (%SSID) from %WIFII – that was done in the task we created ‘SSID’
So, we need that to run before we ask Tasker to check IF the SSID matches any of our locations. As usual, there are a number of ways to do this. We could tag the above actions onto the end of the task SSID and get rid of WIFIOC completely, or alternatively, we could just run the task first…
In the task WIFIOC, select +, Tasker, Perform Task. Click on the magnifying glass and select the task SSID. Drag the slider along to increase the priority to a very important 9. Select done and drag this action up to position #1. This now means that every time WiFi is on and connected it will run the task WIFIOC which will immediately kick off the task SSID in action #1. Action #2 uses an IF statement involving the results from the task SSID and therefore it’s essential that it has run first prior to action #2. Giving it a priority 9 as we did, tells Tasker it is more important to run that task than continue with the current one, which will be set to 5 as standard (we haven’t changed it).
Now, I hold my hands up here and tell you that I don’t honestly know if this means that Tasker waits for SSID to finish before continuing with action #2 in WIFIOC. Just to be sure, let’s add something else into action #2. Select +,Tasker, Wait and drag the slider (or use the +) to 5 seconds. Drag this action up to position #2 directly after the perform task (SSID) action. However Tasker exactly handles the higher priority task, 5 seconds is more than enough for it to have extracted the SSID it is currently connected to and be ready to compare it to all of the IF statements from action #3 downwards!
WOW, I really have written loads… I hope you are still with me!? Let’s recap: The context triggers by WiFi being on and connected. That runs the task WIFIOC to determine your location by the SSID which is discovered in action #1 when we tell it to run the task SSID. Assuming that we are in the gym at the time, it’ll change %WIFIGYM to a value of 2 and the profile you set up which looks for this profile (sorry, I think I called the variable %ATGYM originally, but it’s easily changed!) being set to a value of 2, will trigger the task GymProfile!
Q) But hold on… this has set my device to silent, but what happens when I leave the gym? Will Tasker know and turn the ringer volume back on?
A) Nope! We need to deal with that…
When you set up a triggering context, you normally choose between an ‘event’ or a ‘state’. Generally speaking, an event trigger can be described as something that takes place in an instance; such as a ‘received text’. Although the text may remain unread and in the inbox, the instance of receiving it has passed and therefore so has the ‘event’. A ‘state’ may be different in that it continues to be active – a good example would be when the battery is ‘less than’ 25%. This is still the case at 24,23,22% etc etc and so the ‘state’ remains true. In this type of context, we can (usually) add something called an Exit Task, which is purposely triggered when the ‘state’ is no longer active.
I explain the above, as this is applicable to the trigger we used of WiFi being on and connected. The profile will remain active in Tasker until the WiFi is no longer connected to a preferred network (not OFF, just NOT CONNECTED remember?) and this is perfect for us to use, as if we are no longer connected to the gym wireless… we must have left the gym! See where I’m going with this?
In the main Tasker screen, click the visible task WIFIOC. This should bring up a menu list, one option of which will be to ‘add exit’. Select it and give the new task a name WIFINOC and icon etc as usual. The purpose of this task is to set any of the above %WIFIBLAR location variables back to 1 as we are no longer connected to ANY preferred network, so therefore cannot be in any of those locations (obviously yes, the connection could have gone down, but apart from that). So, add in all of the necessary variable set actions changing %WIFIGYM, %WIFIHOME etc etc to a value of 1. Job done.
Q) But hold on… Isn’t my device still on silent from the gym profile?
A) YES! But this guide is getting way too long, so I’ll wrap it up here by pointing you in the right direction.
When you leave the imaginary gym, let’s assume you want your phone to be in a ‘normal’ state, volume high, silly ringtone, brightness up, mobile data on etc etc – You need to create this ‘Normal’ task/profile yourself and have it triggered (Tasker/Perform Task) at the end of the above Exit Task. That normal profile will then take over whenever you are ‘between places’.
Finally, don’t forget you could perform the ‘normal’ task only IF certain conditions were true, like the day of the week or the time. Below that perform task you could have another one that tries to perform a weekend profile for example? If the conditions weren’t true for performing the ‘normal’ action then Tasker will ignore it and go to the next one….These changes in profiles from normal to gym to work etc will end up becoming more entwined as you increase the number of your profiles/tasks and the conditions that apply to them. They all should have a 1 for off and 2 for on and end up triggering a relevant other when their conditions no longer apply...
I fear I’m waffling…. and have somewhat gone around the houses, as you would normally start creating a masterpiece with a triggering context and go from there, but hey, my busy typing fingers decided differently...
Hope this has helped you? Any questions, please feel free to post and if you are feeling super knowledgable now, take a look at the Data and Sync tutorial in my signature which this is loosely based upon…
The thanks meter is the only way I know this was useful to you!
Using Tasker with Minimalistic Text
What you will Learn
How to pass variables to Minimalistic Text!
Overview
The user fl4r3 posted and asked for a tutorial on how to use Minimalistic Text (MT) with Tasker. You’ll be pleased to know that as confusing as it may seem, it’s actually very straight forward and therefore this tutorial shouldn’t be very long (yeah right!).
I love minimalist themes and am therefore a big fan of the application that is very simplistic (as you’d hope) and allows you to display highly configurable text on your home screen, with very little battery drain = %PERFECT (Yes, that was a Tasker joke.. %lol?).
Simple Preparation
Download and install Minimalistic Text free from the market. If you like it, consider the donate version.
Make yourself a cup of tea.
Profile and Task Explanation
In the main Tasker screen, select Tasks, add new, name it MTRefresh. Give it a suitable icon, add in a +, Tasker, STOP action and save out of Tasker for good practice.
Here we go then - my personal MT setup is to have a single, stand-alone task that deals with passing any data from Tasker that I wish. What I mean by this is that I don’t have a context set up to run the task MTRefresh every 2 minutes for example. Not only would this cause battery drain, it’s unnecessary when the screen is off for example.
Q) But hold on… How does it refresh then?
A) Relax… I’m just about to explain…
I’m not going to (initially) recommend that you set up a context in isolation to do this. We’ll look to refresh the widget from your existing profiles first, in order to use no additional resource.
Depending on the variety of profiles in your Tasker collection, you may already have a ‘Device Boot’ context to run profiles such as SDCache or CPUDeviceBoot. Failing that, a Display On context perhaps? When looking to have your MT widget refresh, my suggestion would be to slot a ‘Perform Task’ action into these existing triggers – as many of them as you see fit.
If you don’t have a profile that triggers regularly such as the above, then use the one that does most frequently for the purposes of this tutorial.
In the chosen task, select +, Tasker, Perform Task and click on the magnifying glass. Scroll down until you find your MTRefresh task. Change the priority to ‘1’ (the lowest - as there is no necessity for this to run prior to any other task/action) and select ‘done’. In the task screen, drag the Perform Task action above any ‘STOP’ or ‘GOTO’ action (in the existing task you’ve chosen) that may cause it to be ‘skipped’ or not to start at all.
[If you don’t yet have any suitable profiles that trigger regularly, then select New, Time and select the times that you would like the widget to start manually refreshing in the morning and end at night. Tick the ‘repeat’ box which will be how often between these times the profile activates and your MT Widget is refreshed]
Open the task MTRefresh and click the +, Plugin, Minimalistic Text variable. Press Edit in the configuration screen and you will be presented with two boxes. The top box, labelled ‘Variable name’ is the name by you will reference the Tasker variable in the MT widget. This doesn’t have to start with a ‘%’ or be the same as the variable you are passing the data from. The bottom box is the variable you wish to pass. So, in the top box type BLAR and in the bottom box type %UPS, which is ‘up time in seconds’ (which is the time since you last rebooted). This value will of course always be increasing, so we can easily see that it is working correctly. Make sure this action is dragged above the stop action in the task before saving.
Go to your home screen, hold down and select widgets. Select Minimalistic Text. Select 1x1. In the widget preference screen, scroll down and select ‘predefined layout’. Select Custom.. The Custom layout option is no longer greyed out, so select that. You’ll be presented with the example of the time in text. Hold down on the first example box (Hour text (12h)) until it vibrates and then drag it down to the rubbish bin that appeared. Do the same with the other two boxes. Click the green + symbol. Press Misc. Hold down on Locale variable and drag it up to the box you previously cleared. Once it’s in the box, click on it once to bring up options below it. In the variable name field, type BLAR (assuming this is actually what you named it above). Press the back button to exit to the MT preference screen. At the bottom there is a very thin line saying ‘Preview (tap to toggle)' – click this and you’ll probably see a box with [LOCTV] in it. Alternatively, you may actually see the value of %UPS, but I’d imagine we need to ‘refresh’ the MTRefresh task first.
Press ok to exit out of MT and on your home screen, where you expected the widget to be, you may well see nothing at all… Don’t panic! Go into Tasker and open the task MTRefresh – press ‘test’. Go back to your home screen and hopefully you will see that the value of %UPS is now displayed!
Job done…!
Q) But hold on... Is that really it? I'm not even bored and confused like I normally am...
A) F*ck you
I won’t go into how to make the text look cool as there’s a dedicated MT wiki and XDA thread for that.
You can of course use any of your own created variables and pass them to MT. You are not restricted to the inbuilt Tasker variables only.
There is a good thread here by akoe that describes how to pass your unread SMS count.
A list of inbuilt variables you can use can be found here
If anyone is struggling to pass certain data to MT or if you have any questions, feel free to post and ask!
The thanks meter lets me know this wasn't sh*t and a complete waste of my life
Basic Linux/shell commands to create an informative battery widget
What you will learn
Some basic Linux/shell commands via a Terminal Emulator
Profile Aim
Extract battery data using Linux/shell commands via the terminal and pass to Tasker to create an impressive battery widget.
Simple Preparation
Download and install Android Terminal Emulator [by Jack Palevich] free from the Market
Make yourself a cup of tea.
Overview
For noobs, or even some seasoned Android/Tasker users, venturing into the world of Linux/shell/ADB is a leap that just seems a little too daunting and probably remains on the todo list.
If reading the above has already made you reach for a spare set of underwear and you’ve suddenly got an urge to watch the TV instead, under the assumption that this will cause you major brain-ache, then think again! What I will show you is actually very simple and I hope will leave you feeling suitably impressed with yourself.
As always, I will explain everything in as much detail as I can, bordering on patronising (apologies) in the hope that I leave no one confused…
Let’s get started!
Profile and Task Explanation
By using the Terminal we are able to access some hidden gems that many applications (some you possibly have already paid for) use to inform us of our system information. We are going to focus on a simple battery widget for now, although I’m sure what you learn will open a door to accessing much more information from your device, that will see you creating all sorts of informative widgets for your personal use – please share them!
Open the terminal application and type:
Code:
su
This simple command has set your ‘user id’ to superuser. This is no more complex that logging into your pc at home under the name of someone who has administrator privileges.
We are going to run commands under superuser because much of the data has restricted access unless you have certain permissions.
Next type:
Code:
dumpsys battery
Much to your surprise (perhaps) you’ll see a similar output to this:
Code:
Current Battery Service state:
AC powered: false
USB powered: true
status: 2
health: 2
present: true
level: 23
scale: 100
voltage:3864
temperature: 204
technology: Li-ion
Unfortunately, not all outputs are quite as user-friendly as this, but this one is great to work with and as you can see, supplies us with plenty of information for our battery widget.
Now, we could immediately export all of this information to a text file and then get Tasker to read that text file using the ‘read line’ action to populate the data into variables. But let’s have a look at a very simple command that can make life easier before we send to Tasker.
Looking at the ‘level: 23’ line, it maybe that you only want to make a widget showing the battery data – so let’s just get that.
Using the ‘grep’ command, we can easily narrow down the output with little effort. Try this command in the terminal:
Code:
dumpsys battery | grep level
The ‘|’ is known as a ‘pipe’ and in simple terms says ‘do this before you give me the output’. In the example above, grep has only supplied us with the lines that contain the word ‘level’.
Try the same for ‘temperature’:
Code:
dumpsys battery | grep temperature
Easy hey…
So, let’s say that you’ve completed your battery level widget, but you hate the text ‘level:’ that appears before your battery percentage. To get rid of this, think of every output you get as appearing in an excel spreadsheet – each ‘word’ or ‘data section’ appears in its own column and you can easily select the individual columns you want to view.
Try this:
Code:
dumpsys battery | grep level | awk '{print $0}'
So, that didn’t change anything did it… You still got the full output – that’s because $0 means ‘everything’. Now try this:
Code:
dumpsys battery | grep level | awk '{print $1}'
Now try this:
Code:
dumpsys battery | grep level | awk '{print $2}'
Now try this:
Code:
dumpsys battery | grep level | awk '{print $1,$2}'
You’ve just learnt how to output all or some of the data you require.
TIP: If you’re having to retype the commands every time in the terminal, install a keyboard that has directional arrows on it (I use smart keyboard). Pushing ‘up’ on the arrows displays the last command you typed and then you can scroll across with the left arrow to edit just the parts you want, before pressing enter to execute. Simple.
Now you know how to extract just the data you want with the commands grep and awk, let’s assume that you’ve decided what text you want in front of the battery level and would like this to display in the output.
Try this:
Code:
dumpsys battery | grep level | awk '{print “CURRENT BATTERY LEVEL”$2}'
You’ll see that any text you put between the “ ” will output the exact text you’ve written. However, did you notice that there was no gap between the text and the battery level? Simply insert a comma to segment the output:
Code:
dumpsys battery | grep level | awk '{print “CURRENT BATTERY LEVEL”[B],[/B]$2}'
Right, so now you know how to extract just the data you want for your widget, let’s transfer it to Tasker. Using a command above, we’ll send just the battery percentage over and nothing else. Type this:
Code:
dumpsys battery | grep level | awk '{print $2}'
Now type this:
Code:
dumpsys battery | grep level | awk '{print $2}' > /mnt/sdcard/batterywidget.txt
Navigate to the root of your storage card and confirm that a text file containing just the current percentage of your battery has been created.
Next, let’s get just the temperature:
Code:
dumpsys battery | grep temperature | awk '{print $2}' >> /mnt/sdcard/batterywidget.txt
Navigate back to the same file and you’ll see this information has been appended underneath the percentage. The reason that this data was entered below the previous data (appended) was because of the double ‘>>’ used above. A single ‘>’ means ‘send the output to this file’. It will overwrite anything the file currently contains. A double ‘>>’ means ‘append the data to this file’.
Before we head over to Tasker to deal with the data, let’s do one more command. The health of my battery is currently showing as 2. That number means pretty much nothing to anyone – it could be 2/1,000,000. If we know that 1 = super, 2 is very good; 3 is good, 4 is poor and 5 is sh*t, then let’s translate that data first by using a very simple IF command.
Starting with:
Code:
dumpsys battery | grep health
Followed by:
Code:
dumpsys battery | grep health | awk '{print $2}'
Followed by:
Code:
dumpsys battery | grep health | awk '{if ( $2 == 1 ) print “Super”}'
If you got no output, try one of these:
Code:
dumpsys battery | grep health | awk '{if ( $2 == 2 ) print “Very Good”}'
dumpsys battery | grep health | awk '{if ( $2 == 3 ) print “Good”}'
dumpsys battery | grep health | awk '{if ( $2 == 4 ) print “Poor”}'
dumpsys battery | grep health | awk '{if ( $2 == 5 ) print “Sh*t”}'
I’m hoping you got an output and can see how the IF condition is selecting the correct output. We don’t want to use five different commands to get our answer though, so let’s join them together:
Code:
dumpsys battery | grep health | awk '{if ( $2 == 1 ) print "Super"; if ( $2 == 2 ) print "Very Good"; if ( $2 == 3 ) print "Good"; if ( $2 == 4 ) print "Poor"; if ( $2 == 5 ) print "Sh*te" }'
I very much hope that you are still with me at this point and suitably impressed with yourself!? The above code could be simplified using just ‘awk’ and no ‘grep’ or ‘cut’ or ‘sed’, but the format should enable you to see exactly what is going on and how you are getting the output you are! So we’ll stick with that…
Ok then, let’s take this puppy over to Tasker. Click on the task icon and select ‘New Task’. Name it ‘ShellBat’ and then select the + to add the first action. Select Misc and then Run Shell and in the command field enter:
Code:
dumpsys battery | grep level | awk '{print $2}' > /mnt/sdcard/batterywidget.txt
Tick the ‘use root’ box, choose a suitable icon (by pressing the icon button) and then press the green tick to save. Then press it again to save the task and again to exit Tasker. This makes sure the task is correctly saved in case your device crashes – if you don’t save all of the way out of Tasker, you progress could be lost.
Go back into Tasker and select the task ShellBat and press the play icon. Approve the superuser request (if prompted) and then open up a file explorer and check that the file sdcard/batterywidget.txt has populated with your current battery level correctly.
It has? Result! Next we need to get the battery health text in there too and to do that we need to add another run shell action in position 2 in the shellbat task. So, press + in the task, select Misc, run shell, tick use root and enter the following in the command field:
Note – If you are not viewing this tutorial on your phone and copying and pasting the commands over, at the end of this post I’ve included a text file with the commands in that you can drag to your sdcard and then copy and paste the contents from there – pressed the thanks button yet??
Code:
dumpsys battery | grep health | awk '{if ( $2 == 1 ) print "Super"; if ( $2 == 2 ) print "Very Good"; if ( $2 == 3 ) print "Good"; if ( $2 == 4 ) print "Poor"; if ( $2 == 5 ) print "Sh*te" }’ >> /mnt/sdcard/batterywidget.text
In the above command you’ll remember that we’ve used ‘>>’ which will append the battery health underneath the current battery level.
Press the play button in the task and then navigate back to the text file to make sure it has populated correctly! It did? Whoop! Having that data safely in the text file, we now need to get it into Tasker. We do this using the read line action. In the task, select the + button, followed by file, followed by read line. Hit the magnifying glass and select batterywidget.txt. In the line field put the number 1 and in the var field type %BWLEVEL and press the tick to save. Press + again selecting another read line action, this time put 2 in the line field and name the var %BWHEALTH. Finally, we want to be able to check that everything is populating correctly without viewing variables and text files – so let’s flash the variable results on the screen. Press the + again and select, Alert, Flash and in the text field type %BWLEVEL %BWHEALTH. Tick the long button and then the tick to save. Press play in the task and hopefully see the contents of the two variables flash up on the screen!
I won’t talk you through making the widget itself – there’s a Minimalist Text tutorial above that talks you through how to get the variable information into a widget. You could also use the Zoom Widgets application that’s made by the dev of Tasker to knock something up too.
As far as how to update the information goes, you could run the task from a ‘display on’ context, so the data is refreshed every time you turn your phone on. Other options are to set a 5 minute interval between updates (when the display is on) or you could have the widget perform the task when clicked to manually refresh the data.
Other ideas would be to variable set %BWLEVEL to %BWLEVELR if it is less than 20. If that variable exists, then the widget would use a red text to display the battery level or %BWLEVELG (for green) if it is > 80.
Anyway, the point of this tutorial was to show you how to extract and pass the data using terminal commands and I very much hope I’ve shown you some handy basics.
Please post your screenshots if you make anything good!
As always, the thanks meter is the only way I’ll know to keep writing this stuff.
Have fun!
Credits: waydownsouth - For hours and hours of patient help
Great initiative! I am a total noob at using Tasker, and tutorials like this (with lots of explaining) is excactly what we need to learn it. Thanks
torsrex said:
Great initiative! I am a total noob at using Tasker, and tutorials like this (with lots of explaining) is excactly what we need to learn it. Thanks
Click to expand...
Click to collapse
Glad to hear it Be more coming when I find the time...
torsrex said:
Great initiative! I am a total noob at using Tasker, and tutorials like this (with lots of explaining) is excactly what we need to learn it. Thanks
Click to expand...
Click to collapse
I second that! Although I would like to request tutorials for using tasker with minimalistic text....I have never got this to work
fl4r3 said:
I second that! Although I would like to request tutorials for using tasker with minimalistic text....I have never got this to work
Click to expand...
Click to collapse
I'll put one together for you
Thanks for the tutorial. It's been very helpful. After your explanation of pattern matching I was able to make a profile to control my phone using Diary Events
ccadi said:
Thanks for the tutorial. It's been very helpful. After your explanation of pattern matching I was able to make a profile to control my phone using Diary Events
Click to expand...
Click to collapse
Pleased it's helped you to make a profile you wanted. That's what I wanted to achieve
I have a question regarding Tasker:
I have SGS 2 and have Pin Lock enabled.
I've created an Event where :
On display unlocked: KeyGuard: off --> Wait : 2Mins --> Keyguard On.
Its my version of Delay lock without Wait Until since i want the phone locked after two minutes regardless of usage pattern . Problem is when screen goes off before two minutes is reached, Even though KeyGuard is set to on, pressing Home button or unlock button bypasses the pin unlock and goes straight to Home Screen!
To fix it i tried by using : If %SCREEN matches Off --> System lock
but it didn't work.
Note that if the two minutes have elapsed and i unlock the phone myself whilst screen is on everything is ok, problem only occurs if the screen goes off before two minute wait is reached and that's when bypassing pin lock happens. How can i fix this?
thanks
ke3pup said:
:SNIP:
On display unlocked: KeyGuard: off --> Wait : 2Mins --> Keyguard On.
Problem is when screen goes off before two minutes is reached, Even though KeyGuard is set to on :SNIP:
Click to expand...
Click to collapse
You confused me there - if the screen goes off before the two minutes, then from what you explained above, you set the keyguard to 'off' and it will be until the 2 minutes has passed??
Have I misunderstood..?
Thanks a lot. Exactly what I needed. I somehow managed to make some simple profiles but I hope to become a tasker ninja soon.
Will try everything after my exams..
subscribed ..
[indroid 4.2]
neo1691 said:
Thanks a lot. Exactly what I needed. I somehow managed to make some simple profiles but I hope to become a tasker ninja soon. Will try everything after my exams... subscribed .. [indroid 4.2]
Click to expand...
Click to collapse
Ninja status awaits you
sawvellra26 said:
Wish this was around when I was just learning tasker. I spent countless hours learning this app...but having a useful thread as a resource is very nice. Thanks OP
Check out my newbie YouTube: http://youtube.com/androidhow
Click to expand...
Click to collapse
Pleasure Just checked out your sudoku video - brilliant! Didn't know it could do that... Wish it could do the same with cross-words!
Great great work!!! I cannot thank you enough brandall! Subscribed!
mi3x said:
Great great work!!! I cannot thank you enough brandall! Subscribed!
Click to expand...
Click to collapse
Pleasure
brandall said:
You confused me there - if the screen goes off before the two minutes, then from what you explained above, you set the keyguard to 'off' and it will be until the 2 minutes has passed??
Have I misunderstood..?
Click to expand...
Click to collapse
currently I have:
Code:
ON Display Unlock -> 1) Set KeyGuard : off
2) Wait : 2 minutes
3) Set KeyGaurd: on
So when the display is unlocked , the keyGuard is set to off, waits for two minutes and sets the keyGuard back to on.
This is fine if screen is ON when step 3 happens. but if screen has gone OFF when step 3 happens, it appears that KeyGuard remains off because when i press the Unlock or home Button I'm taken back to home screen bypassing the Pin unlock screen (or slide unlock screen for that matter).
How can i fix this?
ke3pup said:
currently I have:
Code:
ON Display Unlock -> 1) Set KeyGuard : off
2) Wait : 2 minutes
3) Set KeyGaurd: on
So when the display is unlocked , the keyGuard is set to off, waits for two minutes and sets the keyGuard back to on.
This is fine if screen is ON when step 3 happens. but if screen has gone OFF when step 3 happens, it appears that KeyGuard remains off because when i press the Unlock or home Button I'm taken back to home screen bypassing the Pin unlock screen (or slide unlock screen for that matter).
How can i fix this?
Click to expand...
Click to collapse
Ok! I'm with you now... There are issues with some lock screens and Tasker, so don't get your hopes up that we will be able to solve it; but let's try.
1) Add an 'Alert', 'vibrate pattern', pattern 200,200 - as action number 4
2) Set you wait time down to 30 seconds for testing so you don't have to twiddle your thumbs!
Switch your screen off before the 30 seconds and see if you feel the device vibrate at the 30 second point. At least we'll know then if the task is running fully.
Report back!
hi brandall,
it's very kind of you doing such thread.
i m new user on tasker, the best app on the market.
actualy i ve got 3 main profil which were inspied by wiki tasker (extended profiler widget) - minimalstic tex (i like) sms-mail-call with a peach text for each ones and a really simple profile -auto gps- on for some apps.
in a near, a project to built a alarm clock which your would drive me with your alarm clock and a auto sms sender when sms or call are received while i am on my bike... so no worry with responds... i plan to used some like %locspeed include into the sms and others stuff... one step by step
I hit the button tks

[TUT] [Tasker] Create a widget that periodically cycles through different messages

Hey, guys. I've been looking to use Tasker for awhile now but, it's just been laying dormant in my app drawer because I was too overwhelmed by all the options. Anyway, I finally got around to using it when I discovered a Domo-kun wallpaper that I just had to use and customise. And what I've got is in this post.
http://forum.xda-developers.com/showpost.php?p=14898952&postcount=33983
In this tutorial we will be trying to understand how to use Tasker's Minimal Text Widget Plugin and Variables. So, let's get down to it.
Objectives
Get Domo-kun to "say" stuff based on various events on the phone.
Get Domo's messages to cycle based on a preset time period.
Variables
These are basically empty labels that you must direct Tasker to fill. You can fill them with a string of characters, or with numbers and you can also perform basic math functions on them.
Minimal Text Widget Plugin
This enables Tasker to display stuff via Minimal Text Widget.
What we need
We will need a way of keeping time, so that messages will change after a specified time.
We will need a way of setting a preset message that corresponds to the battery state.
We will need a way of setting a preset message that corresponds to the wifi state.
We will need a way to tell Minimal widget when to display a message.
We will need a way to tell Minimal Widget what message it should display.
Setting a timer that will change the message after preset time.
The context for this is obviously every 'x' minutes. So we start a new profile with a Time context, and set that to repeat every 'x' minutes.
Now, we need a variable that will change after every 'x' minutes(y+1), this will eventually tell our widget when it's time to change the message. So, this will be the action for this particular context. Add a new task to the context, select Variable>>Variable Set. Let's name our variable, I will call mine %SET. The necessary action after every 'x' minutes is '%SET + 1' so this is what we will put in the "To" field. Remember to check the box "Do Math", this will treat the variable as a number, and enable us to perform the required math on it.
Let's take a look at what will happen, when this profile is active.
Every 'x' minutes, the Variable %SET will be set to %SET + 1. So, if %SET starts at 0, after 'x' minutes it will be 0 + 1; it will be 1; after another 'x' minutes it will be set to %SET + 1, 1+1; it will be 2, and so on.
You now have a variable that changes every 'x' minutes.
Setting a preset message according to the battery state.
I want to make Domo tell me how my battery is doing when it's at four different states (100%-75%, 75%-50%, 50%-25%, 25%-0%).
So, now we have four different contexts(battery ranges) in which Tasker needs to perform certain actions(Domo will say something). Let's start creating them.
For the first context(battery level 75-100) we want to display "Your battery is good". So, we will first define the context. In this case the context is a "State" in which the phone is in. Therefore our required context is in the "State" category>>Battery level, choose the range, I will choose 75 - 100. Since the message changes based on the level, we will need to set a variable here. I will call mine %BATTSTAT, and set it to "Your battery is good".
We have to repeat the steps for the other 3 battery levels. So, we create new State>>battery level profiles but, we use the SAME Variable(%BATTSTAT) for the message.
(50-74) - set %BATTSTAT to "Your battery is OK"
(25-49) - set %BATTSTAT to "Your battery is low"
(0-24) - set %BATTSTAT to "Your battery is going to die"
What is going to happen when this profile is active?
When the battery level is between 75-100 the %BATTSTAT will be "Your battery is good", when battery level hits 74, %BATTSTAT will immediately change to "Your battery is OK", and so on.
We now have a variable(%BATTSTAT) that holds a message depending on the battery level.
Setting a preset message according to wifi state.
This is pretty much the same as setting the message for battery level. The only difference is we will use a an exit task for when wifi is not connected. An Enter Task are the actions that take place when a state is entered, an Exit Task are the actions that take place when a state is exited.
So, new profile, State>>Wifi Connected, set %WIFISTAT to "Your wifi is connected", now if we don't set the %WIFISTAT Variable to change when the wifi is disconnected, it will always hold the message "Your wifi is connected". So we set an exit task for the variable %WIFISTAT to say "Your wifi is disconnected".
Okay! We now have,
%SET - A Variable that increments every 'x' minutes
%BATTSTAT - A Variable that holds a message corresponding to the battery level
%WIFISTAT - A Variable that holds a message corresponding to the wifi status
Getting tasker to communicate with Minimalistic Text Widget
This is fairly simple, all we need to do is define a variable for MTW, and set to what we want to say, in this case the message within the tasker variables (%BATTSTAT or %WIFISTAT). So, the action would be within "Plugin">>Minimalistic Text Widget. You have a field for Minimalistic Text Widget's Variable and you have a to field.
Now, we need a way to send our messages to Minimal Text Widget at the right time.
We use our Time variable to tell us what's the time. If, %SET = 0 we will send %BATTSTAT to the widget, if(after 'x' minutes) %SET = 1, we will send %WIFISTAT to the widget. Now, our next context depends on the Variable %SET, so this will be the context we coose. Event>>Variable>>Variable Set, enter the Variable(%SET) in Name field and what it will be when we perform our action (sending data to MTW) in this case, '0'. The action to perform will be, Plugin>>MTW set a Variable %DISP to %BATTSTAT.
Now we repeat this for 'x' minutes later when %SET = 1, so a new Event context has to be made, where the variable %SET = 1, and here we will send the wifi status to MTW. So, Plugin>>MTW set Variable %DISP to %WIFISTAT.
What happens here is, when %SET = 0 (at the beginning of our cycle) Tasker will send the message within %BATTSTAT to %DISP. 'x' minutes later, when %SET = 1, Tasker will send the message within %WIFISTAT to %DISP. But, wait! What happens when 'x' minutes later our time variable increments(%SET + 1 ie. 1+1 = 2)? This is a problem because we have not made a profile for %SET = 2, in relaity we don't need one because there are only two kinds of messages we want to send to MTW.
We need to reset our counter. So, we make a new Event profile for when the variable %SET is greater than 1. All we need to do is set %SET to 0.
Displaying our messages on MTW
Create your Minimalistic Text Widget, within it's "Misc" tab find Local Variable and put in the name of your MTW Variable, in this case, it is %DISP. And you're done!
___________________________________________________
This is my first attempt at writing a tutorial and also I've only been using Tasker for a couple of days, so the above procedure might not be completely optimized. Maybe our Dev/Programmer friends can enlighted us. I tried to write this tutorial not so much as a hold your hand and give you a play by play but, more as a I hope you learn something about the way Tasker works and find better uses for it. I hope it was helpful. I don't think pictures are actually necessary if people get their feet wet with Tasker but, if people think it's absolutely necessary, I will post some.

[Help] Tasker & Brightness Script

Writing my first scripts for Tasker & looking for some help while I try to figure this out.
I'm trying to write 2 scripts. One is to increase brightness, and one is to decrease it.
I have tasker, and I have the Screen Filter app (which has a plug in for Tasker).
I'd like to make a shortcut (that I will be calling from yet another app) that will increase brightness from:
Screen Filter 40%, Screen 0
SF 0%, S 0
SF 0%, S 50
SF 0%, S 150
SF 0%, S 255
Then the opposite for decrease.
The idea was to set a variable called %Bright, and use a if-else-else-else-end if that checked the current level of the variable, and set the screen 1 brighter and set the variable to a new value. (ie, check current brightness then increase by 1 level).
Problem is if anything other then my shortcut changed the brightness, Tasker doesn't know about it. (Say if I use Quick Settings)
There any way to get Tasker to check the current state of the brightness (and screen filter)? There a better way to do this inside Tasker?
(btw, I am aware of other apps to control brightness. please don't mention them in this thread)
EDIT: Wrote the script out with no problems assuming variable is set. For now, using variable 1-5 (dimmest to brightest). If variable is not set, or anything else, then both my dim script & my bright script will just set it to 1 and go from there.

Categories

Resources