kaklakariada / fritzbox-java-api

Java API for managing FritzBox HomeAutomation
GNU General Public License v3.0
20 stars 14 forks source link

Device.battery and Device.batteryLow: Make 'undefined' detectable #11

Closed philippn closed 4 years ago

philippn commented 4 years ago

Hi there, I have another suggestion to make regarding your API. In the Device class, battery and batteryLow are currently mapped as int. This yields the problem that it is indistinguishable whether the value is 0 or not set at all.

Basically, I see two options here to circumvent this problem:

Thanks again for your nice work and kind regards, Philipp

philippn commented 4 years ago

Please find attached sample Devicelist of a Fritz DECT switch 200 (without battery) and screenshot from code fritz-dect.zip battery-batterylow

kaklakariada commented 4 years ago

Hi @philippn is this what you want: https://github.com/kaklakariada/fritzbox-java-api/pull/12/files#diff-08a9d6a4121e714a8a702a9d5595c483 ? If yes I will include this into a new release.

philippn commented 4 years ago

Hi @kaklakariada, yes, exactly 👍

kaklakariada commented 4 years ago

This is a breaking change, that's why I incremented the version to 1.0.0. You can now download it now from the jcenter maven repo.