+9 votes
by (3.6k points)
Does anyone know of a way that i can monitor battery life of a phone/tablet and trigger a device based on its value? Eg - battery level of the tablet drops to 15% it turns on a smart socket and when it gets to 100% it turns the socket off. I have tried IFTTT but for some reason it wont trigger any ST devices even though they are authorised correctly. I have tasker, webcore (though havent used it yet so would need some instruction) its on a fire tablet and i use wallpanel which can provide sensor information (inc. Battery levels) over MQTT but i dont have a broker and its not something i am clued up on for setting one up.  
Does anyone know of a way that i can monitor battery life of a phone/tablet and trigger a device bas

5 Answers

+9 votes
by (3.2k points)
 
Best answer
I've done this in two ways. Firstly using tasker to send a webhook to webcore, and secondly by using life360 which reports battery level (again into webcore)
by (3.6k points)
@rena43 oh that sounds good. What do you recieve the notification on if you do forget? I am thinking echospeaks to a speaker for me  Oh the piston for the battery % works flawlessly btw
by (3.2k points)
@pachton8 yeah, echo speaks to the bedroom echo. I use an Alexa routine that trips a simulated switch, which causes webcore to report if any contact sensors are open, and also report on those too.  
by (3.6k points)
@rena43 any way that you know of to kinda reverse the webhook, basically webcore to send a command to tasker and tasker operate the trigger on the device its on? ST virtual switch ON -> webcore monitors this -> when true send webhook to tasker -> tasker performs action
by (3.2k points)
@pachton8 sorry, not something I've tried. At a guess, Maybe you could use a simulated contact sensor to trigger a routine in Alexa which sends a notification to the tablet, which tasker could pick up, but that's just off the top of my head.  
by (3.2k points)
@pachton8 actually, with the smartthings app on the tablet, maybe you could send a notification directly?  
+8 votes
by (1.2k points)
Tasker to send a webhook to IFTTT on battery level. IFTTT to do whatever based on that webhook.  
+3 votes
by (1.2k points)
I like where you are going with this, setting the tablet in charge of its own battery level. Clever. But I wonder is that a bit redundant compared to leaving it plugged in? Wonder what the idle power consumption would be compared to your solution. I like the idea though, clever thinking.  
by (3.6k points)
@lebaron its more because i like things turned off at the mains when we go to bed etc or not in use . I know powered through the day and off at night would be easier , i dont want the battery to drain compeltely and have to come switch it back on this way it will only be on when necessary and i dont have to hold the power button ever  i know first world problems, but its a smart home and i like automation. Its a actiontiles wallpanel so it should always be available
by (1.2k points)
@pachton8 a very crude way in the meantime could be playing with some timers, turn it on for say 20 mins overnight or something just to be sure. But yeah I get what your going for. Tasker can probably do this by itself, using the smart sockets native app on the tablet itself, or getting Tasker to trigger it from smart things directly, no need to go through the cloud. But Tasker, webhooks and IFTTT would probably be the easiest way about it.  
by (3.6k points)
@lebaron if i could have it directly through ST that would be fine. The sockets are hive sockets but linked directly to ST so no native app. Gunna have a look at webcore shortly and get my head around it. Im a fast learner with this kinda stuff so should work it out
by (1.2k points)
@pachton8 webhooks is different to WebCore, much less involved to setup. But WebCore is very versatile. You could set up Tasker, webhooks and IFTTT direct from your phone in about ten mins and have it working. WebCore you'll be able to run direct in ST, but probably still need Tasker to send a trigger based on battery level.  
by (3.6k points)
@lebaron i am having problems with ifttt working with ST at the minute, it absolutely will not trigger a ST device for me. They are all authorised correctly , i have tried unlinking the 2 and re linking multiple times. Just doesnt wanna play ball anymore (it used to work fine)
by (1.2k points)
@pachton8 what about through virtual device creator? make a virtual device for it. Kinda socially distances the device ;) and smartthings a little, lets you trigger things that otherwise don't integrate.  
by (3.6k points)
@lebaron do you mean like a virtual sensor in IDE? How would i go about linking the battery status to the sensor ? Using tasker ?  
by (3.6k points)
In IFTTT i was able to create this . But it wont turn that socket on . I have pressed check now and nothing, i even waited for the battery to hit 15% and still nothing  
by (1.2k points)
@pachton8 you have phone reception and battery there. Are you setting it up on one device and hoping it works on another? I'd make a dash button in ifttt just to test the functionality of the socket first. Once that works, then integrate the other conditions. But what I meant was to make a virtual on-off device in smartthings, and have that toggle the actual socket. Then get IFTTT to trigger the virtual device (virtual switch) but it looks like your main issue is ifttt not talking to the hive socket, might not be linked right or they might have pulled compatibility, not familiar with hive sockets.  
by (1.2k points)
Quick Google shows hive having issues with IFTTT at times. Got a different smart sockets you can try? Or even trigger a light switch or something else with battery level, to make sure that side of things is working. Then it's just the socket to make work. If it's a hive to IFTTT issue, the virtual device workaround may get around it.  
by (3.6k points)
@lebaron i originally created the applet on the tablet, when that didnt work i tried it on my phone just incase fireOS was causing a problem but still nothing. The hive socket is linked directly to ST via zigbee . But i have also tried using a lamp (zigbee bulb) as the action incase it was just the aocket and still nothing . My IFTTT is linked to ST and it gets these devices directly from ST . The hive hub is in the bin lol so it doesnt use the hive network
by (1.2k points)
Made this myself just now to test and double check, but hitting check-now just checks if there's currently an active trigger, doesn't manually run the scene. You could make a widget button to test it, make sure you can manually trigger the socket make sure that's working. Rule out half the problem.  
by (1.2k points)
Just tried android-battery trigger for device plugged in, working fine. Will have to see if it sends me one later on when battery below 15% but should do, it's worked fine for me in the past. Random thoughts, has ifttt got necessary permissions on your device to check battery and send notifications etc? But that's only one side of it, sounds like you can't trigger the hive socket either? I'd make a test for each and work out where your issue is. But virtual device creator in smartthings could bridge it if you are having some strange issue, it's a handy workaround that takes some incompatibility issues out of the loop sometimes. Let us know if you get this working right, sounds like an interesting solution
by (3.6k points)
I forgot all about button widget as i rarely use ifttt. Button widget operated that hive socket fine. Cant see any permissions though that relates to battery life
by (1.2k points)
@pachton8 ok so it's the trigger, could go back to android battery as trigger and set it as device plugged in, if that works you'll know the permissions are fine and it can read battery status. Random thoughts, before when you let battery drop to 15%, did you let it get to 14%? The trigger says if battery falls below 15%, that may not include 15, might only go for from 14.  
by (3.6k points)
@lebaron ye it went down to 10%. Right so i created a applet on tablet if plugged in then turn on lamp. This works
by (1.2k points)
@pachton8 hmm. So it should all work, maybe just let it run and make a second one, same trigger to notify you when below 15, see if it comes good? Might work yet, seems like it should
by (1.2k points)
@pachton8 what about phone plugged in then turn on hive socket?  
by (3.6k points)
@lebaron just tried that socket now and it worked. Gunna let tablet run down to see if it works now. Though i havent changed anything from yesterday  i will report back
by (1.2k points)
@pachton8 sounds like it should work then, hopefully it will!  
by (3.6k points)
Its at 18% and all set up so just gotta wait. Though i have just realised that when it drops below 20% the tablet goes into "low power" mode. I wonder if this is killing IFTTT . Disabled it for this test anyway
by (1.2k points)
@pachton8 good thinking, could do might be killing the background services that ifttt uses
by (3.6k points)
@lebaron didnt work  
by (3.6k points)
So i have created my first piston linked it to tasker. Manually triggering the task in tasker works as expected. Just waiting for battery percentages to get over 15% so i can test it properly
by (3.6k points)
Winning! Hitting 15% did infact turn on the plug. Be a while to check that hitting 100% turns it off but no reason why it wouldnt . Thanks for your time its much appreciated  
by (1.2k points)
@pachton8 awesome, results then! All good, it was interesting now I have some new ideas of my own. Cheers for letting us know the outcome
by (12.9k points)
@pachton8 you will be using more electricity than keeping it plugged in.  
by (1.3k points)
@lebaron falling back to the very beginning of this, but I use said crude way to make sure my jump kit for my car stays charged. It's on a smart plug that turns on for like 1 hour every other day.  
by (1.1k points)
@pachton8 "piston" so you ended up using webcore for a solution in the end ? I'm not familiar. but see piston mentioned in relation to that. Innr plugs are cheap and smarthings compatible if you need any more & would hopefully work easier with less faffing about being better supported by 3rd party stuff. £10 each those work out to roughly. though if you did want more, I'll test it for you on my stuff before you buy if you want
by (3.6k points)
@lebaron Smith ye i did it in webcore And its flawless. Thinking IFTTT just doesnt like FireOS fire this case maybe. But the benefit of webcore is it allows it to turn off at a certain % also which i didnt have that option in IFTTT so would have had to go another way around it for that part. Its sparked an interest in webcore that i am gunna see what else i can automate in there, seems to add a hell of alot more freedom to things
by (1.1k points)
@pachton8 Is webcore and all it's features bar the dashboard free to use? I've no interest in paying any monthly fees for anything
by (3.6k points)
@lebaron Smith dashboard? Webcore is fully free to use , its a smartapp for ST . By dashboard do you mean actiontiles that i am using ? Actiontiles is not free but a 1 off payment but worth it
by (1.1k points)
Hmm. if I were to try your idea with one of my meross plugs that also monitors power consumption - perhaps programming them to turn off at 100% battery would be possible when there's a drop in power consumption to indicate a full battery  
by (1.1k points)
@pachton8 I might be confused with another platform. free to use, all I need to know. Thanks :)
by (3.6k points)
@lebaron Smith i would say (from my very limited knowledge of it so far) it would absolutely be possible. But dont ask me how just yet  
by (1.1k points)
@pachton8  I might have a play around when bored under lockdown :)
by (3.6k points)
@lebaron Smith its all been on my todo list for ages, now i am furloughed and locked down i have time to play around with it all. Spent the last day or so creating my actiontiles dashboard. Few panels left to polish up then ill be happy . The frame is a cheapy to create a template so i can get some nice wooden frames made up later, mainly to fully hide the charging cable when i wall mount it
by (1.1k points)
@pachton8 Nice :) I'm going to attempt using anymote app to create something similar in the near future via http commands. I'll try on my usual tablet to begin with. then look into having an always on screen like you've setup there
+8 votes
by (15k points)
I believe there is a device handler for fully kiosk that will do this via ST
by (3.6k points)
@hague i didnt know this. But managed to get it running via webcore  thanks
+8 votes
by (620 points)
I used to do exactly this many years ago for our kitchen tablet. I wrote a simple web endpoint smartapp that would turn a switch on and off, and used Tasker to invoke the web endpoint when the charge reached the low and high limits. It worked fine, but I eventually ditched it for a simple motion sensor to turn on the tablet when we're in the kitchen. This, along with a Google DayDream photo screen saver works for our application. When the motion sensor turns on the plug, I have the tablet configured to turn on and it immediately switches to the photo frame app.  
The SmartThings Group is where you can always find questions, answers, advice, reviews & recommendations from other community members about home automation with the Samsung SmartThings hub.

Related questions

...