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

7 comments:

  1. If you install busybox, you can get away with a one liner shell command to grab the temperature:

    dumpsys battery | grep temperature | egrep -o "[-0-9]+"

    If you don't install busybox, something like this should also work:

    dumpsys battery | grep temperature | grep -o -e "[-0-9]\{1,4\}"


    ReplyDelete
  2. you must be rooted in Android 5.0.1

    ReplyDelete
  3. you must be rooted in Android 5.0.1

    ReplyDelete
  4. Hi ,

    If I am to put the Temperature result value as the context of Profile .

    What should it be ? Event ? State ? and ......etc ?

    As I want this Profile when reach temperature of the mobile i.e. 60 and it will trigger task to restart the phone.

    You know some time no reason but happened that the phone is start cooking heat inside pant pocket.

    Thank you very much.
    edmond.

    ReplyDelete
  5. write command can do to %variable, then work with this variable. Why you create file on filesystem?

    ReplyDelete
  6. Lucky Club Casino Site | Online gambling | Lucky Club
    Lucky Club Casino site. Lucky Club is a top casino for you! You can get exclusive online luckyclub gambling bonuses, win real money and more! Rating: 3.3 · ‎9 votes

    ReplyDelete
  7. Borgata Hotel Casino & Spa Announces New Resort
    Borgata 강릉 출장안마 Hotel 김제 출장마사지 Casino & Spa will be the first in Atlantic City 목포 출장안마 to set foot on the A spokesperson for the company's 창원 출장샵 Borgata Hotel Casino & 밀양 출장안마 Spa confirmed

    ReplyDelete