node-red-contrib-dmx-for-ha 0.3.6 → 0.3.8
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/nodes/ha-mqtt-button.js +16 -4
- package/nodes/ha-mqtt-dmx-group.js +14 -4
- package/nodes/ha-mqtt-dmx.js +15 -4
- package/nodes/ha-mqtt-pir.js +15 -4
- package/nodes/ha-mqtt-relay.js +15 -4
- package/package.json +1 -1
package/nodes/ha-mqtt-button.js
CHANGED
|
@@ -108,18 +108,30 @@ module.exports = function (RED) {
|
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
// ── Debug mode safeguards ─────────────────────────────────────────
|
|
111
|
+
const _debugId = `S-${S.uid}${S.uidPostfix}`;
|
|
111
112
|
if (S.debugMode) {
|
|
112
|
-
setStatus('red', 'dot', `ha-mqtt-button "${
|
|
113
|
-
node.warn(`[DEBUG] ha-mqtt-button "${
|
|
113
|
+
setStatus('red', 'dot', `ha-mqtt-button "${_debugId}" ⚠ DEBUG MODE ON`);
|
|
114
|
+
node.warn(`[DEBUG] ha-mqtt-button "${_debugId}" — debug mode is enabled. Disable in production.`);
|
|
114
115
|
setTimeout(function () {
|
|
115
116
|
if (S.debugMode) {
|
|
116
117
|
S.debugMode = false;
|
|
117
|
-
node.warn(`[DEBUG] ha-mqtt-button "${
|
|
118
|
-
setStatus('yellow', 'ring', `${
|
|
118
|
+
node.warn(`[DEBUG] ha-mqtt-button "${_debugId}" — debug mode auto-disabled after 12 hours`);
|
|
119
|
+
setStatus('yellow', 'ring', `${_debugId} ready — awaiting HA`);
|
|
119
120
|
}
|
|
120
121
|
}, 12 * 60 * 60 * 1000);
|
|
121
122
|
}
|
|
122
123
|
|
|
124
|
+
|
|
125
|
+
// ── Fixture identity and topics ───────────────────────────────────────
|
|
126
|
+
const fixtureId = `S-${S.uid}${S.uidPostfix}`;
|
|
127
|
+
const objectId = `s_${S.uid}${S.uidPostfix}`.toLowerCase().replace(/[^a-z0-9_]/g, '_');
|
|
128
|
+
const fixtureTopic = cfg.buildTopic(cfg.discoveryPrefix, 'binary_sensor', fixtureId);
|
|
129
|
+
const uiBtnTopic = cfg.buildTopic(cfg.discoveryPrefix, 'button', fixtureId + '-BTN');
|
|
130
|
+
const cfgTopic = `${fixtureTopic}/${cfg.configTopic}`;
|
|
131
|
+
const statTopic = `${fixtureTopic}/${cfg.stateTopic}`;
|
|
132
|
+
const uiBtnCfgTopic = `${uiBtnTopic}/${cfg.configTopic}`;
|
|
133
|
+
const uiBtnCmdTopic = `${uiBtnTopic}/${cfg.commandTopic}`;
|
|
134
|
+
|
|
123
135
|
// ── Helpers ───────────────────────────────────────────────
|
|
124
136
|
function pub(topic, payload, retain) {
|
|
125
137
|
const strPayload = typeof payload === 'object' ? JSON.stringify(payload) : String(payload);
|
|
@@ -115,18 +115,28 @@ module.exports = function (RED) {
|
|
|
115
115
|
};
|
|
116
116
|
|
|
117
117
|
// ── Debug mode safeguards ─────────────────────────────────────────
|
|
118
|
+
const _debugId = `LG-${S.uid}${S.uidPostfix}`;
|
|
118
119
|
if (S.debugMode) {
|
|
119
|
-
setStatus('red', 'dot', `ha-mqtt-dmx-group "${
|
|
120
|
-
node.warn(`[DEBUG] ha-mqtt-dmx-group "${
|
|
120
|
+
setStatus('red', 'dot', `ha-mqtt-dmx-group "${_debugId}" ⚠ DEBUG MODE ON`);
|
|
121
|
+
node.warn(`[DEBUG] ha-mqtt-dmx-group "${_debugId}" — debug mode is enabled. Disable in production.`);
|
|
121
122
|
setTimeout(function () {
|
|
122
123
|
if (S.debugMode) {
|
|
123
124
|
S.debugMode = false;
|
|
124
|
-
node.warn(`[DEBUG] ha-mqtt-dmx-group "${
|
|
125
|
-
setStatus('yellow', 'ring', `${
|
|
125
|
+
node.warn(`[DEBUG] ha-mqtt-dmx-group "${_debugId}" — debug mode auto-disabled after 12 hours`);
|
|
126
|
+
setStatus('yellow', 'ring', `${_debugId} ready — awaiting HA`);
|
|
126
127
|
}
|
|
127
128
|
}, 12 * 60 * 60 * 1000);
|
|
128
129
|
}
|
|
129
130
|
|
|
131
|
+
|
|
132
|
+
// ── Group identity and topics ─────────────────────────────────────────
|
|
133
|
+
const groupId = `LG-${S.uid}${S.uidPostfix}`;
|
|
134
|
+
const objectId = `lg_${S.uid}${S.uidPostfix}`.toLowerCase().replace(/[^a-z0-9_]/g, '_');
|
|
135
|
+
const groupTopic = cfg.buildTopic(cfg.discoveryPrefix, 'light', groupId);
|
|
136
|
+
const cfgTopic = `${groupTopic}/${cfg.configTopic}`;
|
|
137
|
+
const statTopic = `${groupTopic}/${cfg.stateTopic}`;
|
|
138
|
+
const cmdTopic = `${groupTopic}/${cfg.commandTopic}`;
|
|
139
|
+
|
|
130
140
|
// ── Context helpers ───────────────────────────────────────
|
|
131
141
|
// Check disk store available once on startup
|
|
132
142
|
let diskAvailable = false;
|
package/nodes/ha-mqtt-dmx.js
CHANGED
|
@@ -139,14 +139,15 @@ module.exports = function (RED) {
|
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
// ── Debug mode safeguards ─────────────────────────────────────────
|
|
142
|
+
const _debugId = `${S.uidPrefix}-${S.uid}${S.uidPostfix}`;
|
|
142
143
|
if (S.debugMode) {
|
|
143
|
-
setStatus('red', 'dot', `ha-mqtt-dmx "${
|
|
144
|
-
node.warn(`[DEBUG] ha-mqtt-dmx "${
|
|
144
|
+
setStatus('red', 'dot', `ha-mqtt-dmx "${_debugId}" ⚠ DEBUG MODE ON`);
|
|
145
|
+
node.warn(`[DEBUG] ha-mqtt-dmx "${_debugId}" — debug mode is enabled. Disable in production.`);
|
|
145
146
|
setTimeout(function () {
|
|
146
147
|
if (S.debugMode) {
|
|
147
148
|
S.debugMode = false;
|
|
148
|
-
node.warn(`[DEBUG] ha-mqtt-dmx "${
|
|
149
|
-
setStatus('yellow', 'ring', `${
|
|
149
|
+
node.warn(`[DEBUG] ha-mqtt-dmx "${_debugId}" — debug mode auto-disabled after 12 hours`);
|
|
150
|
+
setStatus('yellow', 'ring', `${_debugId} ready — awaiting HA`);
|
|
150
151
|
}
|
|
151
152
|
}, 12 * 60 * 60 * 1000);
|
|
152
153
|
}
|
|
@@ -524,6 +525,16 @@ module.exports = function (RED) {
|
|
|
524
525
|
}
|
|
525
526
|
|
|
526
527
|
|
|
528
|
+
|
|
529
|
+
// ── Fixture identity and topics ───────────────────────────────────────
|
|
530
|
+
const fixtureId = `${S.uidPrefix}-${S.uid}${S.uidPostfix}`;
|
|
531
|
+
const objectId = `${S.uidPrefix}_${S.uid}${S.uidPostfix}`.toLowerCase().replace(/[^a-z0-9_]/g, '_');
|
|
532
|
+
const fixtureTopic = cfg.buildTopic(cfg.discoveryPrefix, 'light', fixtureId);
|
|
533
|
+
const cfgTopic = `${fixtureTopic}/${cfg.configTopic}`;
|
|
534
|
+
const statTopic = `${fixtureTopic}/${cfg.stateTopic}`;
|
|
535
|
+
const cmdTopic = `${fixtureTopic}/${cfg.commandTopic}`;
|
|
536
|
+
const dmxTopic = cfg.buildTopic(cfg.siteId, cfg.zone, 'dmx', S.universe);
|
|
537
|
+
|
|
527
538
|
// ── DMX channel conflict detection ───────────────────────────────────
|
|
528
539
|
function checkChannelConflicts() {
|
|
529
540
|
const globalCtx = node.context().global;
|
package/nodes/ha-mqtt-pir.js
CHANGED
|
@@ -109,18 +109,29 @@ module.exports = function (RED) {
|
|
|
109
109
|
};
|
|
110
110
|
|
|
111
111
|
// ── Debug mode safeguards ─────────────────────────────────────────
|
|
112
|
+
const _debugId = `S-${S.uid}${S.uidPostfix}`;
|
|
112
113
|
if (S.debugMode) {
|
|
113
|
-
setStatus('red', 'dot', `ha-mqtt-pir "${
|
|
114
|
-
node.warn(`[DEBUG] ha-mqtt-pir "${
|
|
114
|
+
setStatus('red', 'dot', `ha-mqtt-pir "${_debugId}" ⚠ DEBUG MODE ON`);
|
|
115
|
+
node.warn(`[DEBUG] ha-mqtt-pir "${_debugId}" — debug mode is enabled. Disable in production.`);
|
|
115
116
|
setTimeout(function () {
|
|
116
117
|
if (S.debugMode) {
|
|
117
118
|
S.debugMode = false;
|
|
118
|
-
node.warn(`[DEBUG] ha-mqtt-pir "${
|
|
119
|
-
setStatus('yellow', 'ring', `${
|
|
119
|
+
node.warn(`[DEBUG] ha-mqtt-pir "${_debugId}" — debug mode auto-disabled after 12 hours`);
|
|
120
|
+
setStatus('yellow', 'ring', `${_debugId} ready — awaiting HA`);
|
|
120
121
|
}
|
|
121
122
|
}, 12 * 60 * 60 * 1000);
|
|
122
123
|
}
|
|
123
124
|
|
|
125
|
+
|
|
126
|
+
// ── Fixture identity and topics ───────────────────────────────────────
|
|
127
|
+
const fixtureId = `S-${S.uid}${S.uidPostfix}`;
|
|
128
|
+
const objectId = `s_${S.uid}${S.uidPostfix}`.toLowerCase().replace(/[^a-z0-9_]/g, '_');
|
|
129
|
+
const fixtureTopic = cfg.buildTopic(cfg.discoveryPrefix, 'binary_sensor', fixtureId);
|
|
130
|
+
const cfgTopic = `${fixtureTopic}/${cfg.configTopic}`;
|
|
131
|
+
const statTopic = `${fixtureTopic}/${cfg.stateTopic}`;
|
|
132
|
+
const cmdTopic = `${fixtureTopic}/${cfg.commandTopic}`;
|
|
133
|
+
const avtyTopic = `${fixtureTopic}/${cfg.availTopic}`;
|
|
134
|
+
|
|
124
135
|
// ── Helpers ───────────────────────────────────────────────
|
|
125
136
|
function pub(topic, payload, retain) {
|
|
126
137
|
const strPayload = typeof payload === 'object' ? JSON.stringify(payload) : String(payload);
|
package/nodes/ha-mqtt-relay.js
CHANGED
|
@@ -115,18 +115,29 @@ module.exports = function (RED) {
|
|
|
115
115
|
};
|
|
116
116
|
|
|
117
117
|
// ── Debug mode safeguards ─────────────────────────────────────────
|
|
118
|
+
const _debugId = `${S.uidPrefix}-${S.uid}${S.uidPostfix}`;
|
|
118
119
|
if (S.debugMode) {
|
|
119
|
-
setStatus('red', 'dot', `ha-mqtt-relay "${
|
|
120
|
-
node.warn(`[DEBUG] ha-mqtt-relay "${
|
|
120
|
+
setStatus('red', 'dot', `ha-mqtt-relay "${_debugId}" ⚠ DEBUG MODE ON`);
|
|
121
|
+
node.warn(`[DEBUG] ha-mqtt-relay "${_debugId}" — debug mode is enabled. Disable in production.`);
|
|
121
122
|
setTimeout(function () {
|
|
122
123
|
if (S.debugMode) {
|
|
123
124
|
S.debugMode = false;
|
|
124
|
-
node.warn(`[DEBUG] ha-mqtt-relay "${
|
|
125
|
-
setStatus('yellow', 'ring', `${
|
|
125
|
+
node.warn(`[DEBUG] ha-mqtt-relay "${_debugId}" — debug mode auto-disabled after 12 hours`);
|
|
126
|
+
setStatus('yellow', 'ring', `${_debugId} ready — awaiting HA`);
|
|
126
127
|
}
|
|
127
128
|
}, 12 * 60 * 60 * 1000);
|
|
128
129
|
}
|
|
129
130
|
|
|
131
|
+
|
|
132
|
+
// ── Fixture identity and topics ───────────────────────────────────────
|
|
133
|
+
const fixtureId = `${S.uidPrefix}-${S.uid}${S.uidPostfix}`;
|
|
134
|
+
const objectId = `${S.uidPrefix}_${S.uid}${S.uidPostfix}`.toLowerCase().replace(/[^a-z0-9_]/g, '_');
|
|
135
|
+
const fixtureTopic = cfg.buildTopic(cfg.discoveryPrefix, 'light', fixtureId);
|
|
136
|
+
const cfgTopic = `${fixtureTopic}/${cfg.configTopic}`;
|
|
137
|
+
const statTopic = `${fixtureTopic}/${cfg.stateTopic}`;
|
|
138
|
+
const cmdTopic = `${fixtureTopic}/${cfg.commandTopic}`;
|
|
139
|
+
const relayTopic = cfg.buildTopic(cfg.siteId, cfg.zone, S.controllerNum, S.mqttSegment, S.relayNum);
|
|
140
|
+
|
|
130
141
|
// ── Context helpers ───────────────────────────────────────
|
|
131
142
|
// Check disk store available once on startup
|
|
132
143
|
let diskAvailable = false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-dmx-for-ha",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8",
|
|
4
4
|
"description": "DMX lighting control for Home Assistant via Node-RED and MQTT. Place a node, fill in the settings, deploy. Full HA device registry integration with RGBW/RGBWW/CCT/brightness colour modes, transitions, effects, and group control.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node-red",
|