Condition - Battery Level BLE

henne10

New member
Hello,

first off all I want to say I'm a happy user off macrodroid after a Long journey from tasker to automatic and now a few years macrodroid.

Now my feature request.

I'm seeking for an trigger to monitor the battery off an BLE Device, I was able to read the battery state with the App BlueBatt.

After some deeper research I found this post: https://automagic4android.com/condition_battery_level_ble_en.html

Is it possible to implement such feature or is there another way that I was not able to find.
 

chaoscreater

Active member
I recommend to try searching in the template store before asking questions here. You'll probably find that the solution you seek is already out there.

Search for id=12643 (1. Check bluetooth battery level) in the store. I think this is probably what you want and you can just tweak it.

Also, according to the reviews, BlueBatt has a measly 2.5/5 stars and some people reported it as adware. Should avoid that.
 

Dm114

Well-known member
Hello,

first off all I want to say I'm a happy user off macrodroid after a Long journey from tasker to automatic and now a few years macrodroid.

Now my feature request.

I'm seeking for an trigger to monitor the battery off an BLE Device, I was able to read the battery state with the App BlueBatt.

After some deeper research I found this post: https://automagic4android.com/condition_battery_level_ble_en.html

Is it possible to implement such feature or is there another way that I was not able to find.
You can use the following Intent received trigger: android.bluetooth.device.action.BATTERY_LEVEL_CHANGED
 

henne10

New member
Thank's for replay...
Both suggested solutions does not work because the device is not connected/paired with the phone...

and for sure I've seek in the template store.

and what concerns the app BlueBatt I don't care cause Ads are blocked and the App does not have Internet access.


Maybe the library that is used to find BLE Beacon can also read battery stats?!
 

Dm114

Well-known member
I recommend to try searching in the template store before asking questions here. You'll probably find that the solution you seek is already out there.

Search for id=12643 (1. Check bluetooth battery level) in the store. I think this is probably what you want and you can just tweak it.

Also, according to the reviews, BlueBatt has a measly 2.5/5 stars and some people reported it as adware. Should avoid that.
I guess it's not so easy for newcomers to search in the template store gathering thousands of macros. Some of them are even made by newbies, proud of their first macros. But, unfortunately, they don't always work. Or don't work reliably.

The one you want to promote (yours posted a few minutes ago) should work but is made to meet your own requirements (with many disabled actions left) and is not very easy to understand to newbies...
 

Dm114

Well-known member
Thank's for replay...
Both suggested solutions does not work because the device is not connected/paired with the phone...

and for sure I've seek in the template store.

and what concerns the app BlueBatt I don't care cause Ads are blocked and the App does not have Internet access.


Maybe the library that is used to find BLE Beacon can also read battery stats?!
Sorry but I don't understand how you want to monitor your BT battery without pairing the device to your mobile... 🤔
 

henne10

New member
First of all I'm not a new user, only because I'm new here in the forum it tells not that I'm new to macrodroid, as you can read in my first post.


Okay I'll more describe the scenario.
I've a ANT+ Speed sensor for my Bike Computer wich has also a BT chip.
The sensor is connected to the BC and not to the smartphone.
My idea is now that I receive a notification if the battery level is lower than X%.

Edit: Battery state only populated over BT and not ANT.
 
Last edited:

chaoscreater

Active member
I guess it's not so easy for newcomers to search in the template store gathering thousands of macros. Some of them are even made by newbies, proud of their first macros. But, unfortunately, they don't always work. Or don't work reliably.

The one you want to promote (yours posted a few minutes ago) should work but is made to meet your own requirements (with many disabled actions left) and is not very easy to understand to newbies...
The macro I posted literally has the same intent that you posted (android.bluetooth.device.action.BATTERY_LEVEL_CHANGED). I wasn't promoting my macro either. It's just a template that he could use as a reference.

My macro is actually pretty simple and straightforward. If the battery of the bluetooth device changes, it'll popup a message showing the battery %. If the battery % is at 30%, 20% or 10%, then it will also say this out loud. If that's not battery monitoring, then I don't know what is.

Also, searching for macros in the store isn't something that only a PRO should know how to do. I was a noob once (and still am) and I always do my research online and try to search for keywords in the store to find what I need. The macro I shared is literally someone else's macro, which I cloned and modified (only slightly) to suit my needs.


Anyway, back to the topic. OP said this:
monitor the battery off an BLE Device

Well, you have to connect a bluetooth device to your phone. How else would your phone be able to "monitor" it?
 
Last edited:

chaoscreater

Active member
First of all I'm not a new user, only because I'm new here in the forum it tells not that I'm new to macrodroid, as you can read in my first post.


Okay I'll more describe the scenario.
I've a ANT+ Speed sensor for my Bike Computer wich has also a BT chip.
The sensor is connected to the BC and not to the smartphone.
My idea is now that I receive a notification if the battery level is lower than X%.

Edit: Battery state only populated over BT and not ANT.

How is your phone going to monitor anything, if you don't connect to the device that you want to monitor?
 

henne10

New member
maybe the lib have to do it.
give them the BT MAC.
Do background scans for the MAC every X Minutes, like search for beacon....

When found the Lib do a connect, get info store in Array or var or something like that.

anyway it seemed that there was a lib there that can do it, so I do not know what about we discuss here.
 

chaoscreater

Active member
maybe the lib have to do it.
give them the BT MAC.
Do background scans for the MAC every X Minutes, like search for beacon....

When found the Lib do a connect, get info store in Array or var or something like that.

anyway it seemed that there was a lib there that can do it, so I do not know what about we discuss here.

That didn't answer my question....

And if you want to do a "connect" as an Action in Macrodroid, then it's not possible as far as I know. Under Actions, lookup Bluetooth and you'll find that there are only options for enabling/disabling bluetooth, connecting/disconnecting from an audio device. There isn't a generic "connect bluetooth device XYZ" option.

And also, you can't just query a Bluetooth device's battery whenever you want. If you have a read at the Play Store reviews for the app that you suggested using (BlueBatt), you'll find that a lot of people complained about inaccurate battery readings and that the reading only works when you connect to the bluetooth device.

Basically, Android uses what's called "intents". When you connect to a bluetooth device, this registers an intent event. When the event is triggered, you can then read data off it. Whenever there's a change in the battery of the device, it will trigger another intent and this will then be received by your phone (assuming it was already connected to your bluetooth device).

Generally, bluetooth devices will generate an intent every 5%~10%. I have 2x Bluetooth headphones and at every 10% battery decrease, an intent is generated. In the macro that I shared with you, the intent is used as the trigger. For the action, I'm basically popping a message on the screen to show the battery %.

Anyway, not sure how else I can help you. Good luck.
 
Top