I wanted a way to monitor my android’s battery and trigger actions in pimatic depending on battery state. I am no dev but I can use tasker for pretty much anything I have in mind and here is how I’ve done it.
I create a variable on pimatic called android-battery-level
, then I create a simple profile in Tasker which POST %BATT to pimatic every 5 minutes.
curl -k -X PATCH --header "Content-Type:application/json" --data '{"type": "value", "valueOrExpression": %BATT}' --user "user:pass" https://pimatic:port/api/variables/android-battery-level
Then you can use $android-battery-level in your rules
IF
$android-battery-level is decreasing and $android-battery-level < 20
THEN
pushbullet title:"Battery Low" message:"Charge your phone"