node-red-contrib-zwave-js 7.2.0-beta.2 → 7.2.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-zwave-js",
3
- "version": "7.2.0-beta.2",
3
+ "version": "7.2.0-beta.3",
4
4
  "license": "MIT",
5
5
  "description": "The most powerful, high performing and highly polished Z-Wave node for Node-RED based on Z-Wave JS. If you want a fully featured Z-Wave framework in your Node-RED instance, you have found it.",
6
6
  "dependencies": {
@@ -277,6 +277,8 @@ const ZwaveJsUI = (function () {
277
277
  let HoveredNode = undefined; // Hovered Node
278
278
  let selectedNode; // Selected Node
279
279
  let LastTargetForBA; // BA TArget
280
+ let WakeResolver; // Resolve for wake wait
281
+ let WakeResolverTarget; // Target Wake Node
280
282
 
281
283
  function modalAlert(message, title) {
282
284
  const Buts = {
@@ -720,6 +722,24 @@ const ZwaveJsUI = (function () {
720
722
  });
721
723
  }
722
724
 
725
+ async function WaitForNodeWake(NodeID) {
726
+ const WD = modalPrompt(
727
+ 'This device is asleep, please wake it up...',
728
+ 'Waiting for device to wake up',
729
+ [],
730
+ false
731
+ );
732
+
733
+ WakeResolverTarget = NodeID;
734
+ await new Promise((res) => {
735
+ WakeResolver = res;
736
+ });
737
+
738
+ WakeResolver = undefined;
739
+ WakeResolverTarget = undefined;
740
+ WD.dialog('destroy');
741
+ }
742
+
723
743
  function AssociationMGMT() {
724
744
  ControllerCMD(
725
745
  DCs.getAllAssociationGroups.API,
@@ -738,17 +758,13 @@ const ZwaveJsUI = (function () {
738
758
  title: `ZWave Association Management: Node ${HoveredNode.nodeId}`,
739
759
  minHeight: 75,
740
760
  buttons: {
741
- 'Commit Changes': function () {
761
+ 'Commit Changes': async function () {
742
762
  const nodeRow = $('#zwave-js-node-list').find(
743
763
  `[data-nodeid='${HoveredNode.nodeId}']`
744
764
  );
745
765
 
746
766
  if (nodeRow.data().info.status.toUpperCase() === 'ASLEEP') {
747
- modalAlert(
748
- 'This node is a sleep, please wake up the node before commiting Association changes',
749
- 'Node is a sleep'
750
- );
751
- return;
767
+ await WaitForNodeWake(HoveredNode.nodeId);
752
768
  }
753
769
 
754
770
  const Removals = $('#zwave-js-associations-table').find(
@@ -2438,17 +2454,13 @@ const ZwaveJsUI = (function () {
2438
2454
  }
2439
2455
  });
2440
2456
 
2441
- CheckForUpdate = () => {
2457
+ CheckForUpdate = async () => {
2442
2458
  const Node = parseInt($('#NODE_FWC option:selected').val());
2443
2459
 
2444
2460
  const nodeRow = $('#zwave-js-node-list').find(`[data-nodeid='${Node}']`);
2445
2461
 
2446
2462
  if (nodeRow.data().info.status.toUpperCase() === 'ASLEEP') {
2447
- modalAlert(
2448
- 'This node is a sleep, please wake up the node before checking for Firmware updates',
2449
- 'Node is a sleep'
2450
- );
2451
- return;
2463
+ await WaitForNodeWake(Node);
2452
2464
  }
2453
2465
 
2454
2466
  ControllerCMD(
@@ -2720,6 +2732,14 @@ const ZwaveJsUI = (function () {
2720
2732
  GetNodesThrottled();
2721
2733
  }
2722
2734
  } else {
2735
+ if (
2736
+ data.node === WakeResolverTarget &&
2737
+ WakeResolver !== undefined &&
2738
+ (data.status.toUpperCase() === 'AWAKE' ||
2739
+ data.status.toUpperCase() === 'ALIVE')
2740
+ ) {
2741
+ WakeResolver();
2742
+ }
2723
2743
  nodeRow
2724
2744
  .find('.zwave-js-node-row-status')
2725
2745
  .html(renderStatusIcon(data.status.toUpperCase()));