Skip to content

Commit

Permalink
Merge pull request #6074 from SwoopX/wrsr02
Browse files Browse the repository at this point in the history
Fix battery values for Aqara H1 WRS-R02
  • Loading branch information
manup authored May 24, 2022
2 parents b310485 + 9bad8eb commit 6499c08
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions devices/xiaomi/xiaomi_wrs-r02_h1_switch.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
"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"
Expand Down

0 comments on commit 6499c08

Please sign in to comment.