diff --git a/README.md b/README.md index 8886e9b139..8dc529ad2b 100644 --- a/README.md +++ b/README.md @@ -354,6 +354,7 @@ Gateway settings: - **Ignore status updates**: Enable this to prevent gateway to send an MQTT message when a node changes its status (dead/sleep == false, alive == true) - **Ignore location**: Enable this to remove nodes location from topics - **Send Zwave Events**: Enable this to send all Zwave client events to MQTT. More info [here](#zwave-events) +- **Include Node Info**: Adds in ValueId json payload two extra values with the Name: `nodeName` and Location `nodeLocation` for better graphing capabilities (usefull in tools like InfluxDb,Grafana) - **Use nodes name instead of numeric nodeIDs**: When gateway type is `ValueId` use this flag to force to use node names instead of node ids in topic. - :star:**Hass discovery**:star:: Enable this to automatically create entities on Hass using MQTT autodiscovery (more about this [here](#robot-home-assistant-integration-beta)) - **Discovery Prefix**: The prefix to use to send MQTT discovery messages to HASS diff --git a/lib/Gateway.js b/lib/Gateway.js index 2b38250954..fd4d74c72e 100755 --- a/lib/Gateway.js +++ b/lib/Gateway.js @@ -291,6 +291,7 @@ function onValueChanged (valueId, node, changed) { case 1: // entire zwave valueId object data = copy(valueId) data.value = tmpVal + break case 2: // just value data = tmpVal @@ -299,6 +300,10 @@ function onValueChanged (valueId, node, changed) { data = { time: Date.now(), value: tmpVal } } + if (this.config.includeNodeInfo && typeof data === 'object') { + data.nodeName = node.name + data.nodeLocation = node.loc + } // valueId is writeable, subscribe for updates if (valueId.writeable && !this.topicValues[topic]) { const levels = topic.split('/').length diff --git a/lib/ZwaveClient.js b/lib/ZwaveClient.js index 1f1c63f654..b472dca20b 100644 --- a/lib/ZwaveClient.js +++ b/lib/ZwaveClient.js @@ -715,7 +715,6 @@ function addValue (zwaveNode, zwaveValue) { function initValue (zwaveNode, zwaveValue, zwaveValueMeta) { const node = this.nodes[zwaveNode.id] - const valueId = updateValueMetadata.call( this, zwaveNode, diff --git a/src/components/Settings.vue b/src/components/Settings.vue index b559d9abe8..f834f80ad7 100644 --- a/src/components/Settings.vue +++ b/src/components/Settings.vue @@ -289,6 +289,14 @@ persistent-hint > + + +