mirror of https://github.com/espruino/BangleApps
Cleanup
parent
e0b3bb0cbe
commit
1a22dbbc5c
|
@ -1,13 +1,11 @@
|
||||||
# BLE BTHome Battery Service
|
# BLE BTHome Battery Service
|
||||||
|
|
||||||
Broadcasts battery remaining percentage over BLE using the [BTHome protocol](https://bthome.io/)
|
Broadcasts battery remaining percentage over BLE using the [BTHome protocol](https://bthome.io/) - which makes for easy integration into [Home Assistant](https://www.home-assistant.io/)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
This boot code runs in the background and has no user interface.
|
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
|
## Creator
|
||||||
|
|
||||||
[Deirdre O'Byrne](https://github.com/deirdreobyrne)
|
[Deirdre O'Byrne](https://github.com/deirdreobyrne)
|
||||||
|
|
|
@ -1,17 +1,7 @@
|
||||||
var btHomeBatterySequence = 0;
|
var btHomeBatterySequence = 0;
|
||||||
|
|
||||||
function advertiseBTHomeBattery() {
|
function advertiseBTHomeBattery() {
|
||||||
var advert = [ 0x40, /* BTHome Device Information
|
var advert = [0x40, 0x00, btHomeBatterySequence, 0x01, E.getBattery()];
|
||||||
bit 0: "Encryption flag"
|
|
||||||
bit 1-4: "Reserved for future use"
|
|
||||||
bit 5-7: "BTHome Version" */
|
|
||||||
|
|
||||||
0x00, // Sequence number
|
|
||||||
btHomeBatterySequence,
|
|
||||||
|
|
||||||
0x01, // Battery, 8 bit
|
|
||||||
E.getBattery()
|
|
||||||
];
|
|
||||||
|
|
||||||
if(Array.isArray(Bangle.bleAdvert)){
|
if(Array.isArray(Bangle.bleAdvert)){
|
||||||
var found = false;
|
var found = false;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"name": "BLE BTHome Battery Service",
|
"name": "BLE BTHome Battery Service",
|
||||||
"shortName": "BTHome Battery Service",
|
"shortName": "BTHome Battery Service",
|
||||||
"version": "0.01",
|
"version": "0.01",
|
||||||
"description": "Broadcasts battery remaining over bluetooth using the BTHome protocol.\n",
|
"description": "Broadcasts battery remaining over bluetooth using the BTHome protocol - makes for easy integration with Home Assistant.\n",
|
||||||
"icon": "bluetooth.png",
|
"icon": "bluetooth.png",
|
||||||
"type": "bootloader",
|
"type": "bootloader",
|
||||||
"tags": "battery,ble,bluetooth,bthome",
|
"tags": "battery,ble,bluetooth,bthome",
|
||||||
|
|
Loading…
Reference in New Issue