Hi. I was thinking it would be nice if the Bangle could advertise it's battery level (so Home Assistant can remind to charge it, for example).
Does anything like this exist? Is a widget the right way to do it? Something like this works for me.
(() => {
function advertiseBattery() {
NRF.setAdvertising([
{0x180F : [E.getBattery()]},
]);
}
setInterval(advertiseBattery, 60 * 1000);
advertiseBattery();
// add your widget
WIDGETS["ble_battery_service"]={
area:"tl", // tl (top left), tr (top right), bl (bottom left), br (bottom right)
width: 0, // how wide is the widget? You can change this and call Bangle.drawWidgets() to re-layout
draw: function() {} // called to draw the widget
};
})()
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi. I was thinking it would be nice if the Bangle could advertise it's battery level (so Home Assistant can remind to charge it, for example).
Does anything like this exist? Is a widget the right way to do it? Something like this works for me.
I'll open a PR if this is sensible. Thanks.