Skip to content

Commit

Permalink
Support battery properties on more devices.
Browse files Browse the repository at this point in the history
Fixes #266
  • Loading branch information
mrstegeman committed Dec 8, 2020
1 parent 53be3de commit 9dc6b2d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@
}
},
"short_name": "Zigbee",
"version": "0.15.3"
"version": "0.15.4"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zigbee-adapter",
"version": "0.15.3",
"version": "0.15.4",
"description": "Zigbee adapter plugin for WebThings Gateway",
"author": "WebThingsIO",
"main": "index.js",
Expand Down
13 changes: 12 additions & 1 deletion zb-classifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -1055,8 +1055,19 @@ class ZigbeeClassifier {
);
}

// Some devices report that they have a power source of "unknown" but are
// actually battery powered.
const hasBattery = [
'1116-S', // Iris V3 Contact Sensor
'motionv4', // SmartThings V4 Motion Sensor
'motionv5', // SmartThings V5 Motion Sensor
'multiv4', // SmartThings V4 Multi Sensor
'tagv4', // SmartThings V4 Arrival Sensor
];

// Bit 7 indicates the backup power source, i.e. battery
if (node.isBatteryPowered() || node.powerSource & 0x80 !== 0) {
if (node.isBatteryPowered() || node.powerSource & 0x80 !== 0 ||
hasBattery.includes(node.modelId)) {
this.addProperty(
node, // device
'batteryVoltage', // name
Expand Down

0 comments on commit 9dc6b2d

Please sign in to comment.