Fix battery values for Aqara H1 WRS-R02
"at": "0x0020",
"cl": "0x0001",
"ep": 1,
- "fn": "zcl",
- "script": "xiaomi_battery.js"
+ "eval": "const vmin = 25; const vmax = 30; let bat = Attr.val; if (bat > vmax) { bat = vmax; } else if (bat < vmin) { bat = vmin; } bat = ((bat - vmin) / (vmax - vmin)) * 100; if (bat > 100) { bat = 100; } else if (bat <= 0) { bat = 1; } Item.val = bat;",
+ "fn": "zcl"
},
"read": {
"fn": "None"
