Starting version 2.8.0, Bluetooth Battery Monitor supports an API so that 3rd party developers can create their own user interface. This page explains how to enable it and how to use it.
This feature is not enabled by default and needs to be enabled using the following Windows registry settings under the HKEY_CURRENT_USER\Software\Luculent Systems\Bluetooth Battery Monitor\ApiServer
registry key. Please note that this registry key may not exist by default.
Name | Type | Default | Note |
---|---|---|---|
port | DWORD | N/A |
This value must be added to enable the HTTP server for the API support. The HTTP server will listen to the TCP port number specified by this setting. |
ip | String | "127.0.0.1" |
This optional value specifies which IP address the HTTP server will be bound to. If you are using the API only from the local computer, use "127.0.0.1". If you are using the API over the network, please enter the IP address of the network interface. |
These registry settings are checked at the Bluetooth Battery Monitor's startup. So, you need to restart the Bluetooth Battery Monitor (BattMonUI.exe) after changing these registry settings.
Current API implements only one endpoint GET /devices
, which returns the JSON object that contains the following attributes.
Name | Type | Note |
---|---|---|
version | string | Version number of the running Bluetooth Battery Monitor. (e.g. "2.18.0.1") |
devices | array | An array of the device object which contains the information about each Bluetooth device. |
device
object contains the following attributes.
Name | Type | Note |
---|---|---|
name | string | Name of the device as it appears in the user interface. |
icon | string | Path of the device icon resource in the form of "file-path ,-resurce id ". |
level | integer/null | Battery level in percent (0 .. 100). |
connected | bool | Current device connection status. |
secs_since_update | integer/null | The time since this device reported its battery level. |
extra | string/null |
Extra information about the device (if any). For example, for AirPods, this attribute returns "L:50 R:40 C:60" to show the left, right, and case battery level. Please note that the type of information and its format can change without notice. So, plesase do not try to parse this message. |
{ "version": "2.8.0.0", "devices": [ { "connected": false, "extra": null, "icon": "C:\\Windows\\System32\\DDORes.dll,-3022", "level": null, "name": "iPhone", "secs_since_update": null }, { "connected": true, "extra": null, "icon": "C:\\Windows\\System32\\DDORes.dll,-3073", "level": 100, "name": "ThinkPad Compact Bluetooth Keyboard with TrackPoint", "secs_since_update": 18234 } ] }
Open a command prompt window and enter the following command:
reg add "HKCU\Software\Luculent Systems\Bluetooth Battery Monitor\ApiServer" /f /reg:64 /v port /t REG_DWORD /d 9876
This will set up the HTTP server at IP address 127.0.0.1 port 9876.
Enter the following command into the command prompt window: curl http://127.0.0.1:9876/devices
You should see the JSON response.
If you have any questions, suggestions, or bugs to report, please use the in-app feedback window.