mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-07-25 04:52:14 +00:00
Better battery status parsing.
This commit is contained in:
+10
-5
@@ -29,11 +29,16 @@ const parsers = [
|
||||
cid: 'genBasic',
|
||||
attribute: true,
|
||||
parse: (msg, publish) => {
|
||||
if (msg.data.data['65282']) {
|
||||
const voltage = msg.data.data['65282']['1'].elmVal;
|
||||
if (voltage) {
|
||||
return {battery: toPercentage(voltage, battery.min, battery.max)}
|
||||
}
|
||||
let voltage = null;
|
||||
|
||||
if (msg.data.data['65281']) {
|
||||
voltage = msg.data.data['65281']['1'];
|
||||
} else if (msg.data.data['65282']) {
|
||||
voltage = msg.data.data['65282']['1'].elmVal;
|
||||
}
|
||||
|
||||
if (voltage) {
|
||||
return {battery: toPercentage(voltage, battery.min, battery.max)}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user