zwave-js
Version:
Z-Wave driver written entirely in JavaScript/TypeScript
30 lines • 785 B
JavaScript
export function getDefaultHailHandlerStore() {
return {
busyPolling: false,
};
}
/** Handles the receipt of a Hail */
export async function handleHail(ctx, node, _command, store) {
// treat this as a sign that the node is awake
node.markAsAwake();
if (store.busyPolling) {
ctx.logNode(node.id, {
message: `Hail received from node, but still busy with previous one...`,
});
return;
}
ctx.logNode(node.id, {
message: `Hail received from node, refreshing actuator and sensor values...`,
});
try {
store.busyPolling = true;
await node.refreshValues();
}
catch {
// ignore
}
finally {
store.busyPolling = false;
}
}
//# sourceMappingURL=HailCC.js.map