benzman81 / homebridge-nukiio

Nuki.io support for Homebridge: https://github.com/nfarina/homebridge
GNU General Public License v3.0
42 stars 5 forks source link

Battery Status at Opener wrong #69

Closed Skjall closed 3 years ago

Skjall commented 3 years ago

The Opener has no battery level. The API returns only a bool for batteryCritical. The Plugin seems to expect a "batteryChargeState" and therefore creates a reading for the battery level, which is always 0.

{
    "deviceType": 2,
    "nukiId": xxxxx,
    "name": "Haus",
    "firmwareVersion": "1.6.2",
    "lastKnownState": {
        "mode": 3,
        "state": 1,
        "stateName": "online",
        "batteryCritical": false,
        "ringactionTimestamp": "2020-12-04T10:34:16+00:00",
        "ringactionState": false,
        "timestamp": "2020-12-05T17:46:01+00:00"
    }
}
benzman81 commented 3 years ago

will check

benzman81 commented 3 years ago

I cannot reproduce this. The plugin logic actually expects this and uses the batteryCritical flag to use some content numbers:

batteryChargeState = json.batteryChargeState ? json.batteryChargeState: batteryCritical ? Constants.BATTERY_LOW : Constants.BATTERY_FULL;

Constants.BATTERY_FULL : 100,
Constants.BATTERY_LOW : 5
Skjall commented 3 years ago

I think you can close it. Maybe the state was flapping on the edge of too low voltage and therefore the plug-in call saw a low battery and mine not. I just took a look in the Nuki App and now the battery was actually low. So.... not a bug. Thanks!