Get Battery level of Fire Tablet to control power on / off

Anyone know how to do this? I am running a Sharptools Dashboard on a Fire Tablet over Fully Kiosk. Works exactly as I want it to, but there's one thing I can't figure out how to do. I want it to stay plugged in but I don't want want to destroy the battery so I have it plugged into an Ikea Tradfri outlet. Is there any way of sending the current battery level of the Tablet back to Hubitat so that I can turn the Tradfri on and off to keep the battery between, say, 20% and 80%?

1 Like

Maybe something like Tasker could help...? i.e. running on the Fire Tablet, assuming you can install it on the tablet. I eventually want to do something similar, but haven't got around to it yet. There are others here more experienced in Tasker than me, if you decide to take the plunge. I'm assuming Tasker could trigger on the battery level and call a URL in some way, which hopefully could mean you could call a Maker API URL...? All speculation... don't have anything to back this up.

Tasker can absolutely do that. I do that for a wall tablet and spare phone and I am happy to help get it set up. However, I don't know if Tasker runs on a Fire Tablet. Anyone else running Tasker on a Fire?

1 Like

Not sure why it wouldn't...takes all of 30 secs to get Google Play Store on a Fire.

I've downloaded a standard Tasker apk and it's installed and running, so... how do you have this running?

I don't have a Fire and I have read on here that their OS isn't exactly Android and some apps don't work on a Fire tablet.

Now on to the fun.....

First, I recommend doing all of this on your phone so you can copy & paste the endpoints or HTTP Requests. There are 2 options..... 1) Use RM and Local Endpoints which allows you to do anything you want, not just turn off a single plug, light, etc. or 2) Use Maker API.

For OPTION 1....

  1. Create a Rule for TURN OFF PLUG in RM
  2. Trigger is Local Endpoint since your tablet will presumably always be home. Copy this Local Endpoint to your phone.
  3. Action is Turn Off Plug
  4. Now go to Tasker --> New Profile --> State --> Battery Level --> Choose the range for when you want plug to turn off. I set mine From 85 To 100.
  5. Create the Task for that Profile. Step 1 (and only) is HTTP Request with Method of GET. Paste your Local Endpoint into URL
  6. Click Back Arrow
  7. Hit Play Button at bottom left corner of screen to make sure Task does what it is supposed to do.
  8. Repeat steps 1-7 for TURN PLUG ON and set Battery Level From 0 to 30 (or similar).

For OPTION 2...

  1. Install Maker API (if you haven't already)

  2. Check the plug that you are using is selected in Maker API

  3. Copy the URL for Device Command that should look something like this: http://HubitatIPAddress/apps/api/3/devices/[Device ID]/[Command]/[Secondary value]?access_token=xxxxxxxx-xxxx-4xxxx-xxxx-xxxxxxxxxxx. In yours, the "3" will be the app number for your Maker API instance so it will probably be a different number. To get the DeviceID, you can open the device screen on your computer browser and the DeviceID will be in URL.

  4. Now go to Tasker --> New Profile --> Battery Level --> Choose the range for when you want plug to turn off. I set mine From 85 To 100.

  5. Create the Task for that Profile. Step 1 (and only) is HTTP Request with Method of GET. Paste the URL from Maker API. Change [DeviceID] to the DeviceID for the plug you want to change; Change Command to off; delete [Secondary value] so your final should be something like this: http://HubitatIPAddress/apps/api/3/devices/655/off?access_token=xxxxxxxx-xxxx-4xxxx-xxxx-xxxxxxxxxxx

  6. Repeat steps 4 & 5 but create New Profile with Battery Level of 0 to 30 (or similar) for turning on plug and your new URL will be http://HubitatIPAddress/apps/api/3/devices/655/on?access_token=xxxxxxxx-xxxx-4xxxx-xxxx-xxxxxxxxxxx

Let me know if I left something out. I apologize if I did. Writing the instructions is harder than actually doing this.

The benefit of Option 1 is that you can have multiple actions whereas Option 2 is only able to change one device per HTTP request.

The Fully Kiosk Browser Remote Admin API also has a deviceInfo command that includes the battery level.

I'm pretty sure @gavincampbell added it to a recent version of his Fully Kiosk Browser Controller integration... which means it would show up as a device in Hubitat that reports the battery level and you could use it in automations of your choice:

1 Like

I think you are right. Unfortunately my tablet is old Android 4.4 so I can't use Fully Kiosk.

Interesting. The website says Fully Kiosk Browser supports Android 4.4 to 11.

I have 2 different 4.4 tablets and both only show a black screen on Fully Kiosk. I can't even open Hubitat browser page on those tablets either except with Firefox. I get the same black screen. From what I can tell Googling, it's the version of Android Webview that's the problem.

1 Like

So I tried the Fully Kiosk setup, but couldn't figure out how to read the battery status. Any clues? I can use either Rule Machine or Webcore at the other end, don't mind.

In other news, I setup the Tasker solution which so far is working well. My only reservation is that it's another link in the chain, with the Fully Kiosk idea keeping everything a bit more contained. Don't mind though as the Tasker piece so far works really well.

1 Like

So you're running the Fully Kiosk Browser Controller? Did you hit Configure or Ping and so that it grabs the MAC address and updates it in the Device Network of the Device Info section? Once it has that, then try to reboot the tablet.

1 Like