OpenZWave / node-openzwave-shared

OpenZWave addon for Node.js (all versions) including management and security functions
Other
199 stars 113 forks source link

battery level #240

Closed patryk-kawalarz closed 5 years ago

patryk-kawalarz commented 6 years ago

How to get current battery level of any node?

ekarak commented 5 years ago

again., usage question in the bugfix forum. Short answer: Use an event handler on the relevant valueId for the battery level notification (command class 128 decimal)

var zwnode = context.global.openzwaveNodes[msg.payload.nodeid];
if (zwnode && msg.payload && msg.payload.cmdclass == 128) {
  return({"topic": "write", "payload": {"zwmsg": msg, "zwnode": zwnode}});
}