node-red-contrib-dmx-for-ha 0.3.7 → 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 +11 -0
- package/nodes/ha-mqtt-dmx-group.js +9 -0
- package/nodes/ha-mqtt-dmx.js +10 -0
- package/nodes/ha-mqtt-pir.js +10 -0
- package/nodes/ha-mqtt-relay.js +10 -0
- package/package.json +1 -1
package/nodes/ha-mqtt-button.js
CHANGED
|
@@ -121,6 +121,17 @@ module.exports = function (RED) {
|
|
|
121
121
|
}, 12 * 60 * 60 * 1000);
|
|
122
122
|
}
|
|
123
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
|
+
|
|
124
135
|
// ── Helpers ───────────────────────────────────────────────
|
|
125
136
|
function pub(topic, payload, retain) {
|
|
126
137
|
const strPayload = typeof payload === 'object' ? JSON.stringify(payload) : String(payload);
|
|
@@ -128,6 +128,15 @@ module.exports = function (RED) {
|
|
|
128
128
|
}, 12 * 60 * 60 * 1000);
|
|
129
129
|
}
|
|
130
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
|
+
|
|
131
140
|
// ── Context helpers ───────────────────────────────────────
|
|
132
141
|
// Check disk store available once on startup
|
|
133
142
|
let diskAvailable = false;
|
package/nodes/ha-mqtt-dmx.js
CHANGED
|
@@ -525,6 +525,16 @@ module.exports = function (RED) {
|
|
|
525
525
|
}
|
|
526
526
|
|
|
527
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
|
+
|
|
528
538
|
// ── DMX channel conflict detection ───────────────────────────────────
|
|
529
539
|
function checkChannelConflicts() {
|
|
530
540
|
const globalCtx = node.context().global;
|
package/nodes/ha-mqtt-pir.js
CHANGED
|
@@ -122,6 +122,16 @@ module.exports = function (RED) {
|
|
|
122
122
|
}, 12 * 60 * 60 * 1000);
|
|
123
123
|
}
|
|
124
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
|
+
|
|
125
135
|
// ── Helpers ───────────────────────────────────────────────
|
|
126
136
|
function pub(topic, payload, retain) {
|
|
127
137
|
const strPayload = typeof payload === 'object' ? JSON.stringify(payload) : String(payload);
|
package/nodes/ha-mqtt-relay.js
CHANGED
|
@@ -128,6 +128,16 @@ module.exports = function (RED) {
|
|
|
128
128
|
}, 12 * 60 * 60 * 1000);
|
|
129
129
|
}
|
|
130
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
|
+
|
|
131
141
|
// ── Context helpers ───────────────────────────────────────
|
|
132
142
|
// Check disk store available once on startup
|
|
133
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",
|