node-red-contrib-knx-ultimate 2.1.27 → 2.1.28

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/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@
6
6
 
7
7
  # CHANGELOG
8
8
 
9
+ <p>
10
+ <b>Version 2.1.28</b> - July 2023<br/>
11
+ - HUE Light: fixed DIM behaviour.<br/>
12
+ </p>
9
13
  <p>
10
14
  <b>Version 2.1.27</b> - July 2023<br/>
11
15
  - Trashed some old unuseful code and status options.<br/>
@@ -61,8 +61,7 @@
61
61
  GADaylightSensor: { value: "" },
62
62
  dptDaylightSensor: { value: "" },
63
63
 
64
- updateGALightStateOnHUEBrightnessChange: { value: "yes" },
65
- updateGALightBrightnessStateOnHUELightStatusChange: { value: "yes" },
64
+ linkBrightnessToSwitchStatus: { value: "yes" },
66
65
 
67
66
  hueDevice: { value: "" }
68
67
  },
@@ -970,23 +969,12 @@
970
969
  </p>
971
970
  </div>
972
971
  <div id="tabs-6">
973
- <p>
974
- <br/>
975
- <b> HUE to KNX</b>
972
+ <p>
976
973
  <div class="form-row">
977
- <label for="node-input-updateGALightStateOnHUEBrightnessChange" style="width:400px;">
978
- <i class="fa fa-tag"></i> HUE brightness changes KNX Switch Status
974
+ <label for="node-input-linkBrightnessToSwitchStatus" style="width:400px;">
975
+ <i class="fa fa-tag"></i> Link brightness to on/off switch
979
976
  </label>
980
- <select id="node-input-updateGALightStateOnHUEBrightnessChange">
981
- <option value="yes">Yes</option>
982
- <option value="no">No</option>
983
- </select>
984
- </div>
985
- <div class="form-row">
986
- <label for="node-input-updateGALightBrightnessStateOnHUELightStatusChange" style="width:400px;">
987
- <i class="fa fa-tag"></i> HUE light status changes KNX Brightness Status
988
- </label>
989
- <select id="node-input-updateGALightBrightnessStateOnHUELightStatusChange">
977
+ <select id="node-input-linkBrightnessToSwitchStatus">
990
978
  <option value="yes">Yes</option>
991
979
  <option value="no">No</option>
992
980
  </select>
@@ -1061,12 +1049,9 @@ Start typing in the GA field, the name or group address of your KNX device, the
1061
1049
 
1062
1050
  **Behaviour**
1063
1051
 
1064
- HUE to KNX
1065
-
1066
1052
  |Property|Description|
1067
1053
  |--|--|
1068
- | HUE brightness changes KNX Switch Status | It updates the KNX *Switch Status* group address on each HUE light's brightness change. If the HUE brighness is > 0, a *true* telegram is sent to the KNX group address of the *Switch Status*, otherwise, a *false* telegram is sent. Default value is **Yes**. |
1069
- | HUE light status changes KNX Brightness Status | It updates the KNX *Brightness Status* group address, each HUE light on/off status change. If the HUE status is *on*, a 100% brightness is sent to the KNX *Brightness Status* group address, otherwise, a 0% is sent. Default value is **Yes**.
1054
+ | Link brightness to on/off switch | It updates the *brightness value* on each light on/off status change. If the HUE status is *on*, a 100% brightness is also set, otherwise, a 0% is set. This is the standard KNX behaviour, but you can change it, if you want to have unlinked behaviour. Default value is **Yes**. |
1070
1055
  <br/>
1071
1056
 
