gbridge: Include charging state in battery updates to phone

master
Richard de Boer 2022-02-01 21:10:26 +01:00
parent 6315a192d6
commit f131426976
No known key found for this signature in database
GPG Key ID: 8721727971871937
4 changed files with 6 additions and 3 deletions

View File

@ -26,3 +26,4 @@
0.24: tag HRM power requests to allow this to work alongside other widgets/apps (fix #799) 0.24: tag HRM power requests to allow this to work alongside other widgets/apps (fix #799)
0.25: workaround call notification 0.25: workaround call notification
Fix inflated step number Fix inflated step number
0.26: Include charging status in battery updates to phone

View File

@ -11,11 +11,12 @@ t can be one of "info", "warn", "error"
## report battery level ## report battery level
``` ```
{ "t": "status", "bat": 30, "volt": 30 } { "t": "status", "bat": 30, "volt": 30, "chg": 0 }
``` ```
* bat is in range 0 to 100 * bat is in range 0 to 100
* volt is optional and should be greater than 0 * volt is optional and should be greater than 0
* chg is optional and should be either 0 or 1 to indicate the watch is charging
## find phone ## find phone

View File

@ -1,7 +1,7 @@
{ {
"id": "gbridge", "id": "gbridge",
"name": "Gadgetbridge", "name": "Gadgetbridge",
"version": "0.25", "version": "0.26",
"description": "(NOT RECOMMENDED) Displays Gadgetbridge notifications from Android. Please use the 'Android' Bangle.js app instead.", "description": "(NOT RECOMMENDED) Displays Gadgetbridge notifications from Android. Please use the 'Android' Bangle.js app instead.",
"icon": "app.png", "icon": "app.png",
"type": "widget", "type": "widget",

View File

@ -256,7 +256,7 @@
} }
function sendBattery() { function sendBattery() {
gbSend({ t: "status", bat: E.getBattery() }); gbSend({ t: "status", bat: E.getBattery(), chg: Bangle.isCharging()?1:0 });
} }
// Send a summary of activity to Gadgetbridge // Send a summary of activity to Gadgetbridge
@ -268,6 +268,7 @@
// Battery monitor // Battery monitor
NRF.on("connect", () => setTimeout(sendBattery, 2000)); NRF.on("connect", () => setTimeout(sendBattery, 2000));
Bangle.on("charging", sendBattery);
setInterval(sendBattery, 10*60*1000); setInterval(sendBattery, 10*60*1000);
sendBattery(); sendBattery();
// Activity monitor // Activity monitor