pycom / pycom-micropython-sigfox

A fork of MicroPython with the ESP32 port customized to run on Pycom's IoT multi-network modules.
MIT License
198 stars 167 forks source link

LoRaWAN MAC Battery Level reporting #47

Closed ha5di closed 7 years ago

ha5di commented 7 years ago

Board: LoPy

Firmware: 1.7.8.b1

There is a lora.set_battery_level(level) method introduced in latest firmware.

Unfortunately current implementation is not in line with LoraWAN Specification v1.0.2

Method is passing values between 0 and 100 to the LoRaWAN server directly which means on server side 39% for level=100, 20% for level=50, there are no way to report battery level 40-100%.

Default value is 0 which indicates device is running on external source, level=0 doesn't mean 0%. Proper default value would be 255 which by the way can't be reported via this method.

I advice to allow level=0...255 in the method inpput argument and use level=255 as default, adding the quoted text from the LoRaWAN specification to the documentation.

Forum reference: https://forum.pycom.io/topic/1613/lorawan-mac-battery-level-reporting

(from bmarkus)

danicampora commented 7 years ago

Fixed. Thanks!