You can control a Homey plug from your Android tablet based on tablet battery SoC to dynamically charge your tablet. You can use the Android “Tasker” app.
The tasker app has tabs for triggers (Profile) and actions (Tasks). You can create a trigger/profile to react on a device event. Then you create a task with an action. This task is assigned to the trigger, so it’s executed if the trigger occours.
You can deactivate profiles if you want to stop using them wirhout deleting.
STEP 1: Add a profile
Create a profile and select the “Event” type.
Select “Charging”/“Battery” category, then select “Battery changed” event.
STEP 2: Create a task
Now Tasker asks you to select a task. Create a new one and give it a name.
Add an action to your task.
Select “Network” category and “HTTP request” action.
Insert the Homey Webhook URL. Add your Wekhook event (event=xxx) that can be used as Homey trigger. Then add the tag (tag=xxx) to pass the current battery state.
Select the “BATT” variable from the list using the icon at the right.
STEP 3: Add Homey Webhook
Add an AdvancedFlow.
Add the Webhook trigger and insert your event name used in Tasker.
The tag holds the battery state passed as tag in your Webhook URL.
Now you can convert the tag into a number tag and check the value to turn on or off your plug.