Present Phone Battery Charge % To Be Used as Trigger

It would be great if the ST mobile app could show the phone’s battery level on the presence object that way it could be used to trigger actions.

My thought is to have a smart outlet for charging my device that cuts on/off the outlet based on phone percentage. That way it stops charging when the phone gets to 100% to reduce battery fatigue or to be able to trigger action to remind you to charge your phone when the level gets below a certain percentage.

I do exactly that now, by looking at power usage when charging. 100% reliable with one device or 10…

1 Like

Do you mean something along these lines?

Using IFTTT - when my android battery drops below 15% it turns on a switch in ST.

The switch in ST is a trigger for a CoRE piston.

The CoRE piston sends a SMS message to me telling me to charge my battery because it is extremely low.

I can also have it turn off my Wi-Fi and Bluetooth to save power.

I can also have the piston sends a message to my Alexa to let me know.

edit: Using a power sensing switch, once the phone starts charging it resets the switch.

1 Like

Side note, any phone, tablet, laptop etc with a Lithium Ion battery, it won’t cause fatigue by leaving it constantly on a charger since once it has finished charging it won’t actually keep charging, in fact, in some ways, it’s better to keep it on the charger.

It will actually keep charging to maintain the 100% chraged level, you mean it won’t overcharge…

[quote=“SBDOBRESCU, post:5, topic:57235, full:true”]It will actually keep charging to maintain the 100% chraged level, you mean it won’t overcharge…

But is it still a security system? :wink:

It’s not charging at the same rate before the battery was 100% but yes, it’s still charging. We’re arguing semantics. The point is, you won’t ‘fatigue’ the battery by leaving on the charger .

You could just buy a Samsung Note 7, I hear they tell you they are overcharged with an amazing light display and fireworks without any setup…

…sorry I will leave now…



is there a DTH for android battery stat ?

Any usefull update to this idea ?
I saw solution using Tasker + sharptools rule but can’t get it to work.

If battery =<20% then charge on
If batttery =>85% then charge off

An edge or DTH that would pull battery info from android system and place it as sensor ?


I use Tasker and SharpTools for my phone charger and it works great. I use it to control a smart switch at home and a smart switch at camp.

Nice, but i’m new at this and dont know how to make it work in sharptools :confused:
I found one guide (different than your screenshots) but i dont know how to …

Can you help me on sharptools side?

You will need the SharpTools plug in for Tasker. I think it costs $3.50 US.

You need to install the SharpTools app (Android or iOS) and link it to ST. It will show up as a smart app in ST.

Open the SharpTools smart app in ST and select the devices you want to be available in SharpTools.

After you do that go back to Tasker and create a “task” using the SharpTools plug in. You should be able to chose the device in SharpTools that you want to operate.

If you have a Samsung phone with Bixby, a Bixby routine is easily set up to accomplish the charge on off battery level task.

1 Like

I’ve been trying to get Tasker and LAN trigger device made by @TAustin to work together so routines like this would run locally. No luck so far. There’s something I’m doing wrong, I just can’t figure out what it is.

If you are going down the Tasker route you could just turn a charger on and off using an API call. An alternative would be to create a virtual battery device (I use the @TAustin driver) and update that using the API. I favour the latter as it gives you the battery and power source in SmartThings where it really ought to be already.

Here is an example of an HTTP Request in Tasker. It requires knowledge of the device ID in UUID form, and also a suitably scoped Personal Access Token for the bearer authorization.


I’m slowly starting to get hang of this. But bare with me, I’m novice with these things. Under the Query Parameters I have FIle/Directory To Save With Output. Is is that part where the piece of code should be? Is it a file you have uploaded from the files of your phone?

Can you elaborate on this at all? This is something I’ve been wanting to do for a while, but couldn’t find a way to do it through SharpTools. I’ve created a new virtual battery device using the vEdge Creator from TAustin, I have the UUID of the battery device, and have created a PAT with (I believe) appropriate authorized scopes. I’m pretty familiar with Tasker etc., but I’m still getting an error when I try to run the task. Any tips? TIA!

What error are you getting?

1 Like

Jebus you’re responsive. :slight_smile: The error is… vague.

I tried changing the method to different things which give, for example, “POST is not an allowed HTTP method for the requested resource.”

That last line with just the E is where I would expect the actual error. IIRC, there’s a variety of different Tasker variables that get set with response codes and things like that. I would either Notify > Flash those variables or store them to global variables so you can review and see if they have any meaningful data.

Have you used HTTP Actions in Tasker before? At least one other person mentioned that they got a generic error like that when Tasker didn’t have the required permissions it needed on Android 12.

Otherwise if you try to do it with the SharpTools Tasker plugins, I’d be happy to help out since I wrote them. :slight_smile:

1 Like