Skip to content

Commit

Permalink
add patch for valueId.unit
Browse files Browse the repository at this point in the history
  • Loading branch information
varet80 committed Nov 28, 2020
1 parent 1b9b564 commit 4bb2601
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/Gateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -1362,9 +1362,13 @@ Gateway.prototype.discoverValue = function (node, vId) {

Object.assign(cfg.discovery_payload, sensor.props || {})

if (valueId.units) {
// Discovered valueId.unit also possibly exists. therefore added both unit and units to be
// checked, but only one used
if (valueId.unit) {
// https://github.com/zwave-js/node-zwave-js/blob/master/packages/config/config/scales.json
cfg.discovery_payload.unit_of_measurement = valueId.units
cfg.discovery_payload.unit_of_measurement = valueId.unit
} else if (valueId.units) {
cfg.discovery_payload.unit_of_measurement = valueId.unit
}

// check if there is a custom value configuration for this valueID
Expand Down

0 comments on commit 4bb2601

Please sign in to comment.