node-red-contrib-garmin-empirbus 1.0.2 → 1.0.4

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 (33) hide show
  1. package/dist/channelHandling.js +86 -0
  2. package/dist/channelHandling.js.map +1 -0
  3. package/dist/helpers/channelHandling.js +86 -0
  4. package/dist/helpers/channelHandling.js.map +1 -0
  5. package/dist/helpers/getRepository.js +10 -0
  6. package/dist/helpers/getRepository.js.map +1 -0
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.js +9 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/nodes/channelHandling.js +86 -0
  11. package/dist/nodes/channelHandling.js.map +1 -0
  12. package/dist/nodes/empirbus-config.d.ts +3 -0
  13. package/dist/nodes/empirbus-config.html +31 -0
  14. package/dist/nodes/empirbus-config.js +97 -0
  15. package/dist/nodes/empirbus-config.js.map +1 -0
  16. package/dist/nodes/empirbus-dim.html +151 -0
  17. package/dist/nodes/empirbus-dim.js +57 -0
  18. package/dist/nodes/empirbus-dim.js.map +1 -0
  19. package/dist/nodes/empirbus-switch.html +151 -0
  20. package/dist/nodes/empirbus-switch.js +79 -0
  21. package/dist/nodes/empirbus-switch.js.map +1 -0
  22. package/dist/nodes/empirbus-toggle.d.ts +3 -0
  23. package/dist/nodes/empirbus-toggle.html +151 -0
  24. package/dist/nodes/empirbus-toggle.js +46 -0
  25. package/dist/nodes/empirbus-toggle.js.map +1 -0
  26. package/dist/types/EmpirbusConfigNode.d.ts +8 -0
  27. package/dist/types/EmpirbusConfigNode.js +3 -0
  28. package/dist/types/EmpirbusConfigNode.js.map +1 -0
  29. package/dist/types/EmpirbusToggleAndSwitchNode.js +3 -0
  30. package/dist/types/EmpirbusToggleAndSwitchNode.js.map +1 -0
  31. package/dist/types/EmpirbusToggleNode.js +3 -0
  32. package/dist/types/EmpirbusToggleNode.js.map +1 -0
  33. package/package.json +2 -2
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveChannelIds = exports.parseChannelIds = void 0;
4
+ const parseChannelIds = (value) => {
5
+ if (!value)
6
+ return [];
7
+ return value
8
+ .split(',')
9
+ .map(s => Number(s.trim()))
10
+ .filter(n => Number.isFinite(n));
11
+ };
12
+ exports.parseChannelIds = parseChannelIds;
13
+ const resolveChannelIds = async (node, msg, repo) => {
14
+ const fromCheckbox = node.selectedChannelIds ?? [];
15
+ if (fromCheckbox.length > 0)
16
+ return fromCheckbox;
17
+ const fromMsgIds = getChannelIdsFromMsg(msg);
18
+ if (fromMsgIds != null)
19
+ return fromMsgIds;
20
+ const fromMsgPayload = getChannelIdsFromTopicOfMsg(msg);
21
+ if (fromMsgPayload != null)
22
+ return fromMsgPayload;
23
+ const fromMsgId = getChannelIdFromMsg(msg);
24
+ if (fromMsgId != null)
25
+ return [fromMsgId];
26
+ if (typeof node.channelId === 'number' && Number.isFinite(node.channelId))
27
+ return [node.channelId];
28
+ const fromMsgName = getChannelNameFromMsg(msg);
29
+ const name = fromMsgName ?? node.channelName;
30
+ if (!name)
31
+ return [];
32
+ const index = await ensureChannelIndex(node, repo);
33
+ const mapped = index.get(name);
34
+ if (typeof mapped === 'number' && Number.isFinite(mapped)) {
35
+ return [mapped];
36
+ }
37
+ return [];
38
+ };
39
+ exports.resolveChannelIds = resolveChannelIds;
40
+ const getChannelIdFromMsg = (msg) => {
41
+ const raw = msg.channelId;
42
+ if (typeof raw === 'number' && Number.isFinite(raw))
43
+ return raw;
44
+ if (typeof raw === 'string' && raw.trim().length > 0) {
45
+ const n = Number(raw);
46
+ if (Number.isFinite(n))
47
+ return n;
48
+ }
49
+ return null;
50
+ };
51
+ const getChannelIdsFromMsg = (msg) => {
52
+ const raw = msg.channelIds;
53
+ if (typeof raw === 'number' && Number.isFinite(raw))
54
+ return [raw];
55
+ if (typeof raw === 'string' && raw.trim().length > 0)
56
+ return (0, exports.parseChannelIds)(raw);
57
+ return null;
58
+ };
59
+ const getChannelIdsFromTopicOfMsg = (msg) => {
60
+ const raw = msg.topic;
61
+ if (typeof raw === 'number' && Number.isFinite(raw))
62
+ return [raw];
63
+ if (typeof raw === 'string' && raw.trim().length > 0)
64
+ return (0, exports.parseChannelIds)(raw);
65
+ return null;
66
+ };
67
+ const getChannelNameFromMsg = (msg) => {
68
+ const raw = msg.channelName;
69
+ if (typeof raw === 'string' && raw.trim().length > 0)
70
+ return raw.trim();
71
+ return null;
72
+ };
73
+ const ensureChannelIndex = async (node, repo) => {
74
+ if (node.channelIndexByName)
75
+ return node.channelIndexByName;
76
+ const list = await repo.getChannelList();
77
+ const index = new Map();
78
+ list.forEach((ch) => {
79
+ if (ch.name) {
80
+ index.set(ch.name, ch.id);
81
+ }
82
+ });
83
+ node.channelIndexByName = index;
84
+ return index;
85
+ };
86
+ //# sourceMappingURL=channelHandling.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channelHandling.js","sourceRoot":"","sources":["../src/channelHandling.ts"],"names":[],"mappings":";;;AAIO,MAAM,eAAe,GAAG,CAAC,KAAc,EAAY,EAAE;IACxD,IAAI,CAAC,KAAK;QACN,OAAO,EAAE,CAAA;IACb,OAAO,KAAK;SACP,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;SAC1B,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;AACxC,CAAC,CAAA;AAPY,QAAA,eAAe,mBAO3B;AAEM,MAAM,iBAAiB,GAAG,KAAK,EAAE,IAAiC,EAAE,GAAsB,EAAE,IAA+B,EAAqB,EAAE;IACrJ,MAAM,YAAY,GAAG,IAAI,CAAC,kBAAkB,IAAI,EAAE,CAAA;IAClD,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC;QACvB,OAAO,YAAY,CAAA;IAEvB,MAAM,UAAU,GA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AAC,MAAM,GAAG,CAAC;QAChD,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;IACrB,OAAO,IAAI,CAAA;AACf,CAAC,CAAA;AAED,MAAM,kBAAkB,GAAG,KAAK,EAAE,IAAiC,EAAE,IAA+B,EAAgC,EAAE;IAElI,IAAI,IAAI,CAAC,kBAAkB;QACvB,OAAO,IAAI,CAAC,kBAAkB,CAAA;IAElC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAA;IACxC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAA;IACvC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAW,EAAE,EAAE;QACzB,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC;YACV,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,CAAA;QAC7B,CAAC;IACL,CAAC,CAAC,CAAA;IACF,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAA;IAC/B,OAAO,KAAK,CAAA;AAChB,CAAC,CAAA"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveChannelIds = exports.parseChannelIds = void 0;
4
+ const parseChannelIds = (value) => {
5
+ if (!value)
6
+ return [];
7
+ return value
8
+ .split(',')
9
+ .map(s => Number(s.trim()))
10
+ .filter(n => Number.isFinite(n));
11
+ };
12
+ exports.parseChannelIds = parseChannelIds;
13
+ const resolveChannelIds = async (node, msg, repo) => {
14
+ const fromCheckbox = node.selectedChannelIds ?? [];
15
+ if (fromCheckbox.length > 0)
16
+ return fromCheckbox;
17
+ const fromMsgIds = getChannelIdsFromMsg(msg);
18
+ if (fromMsgIds != null)
19
+ return fromMsgIds;
20
+ const fromMsgPayload = getChannelIdsFromTopicOfMsg(msg);
21
+ if (fromMsgPayload != null)
22
+ return fromMsgPayload;
23
+ const fromMsgId = getChannelIdFromMsg(msg);
24
+ if (fromMsgId != null)
25
+ return [fromMsgId];
26
+ if (typeof node.channelId === 'number' && Number.isFinite(node.channelId))
27
+ return [node.channelId];
28
+ const fromMsgName = getChannelNameFromMsg(msg);
29
+ const name = fromMsgName ?? node.channelName;
30
+ if (!name)
31
+ return [];
32
+ const index = await ensureChannelIndex(node, repo);
33
+ const mapped = index.get(name);
34
+ if (typeof mapped === 'number' && Number.isFinite(mapped)) {
35
+ return [mapped];
36
+ }
37
+ return [];
38
+ };
39
+ exports.resolveChannelIds = resolveChannelIds;
40
+ const getChannelIdFromMsg = (msg) => {
41
+ const raw = msg.channelId;
42
+ if (typeof raw === 'number' && Number.isFinite(raw))
43
+ return raw;
44
+ if (typeof raw === 'string' && raw.trim().length > 0) {
45
+ const n = Number(raw);
46
+ if (Number.isFinite(n))
47
+ return n;
48
+ }
49
+ return null;
50
+ };
51
+ const getChannelIdsFromMsg = (msg) => {
52
+ const raw = msg.channelIds;
53
+ if (typeof raw === 'number' && Number.isFinite(raw))
54
+ return [raw];
55
+ if (typeof raw === 'string' && raw.trim().length > 0)
56
+ return (0, exports.parseChannelIds)(raw);
57
+ return null;
58
+ };
59
+ const getChannelIdsFromTopicOfMsg = (msg) => {
60
+ const raw = msg.topic;
61
+ if (typeof raw === 'number' && Number.isFinite(raw))
62
+ return [raw];
63
+ if (typeof raw === 'string' && raw.trim().length > 0)
64
+ return (0, exports.parseChannelIds)(raw);
65
+ return null;
66
+ };
67
+ const getChannelNameFromMsg = (msg) => {
68
+ const raw = msg.channelName;
69
+ if (typeof raw === 'string' && raw.trim().length > 0)
70
+ return raw.trim();
71
+ return null;
72
+ };
73
+ const ensureChannelIndex = async (node, repo) => {
74
+ if (node.channelIndexByName)
75
+ return node.channelIndexByName;
76
+ const list = await repo.getChannelList();
77
+ const index = new Map();
78
+ list.forEach((ch) => {
79
+ if (ch.name) {
80
+ index.set(ch.name, ch.id);
81
+ }
82
+ });
83
+ node.channelIndexByName = index;
84
+ return index;
85
+ };
86
+ //# sourceMappingURL=channelHandling.js.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,CAAA;QAC7B,CAAC;IACL,CAAC,CAAC,CAAA;IACF,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAA;IAC/B,OAAO,KAAK,CAAA;AAChB,CAAC,CAAA"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRepository = void 0;
4
+ const getRepository = async (node) => {
5
+ if (!node.configNode)
6
+ return null;
7
+ return node.configNode.getRepository();
8
+ };
9
+ exports.getRepository = getRepository;
10
+ //# sourceMappingURL=getRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRepository.js","sourceRoot":"","sources":["../../src/helpers/getRepository.ts"],"names":[],"mappings":";;;AAGO,MAAM,aAAa,GAAG,KAAK,EAAE,IAAiC,EAA6C,EAAE;IAChH,IAAI,CAAC,IAAI,CAAC,UAAU;QAChB,OAAO,IAAI,CAAA;IACf,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,CAAA;AAC1C,CAAC,CAAA;AAJY,QAAA,aAAa,iBAIzB"}
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const garmin_empirbus_ts_1 = require("garmin-empirbus-ts");
4
+ const repo = new garmin_empirbus_ts_1.EmpirBusChannelRepository('ws://192.168.1.1:8888/ws');
5
+ repo.connect();
6
+ setInterval(() => {
7
+ console.log(repo.getChannelList());
8
+ }, 5 * 1000);
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,2DAA8D;AAE9D,MAAM,IAAI,GAAG,IAAI,8CAAyB,CAAC,0BAA0B,CAAC,CAAA;AACtE,IAAI,CAAC,OAAO,EAAE,CAAA;AAEd,WAAW,CAAC,GAAG,EAAE;IACb,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAA;AACtC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAA"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveChannelIds = exports.parseChannelIds = void 0;
4
+ const parseChannelIds = (value) => {
5
+ if (!value)
6
+ return [];
7
+ return value
8
+ .split(',')
9
+ .map(s => Number(s.trim()))
10
+ .filter(n => Number.isFinite(n));
11
+ };
12
+ exports.parseChannelIds = parseChannelIds;
13
+ const resolveChannelIds = async (node, msg, repo) => {
14
+ const fromCheckbox = node.selectedChannelIds ?? [];
15
+ if (fromCheckbox.length > 0)
16
+ return fromCheckbox;
17
+ const fromMsgIds = getChannelIdsFromMsg(msg);
18
+ if (fromMsgIds != null)
19
+ return fromMsgIds;
20
+ const fromMsgPayload = getChannelIdsFromPayloadOfMsg(msg);
21
+ if (fromMsgPayload != null)
22
+ return fromMsgPayload;
23
+ const fromMsgId = getChannelIdFromMsg(msg);
24
+ if (fromMsgId != null)
25
+ return [fromMsgId];
26
+ if (typeof node.channelId === 'number' && Number.isFinite(node.channelId))
27
+ return [node.channelId];
28
+ const fromMsgName = getChannelNameFromMsg(msg);
29
+ const name = fromMsgName ?? node.channelName;
30
+ if (!name)
31
+ return [];
32
+ const index = await ensureChannelIndex(node, repo);
33
+ const mapped = index.get(name);
34
+ if (typeof mapped === 'number' && Number.isFinite(mapped)) {
35
+ return [mapped];
36
+ }
37
+ return [];
38
+ };
39
+ exports.resolveChannelIds = resolveChannelIds;
40
+ const getChannelIdFromMsg = (msg) => {
41
+ const raw = msg.channelId;
42
+ if (typeof raw === 'number' && Number.isFinite(raw))
43
+ return raw;
44
+ if (typeof raw === 'string' && raw.trim().length > 0) {
45
+ const n = Number(raw);
46
+ if (Number.isFinite(n))
47
+ return n;
48
+ }
49
+ return null;
50
+ };
51
+ const getChannelIdsFromMsg = (msg) => {
52
+ const raw = msg.channelIds;
53
+ if (typeof raw === 'number' && Number.isFinite(raw))
54
+ return [raw];
55
+ if (typeof raw === 'string' && raw.trim().length > 0)
56
+ return (0, exports.parseChannelIds)(raw);
57
+ return null;
58
+ };
59
+ const getChannelIdsFromPayloadOfMsg = (msg) => {
60
+ const raw = msg.payload;
61
+ if (typeof raw === 'number' && Number.isFinite(raw))
62
+ return [raw];
63
+ if (typeof raw === 'string' && raw.trim().length > 0)
64
+ return (0, exports.parseChannelIds)(raw);
65
+ return null;
66
+ };
67
+ const getChannelNameFromMsg = (msg) => {
68
+ const raw = msg.channelName;
69
+ if (typeof raw === 'string' && raw.trim().length > 0)
70
+ return raw.trim();
71
+ return null;
72
+ };
73
+ const ensureChannelIndex = async (node, repo) => {
74
+ if (node.channelIndexByName)
75
+ return node.channelIndexByName;
76
+ const list = await repo.getChannelList();
77
+ const index = new Map();
78
+ list.forEach((ch) => {
79
+ if (ch.name) {
80
+ index.set(ch.name, ch.id);
81
+ }
82
+ });
83
+ node.channelIndexByName = index;
84
+ return index;
85
+ };
86
+ //# sourceMappingURL=channelHandling.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channelHandling.js","sourceRoot":"","sources":["../../src/nodes/channelHandling.ts"],"names":[],"mappings":";;;AAIO,MAAM,eAAe,GAAG,CAAC,KAAc,EAAY,EAAE;IACxD,IAAI,CAAC,KAAK;QACN,OAAO,EAAE,CAAA;IACb,OAAO,KAAK;SACP,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;SAC1B,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;AACxC,CAAC,CAAA;AAPY,QAAA,eAAe,mBAO3B;AAEM,MAAM,iBAAiB,GAAG,KAAK,EAAE,IAAwB,EAAE,GAAsB,EAAE,IAA+B,EAAqB,EAAE;IAC5I,MAAM,YAAY,GAAG,IAAI,CAAC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pE,MAAM,GAAG,GAAI,GAAW,CAAC,WAAW,CAAA;IACpC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QAChD,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;IACrB,OAAO,IAAI,CAAA;AACf,CAAC,CAAA;AAED,MAAM,kBAAkB,GAAG,KAAK,EAAE,IAAwB,EAAE,IAA+B,EAAgC,EAAE;IAEzH,IAAI,IAAI,CAAC,kBAAkB;QACvB,OAAO,IAAI,CAAC,kBAAkB,CAAA;IAElC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAA;IACxC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAA;IACvC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAW,EAAE,EAAE;QACzB,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC;YACV,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,CAAA;QAC7B,CAAC;IACL,CAAC,CAAC,CAAA;IACF,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAA;IAC/B,OAAO,KAAK,CAAA;AAChB,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { NodeInitializer } from 'node-red';
2
+ declare const nodeInit: NodeInitializer;
3
+ export = nodeInit;
@@ -0,0 +1,31 @@
1
+ <script type="text/x-red" data-template-name="empirbus-config">
2
+ <div class="form-row">
3
+ <label for="node-config-input-name">
4
+ <i class="fa fa-tag"></i> Name
5
+ </label>
6
+ <input type="text" id="node-config-input-name">
7
+ </div>
8
+
9
+ <div class="form-row">
10
+ <label for="node-config-input-url">
11
+ <i class="fa fa-globe"></i> WebSocket URL
12
+ </label>
13
+ <input type="text" id="node-config-input-url" placeholder="ws://192.168.1.1:8888">
14
+ </div>
15
+ </script>
16
+
17
+ <script type="text/javascript">
18
+ /* global RED */
19
+ RED.nodes.registerType('empirbus-config', {
20
+ category: 'config',
21
+ defaults: {
22
+ name: { value: '' },
23
+ url: { value: '', required: true }
24
+ },
25
+ label() {
26
+ if (this.name) return this.name
27
+ if (this.url) return this.url
28
+ return 'empirbus-config'
29
+ }
30
+ })
31
+ </script>
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ const garmin_empirbus_ts_1 = require("garmin-empirbus-ts");
3
+ const nodeInit = RED => {
4
+ function scheduleReconnect(node) {
5
+ if (node.timeout) {
6
+ node.log(`node.timeout not null, return`);
7
+ return;
8
+ }
9
+ node.timeout = setTimeout(() => {
10
+ if (node.timeout)
11
+ clearTimeout(node.timeout);
12
+ node.repository = connect(node);
13
+ }, 1000);
14
+ }
15
+ function connect(node) {
16
+ const repo = new garmin_empirbus_ts_1.EmpirBusChannelRepository(node.url);
17
+ node.repository = repo;
18
+ node.log(`Connecting to EmpirBus at ${node.url}`);
19
+ repo.onState(state => {
20
+ if (node.timeout) {
21
+ clearTimeout(node.timeout);
22
+ node.timeout = null;
23
+ }
24
+ node.onStateFns.forEach(fn => fn(state));
25
+ switch (state) {
26
+ case garmin_empirbus_ts_1.EmpirBusClientState.Error:
27
+ node.error(`ERROR connecting to EmpirBus at ${node.url}`);
28
+ scheduleReconnect(node);
29
+ break;
30
+ default:
31
+ case garmin_empirbus_ts_1.EmpirBusClientState.Closed:
32
+ node.log(`Connection to EmpirBus at ${node.url} closed. Trying to reconnect in 1 second.`);
33
+ scheduleReconnect(node);
34
+ break;
35
+ }
36
+ });
37
+ repo
38
+ .connect()
39
+ .then(() => node.log(`Connected to EmpirBus at ${node.url}`))
40
+ .catch(error => {
41
+ node.error(error);
42
+ scheduleReconnect(node);
43
+ });
44
+ return repo;
45
+ }
46
+ function EmpirbusConfigNodeConstructor(config) {
47
+ RED.nodes.createNode(this, config);
48
+ this.name = config.name;
49
+ this.url = config.url;
50
+ this.repository = null;
51
+ this.onStateFns = [];
52
+ this.timeout = null;
53
+ const context = this.context();
54
+ context.set('isClosing', false);
55
+ context.set('reconnectTimeout', null);
56
+ this.repository = connect(this);
57
+ this.getRepository = async () => {
58
+ if (this.repository)
59
+ return this.repository;
60
+ this.repository = connect(this);
61
+ return this.repository;
62
+ };
63
+ this.on('close', () => {
64
+ const ctx = this.context();
65
+ ctx.set('isClosing', true);
66
+ const timeout = ctx.get('reconnectTimeout');
67
+ if (timeout)
68
+ clearTimeout(timeout);
69
+ ctx.set('reconnectTimeout', null);
70
+ const repo = this.repository;
71
+ if (repo && typeof repo.close === 'function')
72
+ repo.close();
73
+ });
74
+ this.onState = (fn) => {
75
+ this.onStateFns.push(fn);
76
+ };
77
+ }
78
+ RED.nodes.registerType('empirbus-config', EmpirbusConfigNodeConstructor);
79
+ RED.httpAdmin.get('/empirbus/:id/channels', async (req, res) => {
80
+ const configNode = RED.nodes.getNode(req.params.id);
81
+ if (!configNode) {
82
+ res.status(404).json({ error: 'config not found' });
83
+ return;
84
+ }
85
+ const repo = await configNode.getRepository();
86
+ repo
87
+ .getChannelList()
88
+ .then((channels) => {
89
+ res.json(channels);
90
+ })
91
+ .catch(error => {
92
+ res.status(500).json({ error: String(error) });
93
+ });
94
+ });
95
+ };
96
+ module.exports = nodeInit;
97
+ //# sourceMappingURL=empirbus-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empirbus-config.js","sourceRoot":"","sources":["../../src/nodes/empirbus-config.ts"],"names":[],"mappings":";AAAA,2DAA4F;AAS5F,MAAM,QAAQ,GAAoB,GAAG,CAAC,EAAE;IACpC,SAAS,iBAAiB,CAAC,IAAwB;QAC/C,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,IAAI,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAA;YACzC,OAAM;QACV,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YAC3B,IAAI,IAAI,CAAC,OAAO;gBACZ,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YAC9B,IAAI,CAAC,UAAU,GAA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CAAA"}
@@ -0,0 +1,151 @@
1
+ <script type="text/x-red" data-template-name="empirbus-dim">
2
+
3
+ <style>
4
+ .empirbus-row { display: flex; align-items: flex-start; gap: 8px; }
5
+ .empirbus-row input[type="text"], .empirbus-row input[type="number"] { flex: 1; width: 100%; }
6
+ .empirbus-row label { flex: 0 0 160px; max-width: 160px; white-space: nowrap; padding-top: 7px; }
7
+ .empirbus-input-wrapper { display: flex; flex-direction: column; flex: 1; }
8
+ .empirbus-input-wrapper input { flex: 1; }
9
+ .empirbus-input-wrapper input[type="checkbox"] { flex: 0 0 auto; width: auto; margin-top: 4px; align-self: flex-start; }
10
+ .empirbus-input-wrapper .help { font-size: 0.85em; opacity: 0.8; margin-top: 2px; }
11
+ .empirbus-channel-checkbox { flex: 0 0 20px; }
12
+ .empirbus-channel-id { flex: 0 0 50px; font-weight: bold; opacity: 0.8; text-align: right; display: block; padding-right: 5px; }
13
+ .empirbus-channel-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
14
+ .empirbus-channel-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
15
+ </style>
16
+
17
+ <div class="form-row empirbus-row">
18
+ <label for="node-input-name">
19
+ <i class="fa fa-tag"></i> Name
20
+ </label>
21
+ <input type="text" id="node-input-name">
22
+ </div>
23
+
24
+ <div class="form-row empirbus-row">
25
+ <label for="node-input-config">
26
+ <i class="fa fa-cog"></i> EmpirBus Config
27
+ </label>
28
+ <input type="text" id="node-input-config">
29
+ </div>
30
+
31
+ <div class="form-row empirbus-row">
32
+ <label for="node-input-channelId">
33
+ <i class="fa fa-hashtag"></i> Channel ID
34
+ </label>
35
+ <div class="empirbus-input-wrapper">
36
+ <input type="number" id="node-input-channelId" style="width: 100%;">
37
+ <span class="help">Fallback, wenn keine Checkbox gewählt und kein Name gesetzt ist</span>
38
+ </div>
39
+ </div>
40
+
41
+ <div class="form-row empirbus-row">
42
+ <label for="node-input-channelName">
43
+ <i class="fa fa-font"></i> Channel Name
44
+ </label>
45
+ <input type="text" id="node-input-channelName">
46
+ </div>
47
+
48
+ <div class="form-row empirbus-row">
49
+ <label for="node-input-acknowledge">
50
+ <i class="fa fa-check"></i> bestätigen
51
+ </label>
52
+ <div class="empirbus-input-wrapper">
53
+ <input type="checkbox" id="node-input-acknowledge">
54
+ <span class="help">Wenn der Befehl erfolgreich ist, wird acknowledge:true an das msg Objekt gehängt</span>
55
+ </div>
56
+ </div>
57
+
58
+ <div class="form-row">
59
+ <label>Kanäle</label>
60
+ <div id="empirbus-dim-channels"></div>
61
+ <input type="hidden" id="node-input-channelIds">
62
+ <span class="help">Auswahl mehrerer Kanäle</span>
63
+ </div>
64
+
65
+ </script>
66
+
67
+ <script type="text/javascript">
68
+ /* exported oneditprepare, oneditsave */
69
+ /* global RED */
70
+ RED.nodes.registerType('empirbus-dim', {
71
+ category: 'output',
72
+ color: '#a6bbcf',
73
+ defaults: {
74
+ name: { value: '' },
75
+ config: { value: '', type: 'empirbus-config', required: true },
76
+ channelId: { value: '', required: false },
77
+ channelName: { value: '', required: false },
78
+ channelIds: { value: '', required: false },
79
+ acknowledge: { value: false }
80
+ },
81
+ inputs: 1,
82
+ outputs: 1,
83
+ icon: 'bridge.svg',
84
+ label() {
85
+ return this.name || "EmpirBus Dim"
86
+ },
87
+
88
+ oneditprepare() {
89
+ const node = this
90
+
91
+ $('#node-input-acknowledge')
92
+ .prop('checked', !!node.acknowledge)
93
+
94
+ const loadChannels = configId => {
95
+ if (!configId) return
96
+ const container = $('#empirbus-dim-channels')
97
+ container.empty()
98
+
99
+ $.getJSON('empirbus/' + configId + '/channels', channels => {
100
+ const selected = (node.channelIds || '')
101
+ .split(',')
102
+ .map(s => s.trim())
103
+ .filter(s => s.length > 0)
104
+
105
+ channels.forEach(ch => {
106
+ const id = String(ch.id)
107
+ const row = $('<div/>').addClass('empirbus-channel-row')
108
+
109
+ const checkbox = $('<input type="checkbox">')
110
+ .addClass('empirbus-channel-checkbox')
111
+ .attr('data-channel-id', id)
112
+
113
+ if (selected.indexOf(id) !== -1) {
114
+ checkbox.prop('checked', true)
115
+ }
116
+
117
+ const idLabel = $('<span/>')
118
+ .addClass('empirbus-channel-id')
119
+ .text(id)
120
+
121
+ const labelText = ch.description || ch.name || 'Channel ' + id
122
+ const label = $('<span/>')
123
+ .addClass('empirbus-channel-label')
124
+ .text(labelText)
125
+
126
+ row.append(checkbox).append(idLabel).append(label)
127
+ container.append(row)
128
+ })
129
+ })
130
+ }
131
+
132
+ $('#node-input-config').on('change', function () {
133
+ loadChannels($(this).val())
134
+ })
135
+
136
+ const initialConfig = $('#node-input-config').val()
137
+ if (initialConfig) loadChannels(initialConfig)
138
+ },
139
+
140
+ oneditsave() {
141
+ const ids = []
142
+ $('#empirbus-dim-channels input[type="checkbox"]:checked').each(function () {
143
+ ids.push($(this).attr('data-channel-id'))
144
+ })
145
+ $('#node-input-channelIds').val(ids.join(','))
146
+
147
+ const acknowledge = $('#node-input-acknowledge').is(':checked')
148
+ $('#node-input-acknowledge').val(acknowledge)
149
+ }
150
+ })
151
+ </script>
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ const channelHandling_1 = require("../helpers/channelHandling");
3
+ const getRepository_1 = require("../helpers/getRepository");
4
+ const nodeInit = RED => {
5
+ function EmpirbusDimNodeConstructor(config) {
6
+ RED.nodes.createNode(this, config);
7
+ this.acknowledge = config.acknowledge || false;
8
+ this.configNode = RED.nodes.getNode(config.config);
9
+ this.channelId = config.channelId ? Number(config.channelId) : undefined;
10
+ this.channelName = config.channelName || undefined;
11
+ this.channelIds = config.channelIds || '';
12
+ this.channelIds = config.channelIds || '';
13
+ this.selectedChannelIds = (0, channelHandling_1.parseChannelIds)(this.channelIds);
14
+ this.on('input', async (msg) => {
15
+ const repo = await (0, getRepository_1.getRepository)(this);
16
+ if (!repo) {
17
+ this.error('No EmpirBus config node configured. Configure and select an EmpirBus config node first!', msg);
18
+ return;
19
+ }
20
+ const ids = await (0, channelHandling_1.resolveChannelIds)(this, msg, repo);
21
+ if (ids.length === 0) {
22
+ this.error('No matching channel found', msg);
23
+ this.send(msg);
24
+ return;
25
+ }
26
+ try {
27
+ let level = msg.payload * 10;
28
+ if (level < 120 && msg.payload > 0)
29
+ level = 120;
30
+ const results = ids.map(id => repo.dim(id, level));
31
+ if (results.filter(result => result.hasFailed).length === 0) {
32
+ if (this.acknowledge) {
33
+ msg.acknowledge = true;
34
+ msg.payload = {
35
+ state: {
36
+ brightness: msg.payload
37
+ }
38
+ };
39
+ }
40
+ this.log(`Dimmed channels ${ids.join(',')} ${msg.payload}, returning message ${JSON.stringify(msg)}`);
41
+ }
42
+ else {
43
+ results.filter(result => result.hasFailed).forEach(result => {
44
+ this.error(result.errors.join(', '), msg);
45
+ });
46
+ }
47
+ this.send(msg);
48
+ }
49
+ catch (error) {
50
+ this.error(error, msg);
51
+ }
52
+ });
53
+ }
54
+ RED.nodes.registerType('empirbus-dim', EmpirbusDimNodeConstructor);
55
+ };
56
+ module.exports = nodeInit;
57
+ //# sourceMappingURL=empirbus-dim.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empirbus-dim.js","sourceRoot":"","sources":["../../src/nodes/empirbus-dim.ts"],"names":[],"mappings":";AAEA,gEAA+E;AAG/E,4DAAwD;AAWxD,MAAM,QAAQ,GAAoB,GAAG,CAAC,EAAE;IACpC,SAAS,0BAA0B,CAAoC,MAA0B;QAC7F,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;QAClC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,KAAK,CAAA;QAC9C,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAA8B,CAAA;QAC/E,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;QACxE,IAAI,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,CAAC,EAAE,CAAC;oBAC1D,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;wBACnB,GAAG,CAAC,WAAW,GAAG,IAAI,CAAA;wBACtB,GAAG,CAAC,OAAO,GAAG;4BACV,KAAK,EAAE;gCACH,UAAU,EAAE,GAAG,CAAC,OAAO;6BAC1B;yBACJ,CAAA;oBACL,CAAC;oBACD,IAAI,CAAC,GAAG,CAAC,mBAAmB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,OAAO,uBAAuB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;gBACzG,CAAC;qBACI,CAAC;oBACF,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;wBACxD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAA;oBAC7C,CAAC,CAAC,CAAA;gBACN,CAAC;gBAED,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YAClB,CAAC;YACD,OAAO,KAAK,EAAE,CAAC;gBACX,IAAI,CAAC,KAAK,CAAC,KAAc,EAAE,GAAG,CAAC,CAAA;YACnC,CAAC;QACL,CAAC,CAAC,CAAA;IACN,CAAC;IAED,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,cAAc,EAAE,0BAA0B,CAAC,CAAA;AACtE,CAAC,CAAA;AAED,iBAAS,QAAQ,CAAA"}
@@ -0,0 +1,151 @@
1
+ <script type="text/x-red" data-template-name="empirbus-switch">
2
+
3
+ <style>
4
+ .empirbus-row { display: flex; align-items: flex-start; gap: 8px; }
5
+ .empirbus-row input[type="text"], .empirbus-row input[type="number"] { flex: 1; width: 100%; }
6
+ .empirbus-row label { flex: 0 0 160px; max-width: 160px; white-space: nowrap; padding-top: 7px; }
7
+ .empirbus-input-wrapper { display: flex; flex-direction: column; flex: 1; }
8
+ .empirbus-input-wrapper input { flex: 1; }
9
+ .empirbus-input-wrapper input[type="checkbox"] { flex: 0 0 auto; width: auto; margin-top: 4px; align-self: flex-start; }
10
+ .empirbus-input-wrapper .help { font-size: 0.85em; opacity: 0.8; margin-top: 2px; }
11
+ .empirbus-channel-checkbox { flex: 0 0 20px; }
12
+ .empirbus-channel-id { flex: 0 0 50px; font-weight: bold; opacity: 0.8; text-align: right; display: block; padding-right: 5px; }
13
+ .empirbus-channel-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
14
+ .empirbus-channel-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
15
+ </style>
16
+
17
+ <div class="form-row empirbus-row">
18
+ <label for="node-input-name">
19
+ <i class="fa fa-tag"></i> Name
20
+ </label>
21
+ <input type="text" id="node-input-name">
22
+ </div>
23
+
24
+ <div class="form-row empirbus-row">
25
+ <label for="node-input-config">
26
+ <i class="fa fa-cog"></i> EmpirBus Config
27
+ </label>
28
+ <input type="text" id="node-input-config">
29
+ </div>
30
+
31
+ <div class="form-row empirbus-row">
32
+ <label for="node-input-channelId">
33
+ <i class="fa fa-hashtag"></i> Channel ID
34
+ </label>
35
+ <div class="empirbus-input-wrapper">
36
+ <input type="number" id="node-input-channelId" style="width: 100%;">
37
+ <span class="help">Fallback, wenn keine Checkbox gewählt und kein Name gesetzt ist</span>
38
+ </div>
39
+ </div>
40
+
41
+ <div class="form-row empirbus-row">
42
+ <label for="node-input-channelName">
43
+ <i class="fa fa-font"></i> Channel Name
44
+ </label>
45
+ <input type="text" id="node-input-channelName">
46
+ </div>
47
+
48
+ <div class="form-row empirbus-row">
49
+ <label for="node-input-acknowledge">
50
+ <i class="fa fa-check"></i> bestätigen
51
+ </label>
52
+ <div class="empirbus-input-wrapper">
53
+ <input type="checkbox" id="node-input-acknowledge">
54
+ <span class="help">Wenn der Befehl erfolgreich ist, wird acknowledge:true an das msg Objekt gehängt</span>
55
+ </div>
56
+ </div>
57
+
58
+ <div class="form-row">
59
+ <label>Kanäle</label>
60
+ <div id="empirbus-switch-channels"></div>
61
+ <input type="hidden" id="node-input-channelIds">
62
+ <span class="help">Auswahl mehrerer Kanäle</span>
63
+ </div>
64
+
65
+ </script>
66
+
67
+ <script type="text/javascript">
68
+ /* exported oneditprepare, oneditsave */
69
+ /* global RED */
70
+ RED.nodes.registerType('empirbus-switch', {
71
+ category: 'output',
72
+ color: '#a6bbcf',
73
+ defaults: {
74
+ name: { value: '' },
75
+ config: { value: '', type: 'empirbus-config', required: true },
76
+ channelId: { value: '', required: false },
77
+ channelName: { value: '', required: false },
78
+ channelIds: { value: '', required: false },
79
+ acknowledge: { value: false }
80
+ },
81
+ inputs: 1,
82
+ outputs: 1,
83
+ icon: 'bridge.svg',
84
+ label() {
85
+ return this.name || "EmpirBus Switch"
86
+ },
87
+
88
+ oneditprepare() {
89
+ const node = this
90
+
91
+ $('#node-input-acknowledge')
92
+ .prop('checked', !!node.acknowledge)
93
+
94
+ const loadChannels = configId => {
95
+ if (!configId) return
96
+ const container = $('#empirbus-switch-channels')
97
+ container.empty()
98
+
99
+ $.getJSON('empirbus/' + configId + '/channels', channels => {
100
+ const selected = (node.channelIds || '')
101
+ .split(',')
102
+ .map(s => s.trim())
103
+ .filter(s => s.length > 0)
104
+
105
+ channels.forEach(ch => {
106
+ const id = String(ch.id)
107
+ const row = $('<div/>').addClass('empirbus-channel-row')
108
+
109
+ const checkbox = $('<input type="checkbox">')
110
+ .addClass('empirbus-channel-checkbox')
111
+ .attr('data-channel-id', id)
112
+
113
+ if (selected.indexOf(id) !== -1) {
114
+ checkbox.prop('checked', true)
115
+ }
116
+
117
+ const idLabel = $('<span/>')
118
+ .addClass('empirbus-channel-id')
119
+ .text(id)
120
+
121
+ const labelText = ch.description || ch.name || 'Channel ' + id
122
+ const label = $('<span/>')
123
+ .addClass('empirbus-channel-label')
124
+ .text(labelText)
125
+
126
+ row.append(checkbox).append(idLabel).append(label)
127
+ container.append(row)
128
+ })
129
+ })
130
+ }
131
+
132
+ $('#node-input-config').on('change', function () {
133
+ loadChannels($(this).val())
134
+ })
135
+
136
+ const initialConfig = $('#node-input-config').val()
137
+ if (initialConfig) loadChannels(initialConfig)
138
+ },
139
+
140
+ oneditsave() {
141
+ const ids = []
142
+ $('#empirbus-switch-channels input[type="checkbox"]:checked').each(function () {
143
+ ids.push($(this).attr('data-channel-id'))
144
+ })
145
+ $('#node-input-channelIds').val(ids.join(','))
146
+
147
+ const acknowledge = $('#node-input-acknowledge').is(':checked')
148
+ $('#node-input-acknowledge').val(acknowledge)
149
+ }
150
+ })
151
+ </script>
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ const garmin_empirbus_ts_1 = require("garmin-empirbus-ts");
3
+ const channelHandling_1 = require("../helpers/channelHandling");
4
+ const getRepository = async (node) => {
5
+ if (!node.configNode)
6
+ return null;
7
+ return node.configNode.getRepository();
8
+ };
9
+ const nodeInit = RED => {
10
+ function EmpirbusSwitchNodeConstructor(config) {
11
+ RED.nodes.createNode(this, config);
12
+ this.acknowledge = config.acknowledge || false;
13
+ this.configNode = RED.nodes.getNode(config.config);
14
+ this.channelId = config.channelId ? Number(config.channelId) : undefined;
15
+ this.channelName = config.channelName || undefined;
16
+ this.channelIds = config.channelIds || '';
17
+ this.channelIds = config.channelIds || '';
18
+ this.selectedChannelIds = (0, channelHandling_1.parseChannelIds)(this.channelIds);
19
+ if (this.configNode) {
20
+ this.configNode.onState((state) => {
21
+ switch (state) {
22
+ case garmin_empirbus_ts_1.EmpirBusClientState.Connected:
23
+ this.status({ fill: 'green', shape: 'dot', text: `connected` });
24
+ break;
25
+ case garmin_empirbus_ts_1.EmpirBusClientState.Error:
26
+ this.status({ fill: 'red', shape: 'dot', text: `ERROR` });
27
+ break;
28
+ case garmin_empirbus_ts_1.EmpirBusClientState.Connecting:
29
+ this.status({ fill: 'red', shape: 'ring', text: `connecting` });
30
+ break;
31
+ default:
32
+ case garmin_empirbus_ts_1.EmpirBusClientState.Closed:
33
+ this.status({ fill: 'red', shape: 'ring', text: `disconnected` });
34
+ break;
35
+ }
36
+ });
37
+ }
38
+ this.on('input', async (msg) => {
39
+ const repo = await getRepository(this);
40
+ if (!repo) {
41
+ this.error('No EmpirBus config node configured. Configure and select an EmpirBus config node first!', msg);
42
+ return;
43
+ }
44
+ const ids = await (0, channelHandling_1.resolveChannelIds)(this, msg, repo);
45
+ if (ids.length === 0) {
46
+ this.error('No matching channel found', msg);
47
+ this.send(msg);
48
+ return;
49
+ }
50
+ try {
51
+ const promises = ids.map(id => repo.switch(id, msg.payload));
52
+ const results = await Promise.all(promises);
53
+ if (results.filter(result => result.hasFailed).length === 0) {
54
+ if (this.acknowledge) {
55
+ msg.acknowledge = true;
56
+ msg.payload = {
57
+ state: {
58
+ power: msg.payload
59
+ }
60
+ };
61
+ }
62
+ this.log(`Switched channels ${ids.join(',')} ${msg.payload}, returning message ${JSON.stringify(msg)}`);
63
+ }
64
+ else {
65
+ results.filter(result => result.hasFailed).forEach(result => {
66
+ this.error(result.errors.join(', '), msg);
67
+ });
68
+ }
69
+ this.send(msg);
70
+ }
71
+ catch (error) {
72
+ this.error(error, msg);
73
+ }
74
+ });
75
+ }
76
+ RED.nodes.registerType('empirbus-switch', EmpirbusSwitchNodeConstructor);
77
+ };
78
+ module.exports = nodeInit;
79
+ //# sourceMappingURL=empirbus-switch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empirbus-switch.js","sourceRoot":"","sources":["../../src/nodes/empirbus-switch.ts"],"names":[],"mappings":";AAAA,2DAAmF;AAGnF,gEAA+E;AAa/E,MAAM,aAAa,GAAG,KAAK,EAAE,IAAiC,EAA6C,EAAE;IACzG,IAAI,CAAC,IAAI,CAAC,UAAU;QAChB,OAAO,IAAI,CAAA;IACf,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,CAAA;AAC1C,CAAC,CAAA;AAED,MAAM,QAAQ,GAAoB,GAAG,CAAC,EAAE;IACpC,SA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,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;wBACnB,GAAG,CAAC,WAAW,GAAG,IAAI,CAAA;wBACtB,GAAG,CAAC,OAAO,GAAG;4BACV,KAAK,EAAE;gCACH,KAAK,EAAE,GAAG,CAAC,OAAO;6BACrB;yBACJ,CAAA;oBACL,CAAC;oBACD,IAAI,CAAC,GAAG,CAAC,qBAAqB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,OAAO,uBAAuB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;gBAC3G,CAAC;qBACI,CAAC;oBACF,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;wBACxD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAA;oBAC7C,CAAC,CAAC,CAAA;gBACN,CAAC;gBAED,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YAClB,CAAC;YACD,OAAO,KAAK,EAAE,CAAC;gBACX,IAAI,CAAC,KAAK,CAAC,KAAc,EAAE,GAAG,CAAC,CAAA;YACnC,CAAC;QACL,CAAC,CAAC,CAAA;IACN,CAAC;IAED,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,iBAAiB,EAAE,6BAA6B,CAAC,CAAA;AAC5E,CAAC,CAAA;AAED,iBAAS,QAAQ,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { NodeInitializer } from 'node-red';
2
+ declare const nodeInit: NodeInitializer;
3
+ export = nodeInit;
@@ -0,0 +1,151 @@
1
+ <script type="text/x-red" data-template-name="empirbus-toggle">
2
+
3
+ <style>
4
+ .empirbus-row { display: flex; align-items: flex-start; gap: 8px; }
5
+ .empirbus-row input[type="text"], .empirbus-row input[type="number"] { flex: 1; width: 100%; }
6
+ .empirbus-row label { flex: 0 0 160px; max-width: 160px; white-space: nowrap; padding-top: 7px; }
7
+ .empirbus-input-wrapper { display: flex; flex-direction: column; flex: 1; }
8
+ .empirbus-input-wrapper input { flex: 1; }
9
+ .empirbus-input-wrapper input[type="checkbox"] { flex: 0 0 auto; width: auto; margin-top: 4px; align-self: flex-start; }
10
+ .empirbus-input-wrapper .help { font-size: 0.85em; opacity: 0.8; margin-top: 2px; }
11
+ .empirbus-channel-checkbox { flex: 0 0 20px; }
12
+ .empirbus-channel-id { flex: 0 0 50px; font-weight: bold; opacity: 0.8; text-align: right; display: block; padding-right: 5px; }
13
+ .empirbus-channel-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
14
+ .empirbus-channel-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
15
+ </style>
16
+
17
+ <div class="form-row empirbus-row">
18
+ <label for="node-input-name">
19
+ <i class="fa fa-tag"></i> Name
20
+ </label>
21
+ <input type="text" id="node-input-name">
22
+ </div>
23
+
24
+ <div class="form-row empirbus-row">
25
+ <label for="node-input-config">
26
+ <i class="fa fa-cog"></i> EmpirBus Config
27
+ </label>
28
+ <input type="text" id="node-input-config">
29
+ </div>
30
+
31
+ <div class="form-row empirbus-row">
32
+ <label for="node-input-channelId">
33
+ <i class="fa fa-hashtag"></i> Channel ID
34
+ </label>
35
+ <div class="empirbus-input-wrapper">
36
+ <input type="number" id="node-input-channelId" style="width: 100%;">
37
+ <span class="help">Fallback, wenn keine Checkbox gewählt und kein Name gesetzt ist</span>
38
+ </div>
39
+ </div>
40
+
41
+ <div class="form-row empirbus-row">
42
+ <label for="node-input-channelName">
43
+ <i class="fa fa-font"></i> Channel Name
44
+ </label>
45
+ <input type="text" id="node-input-channelName">
46
+ </div>
47
+
48
+ <div class="form-row empirbus-row">
49
+ <label for="node-input-acknowledge">
50
+ <i class="fa fa-check"></i> bestätigen
51
+ </label>
52
+ <div class="empirbus-input-wrapper">
53
+ <input type="checkbox" id="node-input-acknowledge">
54
+ <span class="help">Wenn der Befehl erfolgreich ist, wird acknowledge:true an das msg Objekt gehängt</span>
55
+ </div>
56
+ </div>
57
+
58
+ <div class="form-row">
59
+ <label>Kanäle</label>
60
+ <div id="empirbus-toggle-channels"></div>
61
+ <input type="hidden" id="node-input-channelIds">
62
+ <span class="help">Auswahl mehrerer Kanäle</span>
63
+ </div>
64
+
65
+ </script>
66
+
67
+ <script type="text/javascript">
68
+ /* exported oneditprepare, oneditsave */
69
+ /* global RED */
70
+ RED.nodes.registerType('empirbus-toggle', {
71
+ category: 'output',
72
+ color: '#a6bbcf',
73
+ defaults: {
74
+ name: { value: '' },
75
+ config: { value: '', type: 'empirbus-config', required: true },
76
+ channelId: { value: '', required: false },
77
+ channelName: { value: '', required: false },
78
+ channelIds: { value: '', required: false },
79
+ acknowledge: { value: false }
80
+ },
81
+ inputs: 1,
82
+ outputs: 1,
83
+ icon: 'bridge.svg',
84
+ label() {
85
+ return this.name || "EmpirBus Toggle"
86
+ },
87
+
88
+ oneditprepare() {
89
+ const node = this
90
+
91
+ $('#node-input-acknowledge')
92
+ .prop('checked', !!node.acknowledge)
93
+
94
+ const loadChannels = configId => {
95
+ if (!configId) return
96
+ const container = $('#empirbus-toggle-channels')
97
+ container.empty()
98
+
99
+ $.getJSON('empirbus/' + configId + '/channels', channels => {
100
+ const selected = (node.channelIds || '')
101
+ .split(',')
102
+ .map(s => s.trim())
103
+ .filter(s => s.length > 0)
104
+
105
+ channels.forEach(ch => {
106
+ const id = String(ch.id)
107
+ const row = $('<div/>').addClass('empirbus-channel-row')
108
+
109
+ const checkbox = $('<input type="checkbox">')
110
+ .addClass('empirbus-channel-checkbox')
111
+ .attr('data-channel-id', id)
112
+
113
+ if (selected.indexOf(id) !== -1) {
114
+ checkbox.prop('checked', true)
115
+ }
116
+
117
+ const idLabel = $('<span/>')
118
+ .addClass('empirbus-channel-id')
119
+ .text(id)
120
+
121
+ const labelText = ch.description || ch.name || 'Channel ' + id
122
+ const label = $('<span/>')
123
+ .addClass('empirbus-channel-label')
124
+ .text(labelText)
125
+
126
+ row.append(checkbox).append(idLabel).append(label)
127
+ container.append(row)
128
+ })
129
+ })
130
+ }
131
+
132
+ $('#node-input-config').on('change', function () {
133
+ loadChannels($(this).val())
134
+ })
135
+
136
+ const initialConfig = $('#node-input-config').val()
137
+ if (initialConfig) loadChannels(initialConfig)
138
+ },
139
+
140
+ oneditsave() {
141
+ const ids = []
142
+ $('#empirbus-toggle-channels input[type="checkbox"]:checked').each(function () {
143
+ ids.push($(this).attr('data-channel-id'))
144
+ })
145
+ $('#node-input-channelIds').val(ids.join(','))
146
+
147
+ const acknowledge = $('#node-input-acknowledge').is(':checked')
148
+ $('#node-input-acknowledge').val(acknowledge)
149
+ }
150
+ })
151
+ </script>
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ const channelHandling_1 = require("../helpers/channelHandling");
3
+ const getRepository = async (node) => {
4
+ if (!node.configNode)
5
+ return null;
6
+ return node.configNode.getRepository();
7
+ };
8
+ const nodeInit = RED => {
9
+ function EmpirbusToggleNodeConstructor(config) {
10
+ RED.nodes.createNode(this, config);
11
+ this.acknowledge = config.acknowledge || false;
12
+ this.configNode = RED.nodes.getNode(config.config);
13
+ this.channelId = config.channelId ? Number(config.channelId) : undefined;
14
+ this.channelName = config.channelName || undefined;
15
+ this.channelIds = config.channelIds || '';
16
+ this.channelIds = config.channelIds || '';
17
+ this.selectedChannelIds = (0, channelHandling_1.parseChannelIds)(this.channelIds);
18
+ this.on('input', async (msg) => {
19
+ const repo = await getRepository(this);
20
+ if (!repo) {
21
+ this.error('No EmpirBus config node configured. Configure and select an EmpirBus config node first!', msg);
22
+ return;
23
+ }
24
+ const ids = await (0, channelHandling_1.resolveChannelIds)(this, msg, repo);
25
+ if (ids.length === 0) {
26
+ this.error('No matching channel found', msg);
27
+ this.send(msg);
28
+ return;
29
+ }
30
+ try {
31
+ const promises = ids.map(id => repo.toggle(id));
32
+ await Promise.all(promises);
33
+ if (this.acknowledge)
34
+ msg.acknowledge = true;
35
+ this.log(`Toggled channels ${ids.join(',')}, returning message ${JSON.stringify(msg)}`);
36
+ this.send(msg);
37
+ }
38
+ catch (error) {
39
+ this.error(error, msg);
40
+ }
41
+ });
42
+ }
43
+ RED.nodes.registerType('empirbus-toggle', EmpirbusToggleNodeConstructor);
44
+ };
45
+ module.exports = nodeInit;
46
+ //# sourceMappingURL=empirbus-toggle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empirbus-toggle.js","sourceRoot":"","sources":["../../src/nodes/empirbus-toggle.ts"],"names":[],"mappings":";AAGA,gEAA+E;AAa/E,MAAM,aAAa,GAAG,KAAK,EAAE,IAAiC,EAA6C,EAAE;IACzG,IAAI,CAAC,IAAI,CAAC,UAAU;QAChB,OAAO,IAAI,CAAA;IACf,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,CAAA;AAC1C,CAAC,CAAA;AAED,MAAM,QAAQ,GAAoB,GAAG,CAAC,EAAE;IACpC,SAAS,6BAA6B,CAAoC,MAA6B;QACnG,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;QAClC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,KAAK,CAAA;QAC9C,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAA8B,CAAA;QAC/E,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;QACxE,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,SAAS,CAAA;QAClD,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAA;QACzC,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAA;QACzC,IAAI,CAAC,kBAAkB,G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AAY,CAAC,iBAAiB,EAAE,6BAA6B,CAAC,CAAA;AAC5E,CAAC,CAAA;AAED,iBAAS,QAAQ,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { EmpirBusChannelRepository } from 'garmin-empirbus-ts';
2
+ import { Node as NodeRed } from 'node-red';
3
+ export interface EmpirbusConfigNode extends NodeRed {
4
+ name: string;
5
+ url: string;
6
+ repository: EmpirBusChannelRepository | null;
7
+ getRepository: () => EmpirBusChannelRepository;
8
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=EmpirbusConfigNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmpirbusConfigNode.js","sourceRoot":"","sources":["../../src/types/EmpirbusConfigNode.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=EmpirbusToggleAndSwitchNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmpirbusToggleAndSwitchNode.js","sourceRoot":"","sources":["../../src/types/EmpirbusToggleAndSwitchNode.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=EmpirbusToggleNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmpirbusToggleNode.js","sourceRoot":"","sources":["../../src/types/EmpirbusToggleNode.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "node-red-contrib-garmin-empirbus",
3
3
  "license": "MIT",
4
- "version": "1.0.2",
4
+ "version": "1.0.4",
5
5
  "description": "Connects to Garmin Empirbus MCU or Serv7 Display to enable status and switching",
6
6
  "keywords": ["node-red"],
7
7
  "node-red": {
@@ -18,7 +18,7 @@
18
18
  "publish:registry": "node scripts/publish.mjs"
19
19
  },
20
20
  "dependencies": {
21
- "garmin-empirbus-ts": "^0.1.11"
21
+ "garmin-empirbus-ts": "^0.1.12"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^24.10.0",