dresden-elektronik / deconz-rest-plugin

deCONZ REST-API plugin to control ZigBee devices
BSD 3-Clause "New" or "Revised" License
1.9k stars 499 forks source link

IKEA Styrbar battery remaining percentage is not correct #7088

Closed Gloomyeye closed 1 year ago

Gloomyeye commented 1 year ago

Describe the bug

The issue #6761 with the pull request #6984 corrects the left and right buttons. However, after installing the current deconz version 2.22.2, the battery level of my IKEA styrbar with firmware 2.4.5 is always 0 in home assistant. There was no success with a new reconnect / deletion of the device in deconz.

Steps to reproduce the behavior

Check the battery percentage remaining attribute of the device

Bildschirmfoto 2023-07-05 um 14 28 31

Expected behavior

The battery level / remaining percentage of the device should be given.

Screenshots

Bildschirmfoto 2023-07-05 um 14 23 54 Bildschirmfoto 2023-07-05 um 14 23 47

Environment

deCONZ Logs

Additional context

This is the DDF binding:


  "schema": "devcap1.schema.json",
  "manufacturername": "$MF_IKEA",
  "modelid": "Remote Control N2",
  "product": "STYRBAR remote control",
  "sleeper": true,
  "status": "Gold",
  "path": "/devices/ikea/styrbar_remote_control.json",
  "subdevices": [
    {
      "type": "$TYPE_SWITCH",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x1000"
      ],
      "fingerprint": {
        "profile": "0x0104",
        "device": "0x0820",
        "endpoint": "0x01",
        "in": [
          "0x0000",
          "0x0001",
          "0x1000"
        ],
        "out": [
          "0x0006",
          "0x0008",
          "0x0005"
        ]
      },
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion"
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "config/battery",
          "parse": {
            "at": "0x0021",
            "cl": "0x0001",
            "ep": 1,
            "eval": "Item.val = Math.round(Attr.val / 2)",
            "fn": "zcl"
          },
          "default": 0
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/buttonevent"
        },
        {
          "name": "state/lastupdated"
        }
      ]
    }
  ],
  "bindings": [
    {
      "bind": "unicast",
      "src.ep": 1,
      "cl": "0x0001",
      "report": [
        {
          "at": "0x0021",
          "dt": "0x20",
          "min": 300,
          "max": 2700,
          "change": "0x00000001"
        }
      ]
    },
    {
      "bind": "unicast",
      "src.ep": 1,
      "cl": "0x0006"
    },
    {
      "bind": "unicast",
      "src.ep": 1,
      "cl": "0x0008"
    },
    {
      "bind": "unicast",
      "src.ep": 1,
      "cl": "0x0005"
    }
  ]
}
Gloomyeye commented 1 year ago

@ebaauw : Maybe you can verify this with your device. Do you have the same behaviour?

ebaauw commented 1 year ago

Mine reports Battery Percentage Remaining as 200 in the GUI and config/battery 100 in the API.

Refresh these values reading the Power Configuration cluster attributes in the GUI, while pressing buttons on the STYRBAR. to make sure it's awake. If it still reports 255, you might need to remove and re-insert the battery.

Gloomyeye commented 1 year ago

Ah! Thanks for your quick response! That worked. Removing and inserting again the battery was the solution. Now, it reports 200 and not 255 (like before).