node-red-contrib-knx-ultimate 6.2.2 → 6.2.3-beta.1

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.
Files changed (141) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/nodes/knxUltimateAI.js +7 -1
  3. package/nodes/knxUltimateHueAreaMotion.html +16 -4
  4. package/nodes/knxUltimateHueBattery.html +16 -4
  5. package/nodes/knxUltimateHueButton.html +16 -4
  6. package/nodes/knxUltimateHueCameraMotion.html +16 -4
  7. package/nodes/knxUltimateHueContactSensor.html +16 -4
  8. package/nodes/knxUltimateHueController.html +1259 -0
  9. package/nodes/knxUltimateHueController.js +28 -0
  10. package/nodes/knxUltimateHueHumiditySensor.html +16 -4
  11. package/nodes/knxUltimateHueLight.html +16 -4
  12. package/nodes/knxUltimateHueLightSensor.html +16 -4
  13. package/nodes/knxUltimateHueMotion.html +16 -4
  14. package/nodes/knxUltimateHuePlug.html +16 -4
  15. package/nodes/knxUltimateHueScene.html +19 -7
  16. package/nodes/knxUltimateHueTapDial.html +16 -4
  17. package/nodes/knxUltimateHueTemperatureSensor.html +16 -4
  18. package/nodes/knxUltimateHueZigbeeConnectivity.html +16 -4
  19. package/nodes/knxUltimateHuedevice_software_update.html +16 -4
  20. package/nodes/locales/de/knxUltimateHueAreaMotion.html +1 -1
  21. package/nodes/locales/de/knxUltimateHueBattery.html +1 -0
  22. package/nodes/locales/de/knxUltimateHueButton.html +1 -0
  23. package/nodes/locales/de/knxUltimateHueCameraMotion.html +1 -0
  24. package/nodes/locales/de/knxUltimateHueContactSensor.html +1 -0
  25. package/nodes/locales/de/knxUltimateHueController.html +668 -0
  26. package/nodes/locales/de/knxUltimateHueController.json +47 -0
  27. package/nodes/locales/de/knxUltimateHueHumiditySensor.html +1 -0
  28. package/nodes/locales/de/knxUltimateHueLight.html +1 -0
  29. package/nodes/locales/de/knxUltimateHueLightSensor.html +1 -0
  30. package/nodes/locales/de/knxUltimateHueMotion.html +1 -0
  31. package/nodes/locales/de/knxUltimateHuePlug.html +1 -0
  32. package/nodes/locales/de/knxUltimateHueScene.html +1 -0
  33. package/nodes/locales/de/knxUltimateHueTapDial.html +1 -0
  34. package/nodes/locales/de/knxUltimateHueTemperatureSensor.html +1 -0
  35. package/nodes/locales/de/knxUltimateHueZigbeeConnectivity.html +1 -0
  36. package/nodes/locales/de/knxUltimateHuedevice_software_update.html +1 -0
  37. package/nodes/locales/en/knxUltimateHueAreaMotion.html +1 -1
  38. package/nodes/locales/en/knxUltimateHueBattery.html +1 -0
  39. package/nodes/locales/en/knxUltimateHueButton.html +1 -0
  40. package/nodes/locales/en/knxUltimateHueCameraMotion.html +1 -0
  41. package/nodes/locales/en/knxUltimateHueContactSensor.html +1 -0
  42. package/nodes/locales/en/knxUltimateHueController.html +671 -0
  43. package/nodes/locales/en/knxUltimateHueController.json +47 -0
  44. package/nodes/locales/en/knxUltimateHueHumiditySensor.html +1 -0
  45. package/nodes/locales/en/knxUltimateHueLight.html +1 -0
  46. package/nodes/locales/en/knxUltimateHueLightSensor.html +1 -0
  47. package/nodes/locales/en/knxUltimateHueMotion.html +1 -0
  48. package/nodes/locales/en/knxUltimateHuePlug.html +1 -0
  49. package/nodes/locales/en/knxUltimateHueScene.html +1 -0
  50. package/nodes/locales/en/knxUltimateHueTapDial.html +1 -0
  51. package/nodes/locales/en/knxUltimateHueTemperatureSensor.html +1 -0
  52. package/nodes/locales/en/knxUltimateHueZigbeeConnectivity.html +1 -0
  53. package/nodes/locales/en/knxUltimateHuedevice_software_update.html +1 -0
  54. package/nodes/locales/es/knxUltimateHueAreaMotion.html +1 -1
  55. package/nodes/locales/es/knxUltimateHueBattery.html +1 -0
  56. package/nodes/locales/es/knxUltimateHueButton.html +1 -0
  57. package/nodes/locales/es/knxUltimateHueCameraMotion.html +1 -0
  58. package/nodes/locales/es/knxUltimateHueContactSensor.html +1 -0
  59. package/nodes/locales/es/knxUltimateHueController.html +671 -0
  60. package/nodes/locales/es/knxUltimateHueController.json +47 -0
  61. package/nodes/locales/es/knxUltimateHueHumiditySensor.html +1 -0
  62. package/nodes/locales/es/knxUltimateHueLight.html +1 -0
  63. package/nodes/locales/es/knxUltimateHueLightSensor.html +1 -0
  64. package/nodes/locales/es/knxUltimateHueMotion.html +1 -0
  65. package/nodes/locales/es/knxUltimateHuePlug.html +1 -0
  66. package/nodes/locales/es/knxUltimateHueScene.html +1 -0
  67. package/nodes/locales/es/knxUltimateHueTapDial.html +1 -0
  68. package/nodes/locales/es/knxUltimateHueTemperatureSensor.html +1 -0
  69. package/nodes/locales/es/knxUltimateHueZigbeeConnectivity.html +1 -0
  70. package/nodes/locales/es/knxUltimateHuedevice_software_update.html +1 -0
  71. package/nodes/locales/fr/knxUltimateHueAreaMotion.html +1 -1
  72. package/nodes/locales/fr/knxUltimateHueBattery.html +1 -0
  73. package/nodes/locales/fr/knxUltimateHueButton.html +1 -0
  74. package/nodes/locales/fr/knxUltimateHueCameraMotion.html +1 -0
  75. package/nodes/locales/fr/knxUltimateHueContactSensor.html +1 -0
  76. package/nodes/locales/fr/knxUltimateHueController.html +671 -0
  77. package/nodes/locales/fr/knxUltimateHueController.json +47 -0
  78. package/nodes/locales/fr/knxUltimateHueHumiditySensor.html +1 -0
  79. package/nodes/locales/fr/knxUltimateHueLight.html +1 -0
  80. package/nodes/locales/fr/knxUltimateHueLightSensor.html +1 -0
  81. package/nodes/locales/fr/knxUltimateHueMotion.html +1 -0
  82. package/nodes/locales/fr/knxUltimateHuePlug.html +1 -0
  83. package/nodes/locales/fr/knxUltimateHueScene.html +1 -0
  84. package/nodes/locales/fr/knxUltimateHueTapDial.html +1 -0
  85. package/nodes/locales/fr/knxUltimateHueTemperatureSensor.html +1 -0
  86. package/nodes/locales/fr/knxUltimateHueZigbeeConnectivity.html +1 -0
  87. package/nodes/locales/fr/knxUltimateHuedevice_software_update.html +1 -0
  88. package/nodes/locales/it/knxUltimateHueAreaMotion.html +1 -1
  89. package/nodes/locales/it/knxUltimateHueBattery.html +1 -0
  90. package/nodes/locales/it/knxUltimateHueButton.html +1 -0
  91. package/nodes/locales/it/knxUltimateHueCameraMotion.html +1 -0
  92. package/nodes/locales/it/knxUltimateHueContactSensor.html +1 -0
  93. package/nodes/locales/it/knxUltimateHueController.html +671 -0
  94. package/nodes/locales/it/knxUltimateHueController.json +47 -0
  95. package/nodes/locales/it/knxUltimateHueHumiditySensor.html +1 -0
  96. package/nodes/locales/it/knxUltimateHueLight.html +1 -0
  97. package/nodes/locales/it/knxUltimateHueLightSensor.html +1 -0
  98. package/nodes/locales/it/knxUltimateHueMotion.html +1 -0
  99. package/nodes/locales/it/knxUltimateHuePlug.html +1 -0
  100. package/nodes/locales/it/knxUltimateHueScene.html +1 -0
  101. package/nodes/locales/it/knxUltimateHueTapDial.html +1 -0
  102. package/nodes/locales/it/knxUltimateHueTemperatureSensor.html +1 -0
  103. package/nodes/locales/it/knxUltimateHueZigbeeConnectivity.html +1 -0
  104. package/nodes/locales/it/knxUltimateHuedevice_software_update.html +1 -0
  105. package/nodes/locales/zh-CN/knxUltimateHueAreaMotion.html +1 -1
  106. package/nodes/locales/zh-CN/knxUltimateHueBattery.html +1 -0
  107. package/nodes/locales/zh-CN/knxUltimateHueButton.html +1 -0
  108. package/nodes/locales/zh-CN/knxUltimateHueCameraMotion.html +1 -0
  109. package/nodes/locales/zh-CN/knxUltimateHueContactSensor.html +1 -0
  110. package/nodes/locales/zh-CN/knxUltimateHueController.html +673 -0
  111. package/nodes/locales/zh-CN/knxUltimateHueController.json +47 -0
  112. package/nodes/locales/zh-CN/knxUltimateHueHumiditySensor.html +1 -0
  113. package/nodes/locales/zh-CN/knxUltimateHueLight.html +1 -0
  114. package/nodes/locales/zh-CN/knxUltimateHueLightSensor.html +1 -0
  115. package/nodes/locales/zh-CN/knxUltimateHueMotion.html +1 -0
  116. package/nodes/locales/zh-CN/knxUltimateHuePlug.html +1 -0
  117. package/nodes/locales/zh-CN/knxUltimateHueScene.html +1 -0
  118. package/nodes/locales/zh-CN/knxUltimateHueTapDial.html +1 -0
  119. package/nodes/locales/zh-CN/knxUltimateHueTemperatureSensor.html +1 -0
  120. package/nodes/locales/zh-CN/knxUltimateHueZigbeeConnectivity.html +1 -0
  121. package/nodes/locales/zh-CN/knxUltimateHuedevice_software_update.html +1 -0
  122. package/nodes/utils/hueControllerProfileAdapter.js +104 -0
  123. package/nodes/utils/hueControllerProfiles/runtime/area_motion.js +221 -0
  124. package/nodes/utils/hueControllerProfiles/runtime/button.js +295 -0
  125. package/nodes/utils/hueControllerProfiles/runtime/camera_motion.js +221 -0
  126. package/nodes/utils/hueControllerProfiles/runtime/contact.js +191 -0
  127. package/nodes/utils/hueControllerProfiles/runtime/device_power.js +185 -0
  128. package/nodes/utils/hueControllerProfiles/runtime/device_software_update.js +185 -0
  129. package/nodes/utils/hueControllerProfiles/runtime/humidity.js +204 -0
  130. package/nodes/utils/hueControllerProfiles/runtime/light.js +1583 -0
  131. package/nodes/utils/hueControllerProfiles/runtime/light_level.js +180 -0
  132. package/nodes/utils/hueControllerProfiles/runtime/motion.js +185 -0
  133. package/nodes/utils/hueControllerProfiles/runtime/plug.js +344 -0
  134. package/nodes/utils/hueControllerProfiles/runtime/relative_rotary.js +271 -0
  135. package/nodes/utils/hueControllerProfiles/runtime/scene.js +352 -0
  136. package/nodes/utils/hueControllerProfiles/runtime/temperature.js +187 -0
  137. package/nodes/utils/hueControllerProfiles/runtime/zigbee_connectivity.js +185 -0
  138. package/package.json +5 -2
  139. package/resources/hueControllerMigration.js +338 -0
  140. package/resources/hueControllerMigrationDialog.js +235 -0
  141. package/resources/hueControllerProfiles.js +9290 -0
