Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Commit

Permalink
feat: Update last active on node messages
Browse files Browse the repository at this point in the history
closes #490
  • Loading branch information
Andreas Hochsteger committed Oct 16, 2020
1 parent 43601f5 commit 1fee054
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/ZwaveClient.js
Expand Up @@ -505,6 +505,7 @@ function nodeReady (nodeid, nodeinfo) {
function valueChanged (nodeid, comclass, valueId) {
var ozwnode = this.nodes[nodeid]
var value_id = getValueID(valueId)
var triggerStatusUpdate = false

parseValue(valueId)

Expand All @@ -521,11 +522,20 @@ function valueChanged (nodeid, comclass, valueId) {
}
// update cache
ozwnode.values[value_id] = valueId

// update last active timestamp
ozwnode.lastActive = Date.now()
triggerStatusUpdate = true
}

// check if node is added as secure node
if (comclass === 0x98 && valueId.index === 0) {
ozwnode.secure = valueId.value
triggerStatusUpdate = true
}

// trigger a status update if something important has changed
if (triggerStatusUpdate) {
this.emit('nodeStatus', ozwnode)
}
}
Expand Down

0 comments on commit 1fee054

Please sign in to comment.