Skip to content

Commit

Permalink
fix: missing discovery #109 #108 (#112)
Browse files Browse the repository at this point in the history
Co-authored-by: V. Aretakis <v.aretakis@elsevier.com>
Co-authored-by: Daniel Lando <daniel.sorridi@gmail.com>
  • Loading branch information
3 people authored Dec 28, 2020
1 parent 967a28f commit 45bcdfe
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/Gateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -1463,6 +1463,9 @@ Gateway.prototype.discoverValue = function (node, vId) {
case CommandClasses['Central Scene']:
case CommandClasses['Scene Activation']:
cfg = copy(hassCfg.central_scene)
cfg.object_id = [cfg.object_id, valueId.propertyKey, valueId.property]
.filter(v => !!v)
.join('_')
break
case CommandClasses['Binary Sensor']:
// https://github.com/zwave-js/node-zwave-js/blob/master/packages/zwave-js/src/lib/commandclass/BinarySensorCC.ts#L41
Expand Down Expand Up @@ -1592,8 +1595,15 @@ Gateway.prototype.discoverValue = function (node, vId) {
}

cfg = copy(hassCfg.sensor_generic)
// Assemble an object ID including propertyKey and property.
// PropertyKey is set before property as propertyKey can have multiple relevant properties.
cfg.object_id =
sensor.sensor + (sensor.objectId ? '_' + sensor.objectId : '')
if (valueId.propertyKey) {
cfg.object_id +=
(valueId.propertyKey ? '_' + valueId.propertyKey : '') +
(valueId.property ? '_' + valueId.property : '')
}

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

Expand Down

0 comments on commit 45bcdfe

Please sign in to comment.