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:
Key:value
So for our case we want the system variable %BATT to come across in the battery parameter:
Amazing! Thank you Very much. When I try to replicate the sharptools variable I am asked to create a variable. When I try to create the variable $Batteryphone (text) it asks for a value ?
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?
Can you please share screenshots of where you’re having difficulty? I would also refer to the explanation / description I added to the screenshots post.
I would also encourage a read through of the How to Trigger SharpTools Rules using HTTP article I linked above as it has examples, screenshots, and GIFs showing the concepts.
Sorry about all the messages lol… I manage to get it right and now I get the % - see the logs. However the tile (I have added the rule as a tile, right) is still not displaying any data.
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.
Yes, it would either need to be a separate tile or you could change the variable to a Text type and within Tasker conditionally choose whether you sent the battery level or the charging status.
I’ve noted the feedback as we’ve been considering a ‘Super Tile’ of sorts that would allow you to combine data from multiple Things or Variables.
There’s not a configuration setting for it, but you could use Custom CSS if you don’t mind tinkering a bit.
Please note that any custom CSS snippets provided are not officially supported and may need to be adjusted with potential future changes to the SharpTools web app.
I am trying to target custom css to my specific tile but i think i am messing it up.
I have created a new style for my active theme called “battery” but i think i need some help to create the css - see below LOL. That is not working. Any help is much apricated!
Please note that any custom CSS snippets provided are not officially supported and may need to be adjusted with potential future changes to the SharpTools web app.
I am editing the tile and have selected the battery100 style (that lives under battery theme, which is selected for the dashboard). The % is not visible.