@@ -0,0 +1,204 @@
1
+ // Canonical private runtime profile for HUE Controller: humidity.
2
+ // This module is shipped with the Controller but is intentionally absent from
3
+ // package.json, so Node-RED never registers it as a separate palette node.
4
+ module.exports = function (RED) {
5
+ function knxUltimateHueHumiditySensor (config) {
6
+ RED.nodes.createNode(this, config)
7
+ const node = this
8
+ node.serverKNX = RED.nodes.getNode(config.server) || undefined
9
+ node.serverHue = RED.nodes.getNode(config.serverHue) || undefined
10
+ node.topic = node.name
11
+ node.name = config.name === undefined ? 'Hue' : config.name
12
+ node.dpt = ''
13
+ node.notifyreadrequest = true
14
+ node.notifyreadrequestalsorespondtobus = 'false'
15
+ node.notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized = ''
16
+ node.notifyresponse = false
17
+ node.notifywrite = true
18
+ node.initialread = true
19
+ node.listenallga = true // Don't remove
20
+ node.outputtype = 'write'
21
+ node.outputRBE = 'false'
22
+ node.inputRBE = 'false'
23
+ node.currentPayload = ''
24
+ node.passthrough = 'no'
25
+ node.formatmultiplyvalue = 1
26
+ node.formatnegativevalue = 'leave'
27
+ node.formatdecimalsvalue = 2
28
+ node.hueDevice = config.hueDevice
29
+ node.dpthumiditysensor = config.dpthumiditysensor
30
+ node.humidityDPT = (config.dpthumiditysensor && config.dpthumiditysensor !== '') ? config.dpthumiditysensor : '9.007'
31
+ node.initializingAtStart = (config.readStatusAtStartup === undefined || config.readStatusAtStartup === 'yes')
32
+ node.currentDeviceValue = 0
33
+ node.enableNodePINS = (config.enableNodePINS === undefined || config.enableNodePINS === 'yes')
34
+ node.outputs = node.enableNodePINS ? 1 : 0
35
+
36
+ const pushStatus = (status) => {
37
+ if (!status) return
38
+ const provider = node.serverKNX
39
+ if (provider && typeof provider.applyStatusUpdate === 'function') {
40
+ provider.applyStatusUpdate(node, status)
41
+ } else {
42
+ node.status(status)
43
+ }
44
+ }
45
+
46
+ const updateStatus = (status) => {
47
+ if (!status) return
48
+ pushStatus(status)
49
+ }
50
+
51
+ const formatTs = (date) => {
52
+ const d = date instanceof Date ? date : new Date(date)
53
+ const provider = node.serverKNX
54
+ if (provider && typeof provider.formatStatusTimestamp === 'function') return provider.formatStatusTimestamp(d)
55
+ return `${d.getDate()}, ${d.toLocaleTimeString()}`
56
+ }
57
+
58
+ const safeSendToKNX = (telegram, context = 'write') => {
59
+ try {
60
+ if (!node.serverKNX || typeof node.serverKNX.sendKNXTelegramToKNXEngine !== 'function') {
61
+ const now = new Date()
62
+ updateStatus({ fill: 'red', shape: 'dot', text: `KNX server missing (${context}) (${formatTs(now)})` })
63
+ return
64
+ }
65
+ node.serverKNX.sendKNXTelegramToKNXEngine({ ...telegram, nodecallerid: node.id })
66
+ } catch (error) {
67
+ updateStatus({ fill: 'red', shape: 'dot', text: `KNX send error ${error.message}` })
68
+ }
69
+ }
70
+
71
+ node.setNodeStatus = ({ fill, shape, text, payload }) => {
72
+ try {
73
+ if (payload === undefined) payload = ''
74
+ const dDate = new Date()
75
+ payload = typeof payload === 'object' ? JSON.stringify(payload) : payload.toString()
76
+ node.sKNXNodeStatusText = `|KNX: ${text} ${payload} (${formatTs(dDate)})`
77
+ pushStatus({ fill, shape, text: (node.sHUENodeStatusText || '') + ' ' + (node.sKNXNodeStatusText || '') })
78
+ } catch (error) { /* empty */ }
79
+ }
80
+
81
+ node.setNodeStatusHue = ({ fill, shape, text, payload }) => {
82
+ try {
83
+ if (payload === undefined) payload = ''
84
+ const dDate = new Date()
85
+ payload = typeof payload === 'object' ? JSON.stringify(payload) : payload.toString()
86
+ node.sHUENodeStatusText = `|HUE: ${text} ${payload} (${formatTs(dDate)})`
87
+ pushStatus({ fill, shape, text: node.sHUENodeStatusText + ' ' + (node.sKNXNodeStatusText || '') })
88
+ } catch (error) { /* empty */ }
89
+ }
90
+
91
+ const mapHumidityValue = (_event) => {
92
+ if (_event?.humidity === undefined) return undefined
93
+ let value
94
+ if (typeof _event.humidity.percentage === 'number') {
95
+ value = _event.humidity.percentage
96
+ } else if (typeof _event.humidity.humidity === 'number') {
97
+ value = _event.humidity.humidity
98
+ }
99
+ if (value === undefined) return undefined
100
+ if (value > 100) {
101
+ value = value / 100
102
+ }
103
+ return Math.round(value * 100) / 100
104
+ }
105
+
106
+ node.handleSend = (msg) => {
107
+ if (msg.knx.event === 'GroupValue_Read') {
108
+ switch (msg.knx.destination) {
109
+ case config.GAhumiditysensor:
110
+ node.sendResponseToKNX(node.currentDeviceValue)
111
+ break
112
+ default:
113
+ break
114
+ }
115
+ }
116
+ }
117
+
118
+ node.handleSendHUE = (_event) => {
119
+ try {
120
+ if (_event.id !== config.hueDevice) return
121
+ const humidityValue = mapHumidityValue(_event)
122
+ if (humidityValue === undefined || Number.isNaN(humidityValue)) return
123
+
124
+ const knxMsgPayload = {
125
+ topic: config.GAhumiditysensor,
126
+ dpt: node.humidityDPT,
127
+ payload: humidityValue,
128
+ name: node.name,
129
+ event: 'humidity',
130
+ rawEvent: _event
131
+ }
132
+
133
+ if (knxMsgPayload.topic) {
134
+ safeSendToKNX({
135
+ grpaddr: knxMsgPayload.topic,
136
+ payload: knxMsgPayload.payload,
137
+ dpt: knxMsgPayload.dpt,
138
+ outputtype: 'write'
139
+ }, 'write')
140
+ }
141
+ node.currentDeviceValue = knxMsgPayload.payload
142
+
143
+ updateStatus({
144
+ fill: 'green',
145
+ shape: 'dot',
146
+ text: `HUE->KNX ${knxMsgPayload.payload} (${formatTs(new Date())})`
147
+ })
148
+
149
+ if (node.enableNodePINS) {
150
+ node.send(knxMsgPayload)
151
+ }
152
+ node.setNodeStatusHue({
153
+ fill: 'blue',
154
+ shape: 'ring',
155
+ text: 'HUE->KNX',
156
+ payload: knxMsgPayload.payload
157
+ })
158
+ } catch (error) {
159
+ updateStatus({
160
+ fill: 'red',
161
+ shape: 'dot',
162
+ text: `HUE->KNX error ${error.message} (${formatTs(new Date())})`
163
+ })
164
+ }
165
+ }
166
+
167
+ node.sendResponseToKNX = (_level) => {
168
+ if (!node.serverKNX) return
169
+ const knxMsgPayload = {
170
+ topic: config.GAhumiditysensor,
171
+ dpt: node.humidityDPT,
172
+ payload: _level
173
+ }
174
+ if (knxMsgPayload.topic) {
175
+ safeSendToKNX({
176
+ grpaddr: knxMsgPayload.topic,
177
+ payload: knxMsgPayload.payload,
178
+ dpt: knxMsgPayload.dpt,
179
+ outputtype: 'response'
180
+ }, 'response')
181
+ }
182
+ }
183
+
184
+ if (node.serverKNX) {
185
+ node.serverKNX.removeClient(node)
186
+ node.serverKNX.addClient(node)
187
+ }
188
+ if (node.serverHue) {
189
+ node.serverHue.removeClient(node)
190
+ node.serverHue.addClient(node)
191
+ }
192
+
193
+ node.on('close', (done) => {
194
+ if (node.serverKNX) {
195
+ node.serverKNX.removeClient(node)
196
+ }
197
+ if (node.serverHue) {
198
+ node.serverHue.removeClient(node)
199
+ }
200
+ done()
201
+ })
202
+ }
203
+ RED.nodes.registerType('knxUltimateHueHumiditySensor', knxUltimateHueHumiditySensor)
204
+ }