sandeepmistry / node-sensortag

Node.js lib for the TI SensorTag
MIT License
218 stars 111 forks source link

How to get the battery level? #94

Closed rei-vilo closed 7 years ago

rei-vilo commented 7 years ago

added battery service mixin from noble has just been added, but how to get the battery level?

Thank you!

micahnyc commented 7 years ago

Hi @rei-vilo you can read the battery in a similar way to the other properties:

tag.readBatteryLevel(function(error, batteryLevel) { console.log(tag.id, " battery read with error:", error, " level:", batteryLevel); });

sandeepmistry commented 7 years ago

@micahnyc thank's for helping out!

I've added it to the read me in https://github.com/sandeepmistry/node-sensortag/commit/27d820558c535a06aa8a78fd6607a026b2579292.

sandeepmistry commented 7 years ago

v1.3.0 has been published to npm with the new feature.