I was trying to find any relevant threads before asking this question but I was not lucky .
I want to get both of my android watch / mobile device battery level on two different tiles. Also I would like the battery % to change colour as the battery repletes and also react if the device goes on charger!
I have basic tasker knowledge but I am completely lost on how to use the http commands to send my battery data to sharptools. I know what variable(s) I need to send with my task but I don’t know how to create the task - I know how to trigger it though!
Is there anyone who could point me to the right direction please? Any recommendations or even screenshots or either the tasker “task” or the sharptools rules would be much appreciated - appreciate this is not a tasker forum lol but any help would be much appreciated!
Starting with the SharpTools Rule, in the Triggers section we add an Event → HTTP Trigger and optionally define the parameter name battery within the HTTP Trigger in advance.
Then in the rule Flow, we add an Action → Set Variable where we select a target SharpTools variable to set the value to, then set the source as Variable → Context Variable → Event → HTTP Event → Parameters → Battery.
If you didn’t define the battery parameter in the HTTP Trigger, you can select the HTTP Event → Parameters → Custom Parameter option and type `battery here.
On the Tasker side, we’re using a Net → HTTP Request action with the GET method. Our URL is copied from the SharpTools HTTP Trigger and the Query Parameters are in the weird Tasker format:
So for our case we want the system variable %BATT to come across in the battery parameter:
I have successfully created the tasker task but I am struggling with the sharptools variable setup.
If I create the variable as a text with 0, then when I try to add it to the rule (I guess as a manual input, right) I cannot add $context.eventparams.battery value . I can only input a value?
Also, what is the best way for the tile to change colour once the device is plugged in? I was not able to find any customizations for that variable tile. Do i need to make a new one?
(Tasker will be sharing the trigger via HTTP).
@George_Vassilakis, have you setup in Tasker to send a HTTP request to update the variable accordingly when the device is plugged in? You can customize the tile style to show different color when a variable value is set to “plugged in” or whatever desired. However, the challenge is you will need a different variable for this because the variable tile can only display one value at a time. You can show either the battery level or the charge status in your variable since your variable is a TEXT variable, but not both in the same time. If you want to set both battery level and the charge status to the same variable, you will need to make sure the Tasker doesn’t send the batter level HTTP request when the device is plugged in so the charge status doesn’t get over written in the variable.
Thanks James. The battery variable is configured as a number not text in Sharptools. The way i have setup the current tile is - please below - based on the battery % vs colour.
Is there a way to add the logic for charging / not charging on the same tile? I understand that i need to setup a new variable from tasker - but would that need to be shown as a different tile ?
Also, how can i add the “%” on my tile. Many thanks for your support.