Saturday, June 27, 2015

Tasker:Battery Temperature

After a week of google searching and studying different ideas and views, I am now able to find out the battery temperature from tasker. My device is rooted so I dont know whether this steps works on unrooted devices or not.

Okey lets go to the process....
First you need to open the file explorer and create the new folder named 'Battey'. I am doing this because i want to keep every battery information inside this folder. Example: sdcard/tasker/Battery/

  Now, Goto Tasker and create new Task and give any name you want,

1. Write File
File: tasker/Battery/battdump.txt
Text: %BattDump
(When you set this command it will write the text file inside the Battery folder you created and it contains all the information of battery in a single paragraph. Example:
>>> Current Battery Service state: AC powered: false USB powered: true Wireless powered: false status: 2 health: 2 present: true level: 49 scale: 100 voltage:3916 temperature: 310 technology: Li-ion <<<)

2. Run Shell
command: dumpsys battery
Use Root: tick
Store Output in: %BattDump

3. Variable Split
Name: %BattDump

4. Variable Split
Name: %BattDump(26)
Splitter: temperature
(In the example highlighted in blue, count every word and numbers as 1 2 3 separated by space where word1 is Current word2 is Battery word3 is Service  word15 is 2  likewise the value of temperature is in word26 i.e. 310 ,you might thought it should be in 27th number because the value of voltage is not separated by space so its a single word)
        
5. Variable Set
Name: %BatteryTemperature
To: %BattDump(26)/10
Do Math: Tick
(The temperature value shown in the txt file is in 3 digit number. My Battery temperature is 31 degree but it is showing as 310 so to remove the last digit we are dividing it by 10 and dont forget to tick on 'do math' otherwise it wont work)

6. Variable Set
Name: %BatteryTemperature
To: round(%BatteryTemperature)
Do math: Tick
(The result after dividing by 10 may came as 31.5 in some case so by this 'round' command it will convert the result in round figure)

Thats it, you can check it by 'Flash' task where the variable for the Battery Temperature will be %BatteryTemperature
|
|
|
|
|
|
|_____Keep tuning my blog for more about tasker____________
|
|
|_____https://www.facebook.com/mrdipesh1