1072
1057
  [Find it useful?](https://www.paypal.me/techtoday)
@@ -59,7 +59,11 @@ module.exports = function (RED) {
59
59
  let dbright = hueColorConverter.ColorConverter.getBrightnessFromRGB(jColorChoosen.red, jColorChoosen.green, jColorChoosen.blue)
60
60
  state = dbright > 0 ? { on: { on: true }, dimming: { brightness: dbright }, color: { xy: dretXY } } : { on: { on: false } }
61
61
  } else {
62
- state = { on: { on: true } }
62
+ if (config.linkBrightnessToSwitchStatus === undefined || config.linkBrightnessToSwitchStatus === 'yes') {
63
+ state = { on: { on: true }, dimming: { brightness: 100 } }
64
+ } else {
65
+ state = { on: { on: true } }
66
+ }
63
67
  }
64
68
  if (config.enableDayNightLighting === true && !node.DayTime) {
65
69
  let jColorChoosen = { red: 23, green: 4, blue: 0 }
@@ -70,7 +74,11 @@ module.exports = function (RED) {
70
74
  state = dbright > 0 ? { on: { on: true }, dimming: { brightness: dbright }, color: { xy: dretXY } } : { on: { on: false } }
71
75
  }
72
76
  } else {
73
- state = { on: { on: false } }
77
+ if (config.linkBrightnessToSwitchStatus === undefined || config.linkBrightnessToSwitchStatus === 'yes') {
78
+ state = { on: { on: false }, dimming: { brightness: 0 }, dynamics: { duration: 2000 } }
79
+ } else {
80
+ state = { on: { on: false } }
81
+ }
74
82
  }
75
83
  node.serverHue.hueManager.writeHueQueueAdd(config.hueDevice, state, 'setLight')
76
84
  node.setNodeStatusHue({ fill: 'green', shape: 'dot', text: 'KNX->HUE', payload: state })
@@ -83,8 +91,15 @@ module.exports = function (RED) {
83
91
  let dimDirection = msg.payload.decr_incr === 1 ? 'up' : 'down'
84
92
 
85
93
  // First, switch on the light if off
86
- if (node.currentHUEDevice !== undefined && node.currentHUEDevice.on.on === false) {
87
- node.serverHue.hueManager.writeHueQueueAdd(config.hueDevice, { on: { on: true } }, 'setLight')
94
+ if (node.currentHUEDevice !== undefined && node.currentHUEDevice.on.on === false && dimDirection === 'up') {
95
+ if (config.linkBrightnessToSwitchStatus === undefined || config.linkBrightnessToSwitchStatus === 'yes') {
96
+ // Starts from minimum of 5
97
+ node.serverHue.hueManager.writeHueQueueAdd(config.hueDevice, { on: { on: true }, dimming: { brightness: 5 } }, 'setLight')
98
+ } else {
99
+ // Read the last HUE brightness status and starts from there
100
+ const lastDimVal = node.currentHUEDevice !== undefined ? node.currentHUEDevice.dimming.brightness : 5
101
+ node.serverHue.hueManager.writeHueQueueAdd(config.hueDevice, { on: { on: true }, dimming: { brightness: lastDimVal } }, 'setLight')
102
+ }
88
103
  }
89
104
 
90
105
  node.startDimStopper(dimDirection)
@@ -146,10 +161,9 @@ module.exports = function (RED) {
146
161
  node.blinkValue = !node.blinkValue
147
162
  msg.payload = node.blinkValue
148
163
  // state = msg.payload === true ? { on: { on: true } } : { on: { on: false } }
149
- state = msg.payload === true ? { on: { on: true }, dimming: { brightness: 100 } } : { on: { on: false } }
164
+ state = msg.payload === true ? { on: { on: true }, dimming: { brightness: 100 }, dynamics: { duration: 0 } } : { on: { on: false }, dynamics: { duration: 0 } }
150
165
  node.serverHue.hueManager.writeHueQueueAdd(config.hueDevice, state, 'setLight')
151
- node.serverHue.hueManager.writeHueQueueAdd(config.hueDevice, state, 'setLight') // It's ok twice, so the light turns off immeridaley
152
- }, 600)
166
+ }, 700)
153
167
  } else {
154
168
  if (node.timerBlink !== undefined) clearInterval(node.timerBlink)
155
169
  node.serverHue.hueManager.writeHueQueueAdd(config.hueDevice, { on: { on: false } }, 'setLight')
@@ -193,7 +207,7 @@ module.exports = function (RED) {
193
207
  }
194
208
  }
195
209
 
196
-
210
+
197
211
  // Start dimming
198
212
  // ***********************************************************
199
213
  node.timerDim = undefined
@@ -258,10 +272,6 @@ module.exports = function (RED) {
258
272
  if (_event.id === config.hueDevice) {
259
273
  if (_event.hasOwnProperty('on')) {
260
274
  node.updateKNXLightState(_event.on.on)
261
- if (config.updateGALightBrightnessStateOnHUELightStatusChange === undefined || config.updateGALightBrightnessStateOnHUELightStatusChange === 'yes') {
262
- // Mimic KNX by sending 100% or 0% brightness
263
- node.updateKNXBrightnessState(_event.on.on === true ? 100 : 0)
264
- }
265
275
  if (node.currentHUEDevice !== undefined) node.currentHUEDevice.on = _event.on // Update the internal object representing the current light
266
276
  }
267
277
  if (_event.hasOwnProperty('color')) {
@@ -271,10 +281,9 @@ module.exports = function (RED) {
271
281
  if (_event.hasOwnProperty('dimming')) {
272
282
  if (_event.dimming.brightness === undefined) return
273
283
  node.updateKNXBrightnessState(_event.dimming.brightness)
274
- if (config.updateGALightStateOnHUEBrightnessChange === 'yes' || config.updateGALightStateOnHUEBrightnessChange === undefined) {
275
- // Send true/false to switch state
276
- node.updateKNXLightState(_event.dimming.brightness > 0)
277
- }
284
+ // Send true/false to switch state
285
+ node.updateKNXLightState(_event.dimming.brightness > 0)
286
+
278
287
  // If the brightness reaches zero, the hue lamp "on" property must be set to zero as well
279
288
  if (_event.dimming.brightness === 0) node.serverHue.hueManager.writeHueQueueAdd(config.hueDevice, { on: { on: false } }, 'setLight')
280
289
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "engines": {
4
4
  "node": ">=16.0.0"
5
5
  },
6
- "version": "2.1.27",
6
+ "version": "2.1.28",
7
7
  "description": "Control your KNX intallation via Node-Red! Single Node KNX IN/OUT with optional ETS group address importer. Easy to use and highly configurable. With integrated Philips HUE devices handling.",
8
8
  "dependencies": {
9
9
  "mkdirp": "3.0.1",