1. Introducing Channels - a new way to chat with other Android users!
    Dismiss Notice

Tasker question--Battery alarm


Last Updated:

  1. meatweaver

    meatweaver Member This Topic's Starter

    Joined:
    Jul 28, 2010
    Messages:
    10
    Likes Received:
    0
    Hi all--While talking on my Incredible last night, the battery died on me without any warning. So I decided I wanted to set up a task in Tasker to give me an alarm when the battery hits a certain level. I've struggled with it, but I think I have something that should work. The problem is...it doesn't. Hopefully someone out there has an idea about this and maybe it'll provide someone else some ideas too.

    Here is what I have:

    1) Define a variable (%POWER) equal to 1 if phone is connected to a power source

    2) Create context "Not Power"--On if phone is not connected to a power source.

    3) For that context, set the following actions:
    a. Set alarm volume to level 4
    b. Ringtone type alarm if %BATT<20 (%BATT is a built-in variable)
    c. Wait 30 seconds
    d. Go to action b. if %POWER (variable created in step 1) is not equal to 1.

    My hope was that this alarm would ring every 30 seconds once the battery was below 20% until I plugged it into a power source. Once I get this working, I could also add a dismiss widget.

    Any ideas?
     

    Advertisement
  2. DaWeav

    DaWeav Well-Known Member

    Joined:
    Nov 13, 2009
    Messages:
    343
    Likes Received:
    53
    Maybe you could just use an event context for Battery Level not (invert) from 20 to 100 that would run a loop task to make a sound every 30 seconds.

    1. Set media volume to level 4
    2. media action for Music Play file 'sdcard/soundfile.xxx'
    3. wait 30 seconds
    4. go to 1 if %BATT < 20
    5. stop
     
  3. meatweaver

    meatweaver Member This Topic's Starter

    Joined:
    Jul 28, 2010
    Messages:
    10
    Likes Received:
    0
    DaWeav--

    How is that different than what I've done? To me that sounds about the same except that the context is battery level not 20-100 rather than battery level under 20.
     
  4. UncleMike

    UncleMike Well-Known Member

    Joined:
    Nov 15, 2009
    Messages:
    2,319
    Likes Received:
    482
    The first problem I see is that the Ringtone action you're using only sets the default ringtone for the specified type (in this case, alarm) - it's not intended to make any sounds. It's like setting your default ringer - it doesn't play anything, it only determines what will play when it's time for the ringer to sound.

    DaWeav's Music Play action is intended to play sounds, and should work fine.

    Second, DaWeav's addition of the battery level context means that the profile will only be active if the phone is not externally powered AND the battery level is less than 20%. The way you have it setup, the profile will be active whenever the phone is not externally powered (regardless of battery level), but will skip playing the sound if the battery level is less than 20%. This means that the profile will be active more often, and the task will be running much more often, with no added benefit.
     
  5. meatweaver

    meatweaver Member This Topic's Starter

    Joined:
    Jul 28, 2010
    Messages:
    10
    Likes Received:
    0
    UncleMike--Great Advice. Thanks a lot. Do you know if I am on the phone when these conditions are met if that will conflict with the task and cause it not to run? I'd like to be warned while I'm on the phone so I can plug in
     

Share This Page

Loading...