diff --git a/lib/Gateway.js b/lib/Gateway.js index f44e6010bde..5ad23de795e 100755 --- a/lib/Gateway.js +++ b/lib/Gateway.js @@ -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