node-red-contrib-knx-ultimate 4.3.1 → 4.3.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
@@ -3,7 +3,7 @@
3
3
  "engines": {
4
4
  "node": ">=20.18.1"
5
5
  },
6
- "version": "4.3.1",
6
+ "version": "4.3.3",
7
7
  "description": "Control your KNX and KNX Secure intallation via Node-Red! A bunch of KNX nodes, with integrated Philips HUE control, ETS group address importer, and KNX routing between interfaces. Easy to use and highly configurable.",
8
8
  "files": [
9
9
  "nodes/",
@@ -1,9 +1,9 @@
1
- ;(function (root) {
2
- const KNXSendSnippets = [
3
- {
4
- id: 'status-ga-check',
5
- title: 'Status GA check',
6
- code: `// @ts-nocheck
1
+ ; (function (root) {
2
+ const KNXSendSnippets = [
3
+ {
4
+ id: 'status-ga-check',
5
+ title: 'Status GA check',
6
+ code: `// @ts-nocheck
7
7
  // Replace '' with the real status group address.
8
8
  const statusGA = getGAValue('','1.001');
9
9
  if (msg.payload !== statusGA){ // " !==" means " not equal"
@@ -13,41 +13,57 @@ if (msg.payload !== statusGA){ // " !==" means " not equal"
13
13
  node.status({fill:"grey",shape:"dot",text:"Not sent"});
14
14
  return;
15
15
  }`
16
- },
17
- {
18
- id: 'toggle-value',
19
- title: 'Toggle value',
20
- code: `// @ts-nocheck
16
+ },
17
+ {
18
+ id: 'toggle-value-no-check',
19
+ title: 'Toggle value (without status check)',
20
+ code: `// @ts-nocheck
21
21
  // After 5000 milliseconds, toggle.
22
22
  setTimeout(function() {
23
23
  toggle();
24
24
  }, 5000);
25
25
  return msg;`
26
- },
27
- {
28
- id: 'send-false-delay',
29
- title: 'Send false after 5 secs',
30
- code: `// @ts-nocheck
26
+ },
27
+ {
28
+ id: 'toggle-value-with-check',
29
+ title: 'Toggle value (with status check)',
30
+ code: `// @ts-nocheck
31
+ // Get the current value of the status GA. insert the actual STATUS GA here.
32
+ let prevValue = getGAValue('InsertHereTheStatusGA', '1.001')
33
+ if (prevValue === null)
34
+ {
35
+ // If the status of the light is not defined, at the
36
+ // first input of this node, it turns the light on
37
+ self(true);
38
+ }else{
39
+ // Otherwise, toggles the value
40
+ self(!prevValue);
41
+ }`
42
+ },
43
+ {
44
+ id: 'send-false-delay',
45
+ title: 'Send false after 5 secs',
46
+ code: `// @ts-nocheck
31
47
  // After 5000 milliseconds, send false.
32
48
  setTimeout(function () {
33
49
  self(false);
34
50
  }, 5000);
35
51
  return msg;`
36
- },
37
- {
38
- id: 'send-20-percent-other-ga',
39
- title: 'Send 20% to another GA',
40
- code: `// @ts-nocheck
52
+ },
53
+ {
54
+ id: 'send-20-percent-other-ga',
55
+ title: 'Send 20% to another GA',
56
+ code: `// @ts-nocheck
41
57
  // Send 20% to the GA 1/0/1 having DPT 5.001
42
58
  if (msg.payload === true){
43
59
  setGAValue('1/0/1',20,'5.001')
44
60
  }
45
61
  return msg;`
46
- },
47
- {
48
- id: 'motion-activated-light',
49
- title: 'Turn on light on motion, auto off',
50
- code: `// @ts-nocheck
62
+ },
63
+ {
64
+ id: 'motion-activated-light',
65
+ title: 'Turn on light on motion, auto off',
66
+ code: `// @ts-nocheck
51
67
  // This snippet expects a motion sensor boolean on msg.payload.
52
68
  // When motion is detected turn the light on, otherwise schedule an auto-off.
53
69
  if (msg.payload === true) {
@@ -63,11 +79,11 @@ if (msg.payload === true) {
63
79
  context.set('autoOffTimer', timer);
64
80
  }
65
81
  return;`
66
- },
67
- {
68
- id: 'window-hvac-standby',
69
- title: 'HVAC standby when window open',
70
- code: `// @ts-nocheck
82
+ },
83
+ {
84
+ id: 'window-hvac-standby',
85
+ title: 'HVAC standby when window open',
86
+ code: `// @ts-nocheck
71
87
  // msg.payload should contain the window contact state (true = open).
72
88
  // If the window is open, set the HVAC to standby, otherwise restore comfort.
73
89
  const hvacGa = ''; // Replace with your HVAC GA.
@@ -82,11 +98,11 @@ if (msg.payload === true) {
82
98
  node.status({fill: 'green', shape: 'dot', text: 'HVAC comfort'});
83
99
  }
84
100
  return;`
85
- },
86
- {
87
- id: 'night-door-alert',
88
- title: 'Night door alert',
89
- code: `// @ts-nocheck
101
+ },
102
+ {
103
+ id: 'night-door-alert',
104
+ title: 'Night door alert',
105
+ code: `// @ts-nocheck
90
106
  // Send a KNX notification GA if a door opens between 22:00 and 06:00.
91
107
  const now = new Date();
92
108
  const hour = now.getHours();
@@ -96,11 +112,11 @@ if (msg.payload === true && (hour >= 22 || hour < 6)) {
96
112
  node.status({fill: 'red', shape: 'ring', text: 'Door alert sent'});
97
113
  }
98
114
  return;`
99
- },
100
- {
101
- id: 'bedtime-all-off',
102
- title: 'Bedtime all off',
103
- code: `// @ts-nocheck
115
+ },
116
+ {
117
+ id: 'bedtime-all-off',
118
+ title: 'Bedtime all off',
119
+ code: `// @ts-nocheck
104
120
  // Turn off a list of lights when a bedtime command is received.
105
121
  const lights = [
106
122
  '', // Replace with GA of the first light
@@ -117,13 +133,13 @@ if (msg.payload === 'bedtime') {
117
133
  return;
118
134
  }
119
135
  return msg;`
120
- }
121
- ]
136
+ }
137
+ ]
122
138
 
123
- if (root) {
124
- root.KNXSendSnippets = KNXSendSnippets
125
- }
126
- if (typeof module !== 'undefined' && module.exports) {
127
- module.exports = KNXSendSnippets
128
- }
139
+ if (root) {
140
+ root.KNXSendSnippets = KNXSendSnippets
141
+ }
142
+ if (typeof module !== 'undefined' && module.exports) {
143
+ module.exports = KNXSendSnippets
144
+ }
129
145
  })(typeof window !== 'undefined' ? window : (typeof globalThis !== 'undefined' ? globalThis : this))