node-red-contrib-knx-ultimate 6.3.0 → 6.3.2

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.
@@ -753,7 +753,9 @@ module.exports = function (RED) {
753
753
  let numStep = 10 // Steps from 0 to 100 by 10
754
754
  const extendedConf = {}
755
755
 
756
- if (_KNXbrightness_Direction === 0 && _KNXaction === 0) {
756
+ // DPT 3.x uses data/step-code 0 for BREAK. The direction bit may be
757
+ // either 0 ($00) or 1 ($08), so it must not be part of this check.
758
+ if (_KNXbrightness_Direction === 0) {
757
759
  // STOP DIM
758
760
  if (node.timerStepDim !== undefined) clearInterval(node.timerStepDim)
759
761
  node.brightnessStep = null
@@ -838,7 +840,7 @@ module.exports = function (RED) {
838
840
  // 23/23/2023 after many attempts to use dimming_delta function of the HueApeV2, loosing days of my life, without a decent success, will use the standard dimming calculations
839
841
  // i decide to go to the "step brightness" way.
840
842
  try {
841
- if (_KNXbrightness_DirectionTunableWhite === 0 && _KNXaction === 0) {
843
+ if (_KNXbrightness_DirectionTunableWhite === 0) {
842
844
  // STOP DIM
843
845
  if (node.timerStepDimTunableWhite !== undefined) clearInterval(node.timerStepDimTunableWhite)
844
846
  node.brightnessStepTunableWhite = null
@@ -912,7 +914,7 @@ module.exports = function (RED) {
912
914
  // After many attempts to use dimming_delta function of the HueApiV2, loosing days of my life, without a decent success, will use the standard dimming calculations
913
915
  // i decide to go to the "step brightness" way.
914
916
  try {
915
- if (_KNXbrightness_DirectionHSV_H === 0 && _KNXaction === 0) {
917
+ if (_KNXbrightness_DirectionHSV_H === 0) {
916
918
  // STOP DIM
917
919
  if (node.timerStepDimHSV_H !== undefined) clearInterval(node.timerStepDimHSV_H)
918
920
  node.deleteHueStateQueue() // Clear dimming queue.
@@ -1000,7 +1002,7 @@ module.exports = function (RED) {
1000
1002
  // After many attempts to use dimming_delta function of the HueApiV2, loosing days of my life, without a decent success, will use the standard dimming calculations
1001
1003
  // i decide to go to the "step brightness" way.
1002
1004
  try {
1003
- if (_KNXbrightness_DirectionHSV_S === 0 && _KNXaction === 0) {
1005
+ if (_KNXbrightness_DirectionHSV_S === 0) {
1004
1006
  // STOP DIM
1005
1007
  if (node.timerStepDimHSV_S !== undefined) clearInterval(node.timerStepDimHSV_S)
1006
1008
  node.deleteHueStateQueue() // Clear dimming queue.
@@ -1,34 +1,84 @@
1
1
  /**
2
2
  * (C) 2024 Supergiovane
3
3
  */
4
- const logger = require('node-color-log')
4
+ const winston = require('winston')
5
+ const { format: formatMessage } = require('util')
6
+
7
+ const { combine, timestamp, label, printf, colorize, splat } = winston.format
8
+ const colorizer = colorize()
9
+ const SPLAT = Symbol.for('splat')
10
+
11
+ // Keep the application log format aligned with the KNXUltimate engine while
12
+ // owning a separate logger instance for each Node-RED node/configuration node.
13
+ winston.addColors({
14
+ time: 'grey',
15
+ module: 'bold'
16
+ })
17
+
18
+ const normalizeLevel = (level) => {
19
+ if (level === 'trace') return 'debug'
20
+ if (level === 'silent') return 'disable'
21
+ if (level === 'success') return 'info'
22
+ if (['debug', 'info', 'warn', 'error', 'disable'].includes(level)) return level
23
+ return 'info'
24
+ }
25
+
26
+ const loggerFormat = (prefix) => combine(
27
+ winston.format((info) => {
28
+ const args = info[SPLAT]
29
+ if (Array.isArray(args) && args.length > 0) {
30
+ // node-color-log printed every argument even without placeholders. Format
31
+ // them before Winston's splat transform so existing diagnostics keep all
32
+ // their values while regular %s/%o messages retain Winston semantics.
33
+ info.message = formatMessage(info.message, ...args)
34
+ delete info[SPLAT]
35
+ }
36
+ return info
37
+ })(),
38
+ splat(),
39
+ timestamp({ format: 'YYYY-MM-DD HH:mm:ss.SSS' }),
40
+ winston.format((info) => {
41
+ info.level = String(info.level).toUpperCase()
42
+ return info
43
+ })(),
44
+ label({ label: String(prefix || '-').toUpperCase() }),
45
+ colorize({ level: true }),
46
+ printf((info) => {
47
+ const formattedTimestamp = colorizer.colorize('time', info.timestamp)
48
+ const formattedLabel = colorizer.colorize('module', info.label || '-')
49
+ return `${formattedTimestamp} ${info.level} ${formattedLabel}: ${info.message}${info.stack ? `\n${info.stack}` : ''}`
50
+ })
51
+ )
5
52
 
6
53
  class loggerClass {
7
54
  logLevel = 'info'
8
55
  prefix = ''
9
56
  constructor (options = {}) {
10
- const possibleLevels = ['success', 'debug', 'info', 'warn', 'error', 'disable']
11
57
  this.prefix = options.setPrefix || ''
12
- if (this.prefix) {
13
- this.logger = logger.createNamedLogger(this.prefix)
14
- } else {
15
- this.logger = logger
16
- }
17
- let requestedLevel = options.loglevel
18
- if (!possibleLevels.includes(requestedLevel)) requestedLevel = 'info'
19
- if (requestedLevel === 'trace') requestedLevel = 'debug' // Backward compatibility
20
- if (requestedLevel === 'silent') requestedLevel = 'disable' // Backward compatibility
21
- this.logger.setLevel(requestedLevel)
22
- this.logger.setDate(() => (new Date()).toLocaleString())
58
+ const requestedLevel = normalizeLevel(options.loglevel)
23
59
  this.logLevel = requestedLevel
60
+ this.logger = winston.createLogger({
61
+ level: requestedLevel === 'disable' ? 'error' : requestedLevel,
62
+ silent: requestedLevel === 'disable',
63
+ format: loggerFormat(this.prefix),
64
+ transports: [
65
+ new winston.transports.Console({
66
+ stderrLevels: ['error']
67
+ })
68
+ ]
69
+ })
24
70
  }
25
71
 
26
72
  destroy = () => {
27
- // Placeholder for backward compatibility; kept for API symmetry.
73
+ if (!this.logger) return
74
+ this.logger.silent = true
75
+ this.logger.close()
28
76
  }
29
77
 
30
78
  success = (...args) => {
31
- this.logger.success(...args)
79
+ // Winston's npm levels do not include "success"; preserve the legacy API
80
+ // and route it through the equivalent informational level.
81
+ this.logger.info(...args)
32
82
  }
33
83
 
34
84
  debug = (...args) => {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "engines": {
4
4
  "node": ">=20.18.1"
5
5
  },
6
- "version": "6.3.0",
6
+ "version": "6.3.2",
7
7
  "description": "KNX Ultimate is the most advanced KNX integration for Node-RED, providing secure KNX/IP communication, routing, ETS project import, Philips Hue, Matter Controller and Matter Bridge (control matter device via KNX and expose KNX GA via Matter), MQTT, diagnostics with AI, virtual devices, and powerful automation nodes. Build professional, reliable, and scalable smart home and building automation projects with minimal effort.",
8
8
  "files": [
9
9
  "nodes/",
@@ -16,17 +16,17 @@
16
16
  "LICENSE"
17
17
  ],
18
18
  "dependencies": {
19
- "@matter/main": "^0.17.4",
20
- "@project-chip/matter.js": "^0.17.4",
19
+ "@matter/main": "^0.17.9",
20
+ "@project-chip/matter.js": "^0.17.9",
21
21
  "dns-sync": "0.2.1",
22
22
  "google-translate-tts": "^0.3.0",
23
- "js-yaml": "4.2.0",
23
+ "js-yaml": "4.3.1",
24
24
  "knxultimate": "6.0.2",
25
25
  "lodash": "4.18.1",
26
- "mqtt": "^5.15.1",
27
- "node-color-log": "12.0.1",
26
+ "mqtt": "^5.15.2",
28
27
  "ping": "0.4.4",
29
- "simple-get": "4.0.1"
28
+ "simple-get": "4.0.1",
29
+ "winston": "^3.17.0"
30
30
  },
31
31
  "node-red": {
32
32
  "version": ">=3.1.1",
@@ -111,6 +111,8 @@
111
111
  "prepublishOnly": "npm run build",
112
112
  "test": "npm run hue-controller:check && DEBUG_KNX_HUE_TEST=0 npm run test:unit && node scripts/check-node-load.js",
113
113
  "test:unit": "mocha \"test/**/*.test.js\"",
114
+ "release:publish": "node scripts/publish-and-refresh.js",
115
+ "release:refresh-flows": "node scripts/publish-and-refresh.js --refresh-only",
114
116
  "hue-controller:generate": "node scripts/generate-hue-controller-profiles.js",
115
117
  "hue-controller:check": "node scripts/generate-hue-controller-profiles.js --check",
116
118
  "avviaquesto-itest:light": "node test/integration/hueLiveTest.mjs",
@@ -139,12 +141,12 @@
139
141
  "docs:serve:norl": "node scripts/dev-serve-docs.js"
140
142
  },
141
143
  "devDependencies": {
142
- "@vitejs/plugin-vue": "^6.0.1",
144
+ "@vitejs/plugin-vue": "^6.0.8",
143
145
  "chai": "^4.3.10",
144
- "jspdf": "^2.5.2",
146
+ "jspdf": "^4.2.1",
145
147
  "marked": "^14.1.0",
146
148
  "mocha": "^10.4.0",
147
- "vite": "^7.1.3",
148
- "vue": "^3.5.21"
149
+ "vite": "^7.3.6",
150
+ "vue": "^3.5.41"
149
151
  }
150
- }
152
+ }