LightNetwork device battery level

(episode n in my effort to read my connected devices)

I have a Varia UT-800 front light and I'm trying to access the battery level. When the network is formed, I can see the light in the LightNetwork.getBikeLights() list but even though the LightNetwork is a subclass of Device, the getComponentIdentifiers() list is null so I can't use Device.getBatteryStatus(identifier). How is the reading of the battery level done?

Thanks in advance,

  Nik

Parents
  • The documentation for Device.getBatteryStatus() says that the identifier parameter is null for a single component device, or a light index for bike lights. Given the Varia UT-800 is a bike light, I'd expect you'd need to pass a light index.

    I've never written any code to use the BikeLight stuff, but it looks like the LightNetwork.getBikeLights() method returns an array of BikeLight. The BikeLight class inherits from AntPlus.CommonData, and AntPlus.CommonData has an identifier field which is documented to be the light index.

Reply
  • The documentation for Device.getBatteryStatus() says that the identifier parameter is null for a single component device, or a light index for bike lights. Given the Varia UT-800 is a bike light, I'd expect you'd need to pass a light index.

    I've never written any code to use the BikeLight stuff, but it looks like the LightNetwork.getBikeLights() method returns an array of BikeLight. The BikeLight class inherits from AntPlus.CommonData, and AntPlus.CommonData has an identifier field which is documented to be the light index.

Children