Skip to content

Commit

Permalink
fix: missing ccSpecific values (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
varet80 authored Nov 30, 2020
1 parent 815b497 commit ac4ed9a
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/Gateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -1317,11 +1317,23 @@ Gateway.prototype.discoverValue = function (node, vId) {
// https://github.com/zwave-js/node-zwave-js/blob/master/packages/zwave-js/src/lib/commandclass/MultilevelSensorCC.ts
if (cmdClass === CommandClasses['Multilevel Sensor']) {
// https://github.com/zwave-js/node-zwave-js/blob/master/packages/config/config/sensorTypes.json
sensor = Constants.sensorType(valueId.ccSpecific.sensorType)
// In some cases Multilevel Sensors offer Reset option or DeltaTime sensors, but do not include ccSpecific
// information. With this change, we target only the sensors and not the additional Properties.
if (valueId.ccSpecific) {
sensor = Constants.sensorType(valueId.ccSpecific.sensorType)
} else {
return
}
} else if (cmdClass === CommandClasses.Meter) {
// https://github.com/zwave-js/node-zwave-js/blob/master/packages/zwave-js/src/lib/commandclass/MeterCC.ts
// https://github.com/zwave-js/node-zwave-js/blob/master/packages/config/config/meters.json
sensor = Constants.meterType(valueId.ccSpecific.meterType)
// In some cases Metering devices offer Reset option or DeltaTime sensors, but do not include ccSpecific
// information. With this change, we target only the sensors and not the additional Properties.
if (valueId.ccSpecific) {
sensor = Constants.meterType(valueId.ccSpecific.meterType)
} else {
return
}
} else if (cmdClass === CommandClasses['Pulse Meter']) {
sensor = {
sensor: 'pulse',
Expand Down

0 comments on commit ac4ed9a

Please sign in to comment.