dresden-elektronik / deconz-rest-plugin

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

Fix negative value for sensitivity for Aqara/Xiaomi vibration sensor #7618

Closed Smanar closed 8 months ago

Smanar commented 9 months ago

Untested, I haven't the device, but I don't thing It can cause issues.

{
  "config": {
    "battery": 100,
    "duration": 65,
    "on": true,
    "reachable": true,
    "sensitivity": -8,
    "sensitivitymax": 2,
    "temperature": 2600
  },
  "ep": 1,
  "etag": "241c373ed0ac1b2e46c84b5985520189",
  "lastannounced": null,
  "lastseen": "2024-02-17T16:26Z",
  "manufacturername": "LUMI",
  "modelid": "lumi.vibration.aq1",
  "name": "Vibration Chambre Devant",
  "state": {
    "lastupdated": "2024-02-17T16:26:25.934",
    "orientation": [
      -1,
      79,
      11
    ],
    "tiltangle": 6,
    "vibration": false,
    "vibrationstrength": 4
  },
  "swversion": "0.0.0_0008",
  "type": "ZHAVibration",
}

If user have set a value > 2 for sensitivity on the device before the DDF was used (autorised value could go up to 21), this one was stored on the device. And even it don't have impact, it can make a negative value as return.