Initial version

pull/3474/head
deirdreobyrne 2024-06-26 18:01:18 +01:00 committed by GitHub
parent ccf6c2a7e5
commit e9c8a7f67f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1 @@
0.01: Initial release.

View File

@ -0,0 +1,13 @@
# BLE BTHome Battery Service
Broadcasts battery remaining percentage over BLE using the BTHome protocol
## Usage
This boot code runs in the background and has no user interface.
Based on [BootGATTBat](https://github.com/espruino/BangleApps/tree/master/apps/bootgattbat) by [Jonathan Jefferies](https://github.com/jjok).
## Creator
[Deirdre O'Byrne](https://github.com/deirdreobyrne)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,10 @@
(() => {
var btHomeSequenceNo = 0;
function advertiseBTHomeBattery() {
require("ble_advert").set(0xFCD2, [0x40,0x00,btHomeSequenceNo,0x01,E.getBattery()]);
btHomeSequenceNo = (btHomeSequenceNo + 1) & 255;
}
setInterval(advertiseBTHomeBattery, 5 * 60 * 1000);
advertiseBattery();
})();

View File

@ -0,0 +1,15 @@
{
"id": "bootbthomebatt",
"name": "BLE BTHome Battery Service",
"shortName": "BTHome Battery Service",
"version": "0.01",
"description": "Broadcasts battery remaining over bluetooth using the BTHome protocol.\n",
"icon": "bluetooth.png",
"type": "bootloader",
"tags": "battery,ble,bluetooth,bthome",
"supports": ["BANGLEJS2"],
"readme": "README.md",
"storage": [
{"name":"bthomebat.boot.js","url":"boot.js"}
]
}