@victronenergy/mfd-modules 11.1.0 → 11.1.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.
- package/dist/src/Modules/Mqtt/Mqtt.store.d.ts +2 -0
- package/dist/src/Modules/Mqtt/Mqtt.store.d.ts.map +1 -1
- package/dist/src/Modules/Mqtt/Mqtt.store.js +36 -15
- package/dist/src/Modules/Mqtt/Mqtt.store.js.map +1 -1
- package/dist/src/Modules/ShorePowerInput/ShorePowerInput.provider.d.ts +1 -0
- package/dist/src/Modules/ShorePowerInput/ShorePowerInput.provider.d.ts.map +1 -1
- package/dist/src/Modules/ShorePowerInput/ShorePowerInput.provider.js +1 -1
- package/dist/src/Modules/ShorePowerInput/ShorePowerInput.provider.js.map +1 -1
- package/dist/src/Modules/SwitchingPane/SwitchingPane.provider.d.ts +14 -0
- package/dist/src/Modules/SwitchingPane/SwitchingPane.provider.d.ts.map +1 -1
- package/dist/src/Modules/SwitchingPane/SwitchingPane.provider.js +32 -14
- package/dist/src/Modules/SwitchingPane/SwitchingPane.provider.js.map +1 -1
- package/dist/src/utils/constants.d.ts.map +1 -1
- package/dist/src/utils/constants.js.map +1 -1
- package/dist/src/utils/logger.d.ts.map +1 -1
- package/dist/src/utils/logger.js +2 -1
- package/dist/src/utils/logger.js.map +1 -1
- package/package.json +9 -3
|
@@ -13,6 +13,7 @@ export declare class MqttStore {
|
|
|
13
13
|
queueWorker: ReturnType<typeof setTimeout> | undefined;
|
|
14
14
|
meanQueueWorkerPassDuration: number;
|
|
15
15
|
urgentTopicPrefixes: string[];
|
|
16
|
+
initialLoadComplete: boolean;
|
|
16
17
|
/**
|
|
17
18
|
* Returns the current cached message for a given MQTT topic.
|
|
18
19
|
*
|
|
@@ -79,6 +80,7 @@ export declare class MqttStore {
|
|
|
79
80
|
addMessage: (topic: string, message: {
|
|
80
81
|
value: string | undefined;
|
|
81
82
|
}) => void;
|
|
83
|
+
completeInitialLoad: () => void;
|
|
82
84
|
addMessagesFromQueue: () => void;
|
|
83
85
|
scheduleNextQueueWorkerPass: (timeout: number) => void;
|
|
84
86
|
setupQueueWorker: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mqtt.store.d.ts","sourceRoot":"/","sources":["src/Modules/Mqtt/Mqtt.store.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAU,MAAM,EAAE,MAAM,SAAS,CAAA;AAQ7E,qBAAa,SAAS;IACpB,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;IAC1B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAA;IAC/B,MAAM,EAAE,MAAM,CAAoB;IAClC,QAAQ,EAAE,YAAY,CAAK;IAC3B,YAAY,EAAE,YAAY,CAAK;IAC/B,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAoB;IACjD,QAAQ,EAAE,QAAQ,CAAA;IAClB,QAAQ,EAAE,MAAM,CAA0C;IAC1D,mBAAmB,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,GAAG,SAAS,CAAA;IAC/D,WAAW,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG,SAAS,CAAA;IACtD,2BAA2B,EAAE,MAAM,CAAI;IACvC,mBAAmB,EAAE,MAAM,EAAE,CAAK;
|
|
1
|
+
{"version":3,"file":"Mqtt.store.d.ts","sourceRoot":"/","sources":["src/Modules/Mqtt/Mqtt.store.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAU,MAAM,EAAE,MAAM,SAAS,CAAA;AAQ7E,qBAAa,SAAS;IACpB,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,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AI,EACnB,OAAM,MAAyB,EAC/B,SAAQ,OAAe,EACvB,WAAW,MAAM,UAqGlB;IAED,oBAAoB,aA4BnB;IAED,uBAAuB,aAOtB;IAED,iBAAiB,aAOhB;IAED,mBAAmB,aAMlB;IAED,mBAAmB,aAMlB;IAED,OAAO,GAAI,OAAO,MAAM,EAAE,MAAM,MAAM,GAAG,MAAM,GAAG;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,UAAU,qBAAqB,UAWjG;CACF;AA6BD,wBAAgB,OAAO,cAEtB"}
|
|
@@ -81,6 +81,12 @@ export class MqttStore {
|
|
|
81
81
|
writable: true,
|
|
82
82
|
value: []
|
|
83
83
|
});
|
|
84
|
+
Object.defineProperty(this, "initialLoadComplete", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
configurable: true,
|
|
87
|
+
writable: true,
|
|
88
|
+
value: false
|
|
89
|
+
});
|
|
84
90
|
/**
|
|
85
91
|
* Returns the current cached message for a given MQTT topic.
|
|
86
92
|
*
|
|
@@ -224,7 +230,7 @@ export class MqttStore {
|
|
|
224
230
|
writable: true,
|
|
225
231
|
value: (topic, message) => {
|
|
226
232
|
// Logger.log(`DEBUG: addMessage: topic: ${topic}, urgentPrefixes: ${JSON.stringify(this.urgentTopicPrefixes)}`)
|
|
227
|
-
if (this.urgentTopicPrefixes.some((prefix) => topic.startsWith(prefix))) {
|
|
233
|
+
if (this.initialLoadComplete && this.urgentTopicPrefixes.some((prefix) => topic.startsWith(prefix))) {
|
|
228
234
|
// NOTE: If topic starts with one of the urgent prefixes, deliver it immediately
|
|
229
235
|
this.messages[topic] = message.value;
|
|
230
236
|
}
|
|
@@ -235,12 +241,22 @@ export class MqttStore {
|
|
|
235
241
|
}
|
|
236
242
|
}
|
|
237
243
|
});
|
|
244
|
+
Object.defineProperty(this, "completeInitialLoad", {
|
|
245
|
+
enumerable: true,
|
|
246
|
+
configurable: true,
|
|
247
|
+
writable: true,
|
|
248
|
+
value: () => {
|
|
249
|
+
this.addMessagesFromQueue();
|
|
250
|
+
this.initialLoadComplete = true;
|
|
251
|
+
}
|
|
252
|
+
});
|
|
238
253
|
Object.defineProperty(this, "addMessagesFromQueue", {
|
|
239
254
|
enumerable: true,
|
|
240
255
|
configurable: true,
|
|
241
256
|
writable: true,
|
|
242
257
|
value: () => {
|
|
243
|
-
|
|
258
|
+
// keys() avoids materializing all values just to check emptiness
|
|
259
|
+
if (Object.keys(this.messageQueue).length > 0) {
|
|
244
260
|
// Logger.log(`DEBUG: addMessagesFromQueue: in queue: ${JSON.stringify(Object.values(this.messageQueue).length)}`)
|
|
245
261
|
assign(this.messages, this.messageQueue);
|
|
246
262
|
// Logger.log(`DEBUG: addMessagesFromQueue: to process: ${JSON.stringify(Object.values(this.messages).length)}`)
|
|
@@ -310,8 +326,9 @@ export class MqttStore {
|
|
|
310
326
|
client.end(true);
|
|
311
327
|
this.client = undefined;
|
|
312
328
|
this.portalId = undefined;
|
|
313
|
-
this.topicsSubscribed
|
|
329
|
+
this.topicsSubscribed.clear();
|
|
314
330
|
this.urgentTopicPrefixes = [];
|
|
331
|
+
this.initialLoadComplete = false;
|
|
315
332
|
}
|
|
316
333
|
let url;
|
|
317
334
|
if (remote) {
|
|
@@ -367,24 +384,25 @@ export class MqttStore {
|
|
|
367
384
|
});
|
|
368
385
|
client.on("message", (topic, message) => {
|
|
369
386
|
// Logger.log(`DEBUG: Message received: ${topic} - ${message.toString()}`)
|
|
387
|
+
const str = message.toString();
|
|
388
|
+
if (str === "")
|
|
389
|
+
return;
|
|
390
|
+
const parsed = getMessageJson(str);
|
|
370
391
|
if (topic.endsWith("/system/0/Serial") && !this.portalId) {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
this.setPortalId(portalId);
|
|
392
|
+
if (this.portalId !== parsed.value && parsed.value !== undefined) {
|
|
393
|
+
this.setPortalId(parsed.value);
|
|
374
394
|
}
|
|
375
395
|
runInAction(() => this.subscribeToAllTopics());
|
|
376
396
|
}
|
|
377
|
-
if (topic.endsWith("full_publish_completed")) {
|
|
378
|
-
const uniqueId =
|
|
397
|
+
if (!this.initialLoadComplete && topic.endsWith("full_publish_completed")) {
|
|
398
|
+
const uniqueId = parsed["full-publish-completed-echo"] || "";
|
|
379
399
|
Logger.log(`Received full_publish_completed for ${this.portalId} with full-publish-completed-echo: '${uniqueId}'`);
|
|
380
400
|
if (uniqueId === this.uniqueId) {
|
|
381
|
-
this.
|
|
401
|
+
this.completeInitialLoad();
|
|
382
402
|
this.setupQueueWorker();
|
|
383
403
|
}
|
|
384
404
|
}
|
|
385
|
-
|
|
386
|
-
this.addMessage(topic, getMessageJson(message));
|
|
387
|
-
}
|
|
405
|
+
this.addMessage(topic, parsed);
|
|
388
406
|
});
|
|
389
407
|
Logger.log("MQTT booted");
|
|
390
408
|
}
|
|
@@ -429,10 +447,9 @@ export class MqttStore {
|
|
|
429
447
|
value: () => {
|
|
430
448
|
var _a;
|
|
431
449
|
if (this.portalId) {
|
|
432
|
-
const options = JSON.stringify({ "keepalive-options": ["suppress-republish"] });
|
|
433
450
|
const topic = `R/${this.portalId}/keepalive`;
|
|
434
|
-
Logger.log(`Sending keepalive for ${this.portalId} with ${
|
|
435
|
-
(_a = this.client) === null || _a === void 0 ? void 0 : _a.publish(topic,
|
|
451
|
+
Logger.log(`Sending keepalive for ${this.portalId} with ${SUPPRESSED_KEEPALIVE_OPTIONS}`);
|
|
452
|
+
(_a = this.client) === null || _a === void 0 ? void 0 : _a.publish(topic, SUPPRESSED_KEEPALIVE_OPTIONS);
|
|
436
453
|
}
|
|
437
454
|
}
|
|
438
455
|
});
|
|
@@ -489,6 +506,8 @@ export class MqttStore {
|
|
|
489
506
|
makeAutoObservable(this, {
|
|
490
507
|
messageQueue: false,
|
|
491
508
|
urgentTopicPrefixes: false,
|
|
509
|
+
initialLoadComplete: false,
|
|
510
|
+
completeInitialLoad: false,
|
|
492
511
|
setupKeepaliveTimer: false,
|
|
493
512
|
clearKeepaliveTimer: false,
|
|
494
513
|
sendFullKeepalive: false,
|
|
@@ -507,6 +526,7 @@ export class MqttStore {
|
|
|
507
526
|
clearSubscribedTopics() {
|
|
508
527
|
this.topicsSubscribed.clear();
|
|
509
528
|
this.urgentTopicPrefixes = [];
|
|
529
|
+
this.initialLoadComplete = false;
|
|
510
530
|
runInAction(() => {
|
|
511
531
|
this.portalId = undefined;
|
|
512
532
|
});
|
|
@@ -518,6 +538,7 @@ export class MqttStore {
|
|
|
518
538
|
this.error = error;
|
|
519
539
|
}
|
|
520
540
|
}
|
|
541
|
+
const SUPPRESSED_KEEPALIVE_OPTIONS = JSON.stringify({ "keepalive-options": ["suppress-republish"] });
|
|
521
542
|
/**
|
|
522
543
|
* Compute mean by providing existing mean, number of samples, and new sample.
|
|
523
544
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mqtt.store.js","sourceRoot":"/","sources":["src/Modules/Mqtt/Mqtt.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,MAAM,CAAA;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,OAAO,EAAuC,MAAM,EAAU,MAAM,SAAS,CAAA;AAC7E,OAAO,MAAM,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAElC,IAAI,KAAgB,CAAA;AAEpB,MAAM,OAAO,SAAS;IA+HpB;QA9HA;;;;;WAA0B;QAC1B;;;;;WAA+B;QAC/B;;;;mBAAiB,MAAM,CAAC,UAAU;WAAA;QAClC;;;;mBAAyB,EAAE;WAAA;QAC3B;;;;mBAA6B,EAAE;WAAA;QAC/B;;;;mBAAgC,IAAI,GAAG,EAAU;WAAA;Q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AAG,MAAM,CAAA;IAE1B,OAAO,MAAM,CAAA;AACf,CAAC;AAED,MAAM,UAAU,OAAO;IACrB,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,eAAe,EAAE,EAAE,EAAE,CAAC,CAAA;AAC7C,CAAC","sourcesContent":["import { comparer, makeAutoObservable, runInAction } from \"mobx\"\nimport { computedFn } from \"mobx-utils\"\nimport * as mqtt from \"mqtt\"\nimport { IClientPublishOptions, MqttClient } from \"mqtt\"\nimport { MqttMessage, MqttMessages, PortalId, STATUS, Topics } from \"../Mqtt\"\nimport Logger from \"../../utils/logger\"\nimport { getMessageJson } from \"../../utils/util\"\nimport { useMemo } from \"react\"\nimport { assign } from \"lodash-es\"\n\nlet store: MqttStore\n\nexport class MqttStore {\n client?: MqttClient | null\n error?: object | null | boolean\n status: string = STATUS.CONNECTING\n messages: MqttMessages = {}\n messageQueue: MqttMessages = {}\n topicsSubscribed: Set<string> = new Set<string>()\n portalId: PortalId\n uniqueId: string = Math.random().toString(16).substr(2, 8)\n keepAliveHandlerRef: ReturnType<typeof setInterval> | undefined\n queueWorker: ReturnType<typeof setTimeout> | undefined\n meanQueueWorkerPassDuration: number = 0\n urgentTopicPrefixes: string[] = []\n\n /**\n * Returns the current cached message for a given MQTT topic.\n *\n * React Components using this method will re-render when their specific\n * topic's message changes.\n *\n * Using comparer.identity will trigger the re-renders any time\n * a message arrives for the given topic. We rely on the fact\n * that MQTT will only re-send a message when the value changes,\n * or on a full keep alive.\n *\n * Note: Receiving the same message for a given topic will cause re-renders,\n * as we do not check structural identity of the message.\n *\n * @param topic - The MQTT topic to retrieve the message for\n * @returns The message object for the topic, or undefined if topic is not provided or not found\n */\n messageFromTopic = computedFn(\n (topic?: string) => {\n // Logger.log(`DEBUG: messageFromTopic: ${JSON.stringify(topic)}`)\n // trace()\n return topic ? this.messages[topic] : undefined\n },\n { name: \"Mqtt.store.messageFromTopic\", equals: comparer.identity }\n )\n\n /**\n * Returns the current cached messages for a given set of MQTT topics.\n *\n * This is a memoized computed function - each set of topics has its own cached value.\n *\n * React Components using this method will re-render when\n * any of the messages for specified topics change.\n *\n * Using comparer.identity will trigger the re-renders any time\n * a message arrives for any of the specified topics. We rely on the fact\n * that MQTT will only re-send a message when the value changes,\n * or on a full keep alive.\n\n * Note: Receiving the same message for a given topic will cause re-renders,\n * as we do not check structural identity of the message.\n *\n * @param topics - The MQTT topics to retrieve the messages for\n * @returns The messages objects for the given topics, or empty dictionary if topics not found\n */\n messagesByTopics = computedFn(\n (topics?: Topics) => {\n // Logger.log(`DEBUG: messagesByTopics: ${JSON.stringify(topics)}`)\n // trace()\n if (!topics) {\n return {}\n }\n\n const result: { [key: string]: MqttMessage | MqttMessage[] } = {}\n\n Object.entries(topics).forEach(([label, topic]) => {\n if (Array.isArray(topic)) {\n result[label] = topic.map((t) => this.messageFromTopic(t))\n } else if (topic === undefined) {\n result[label] = undefined\n } else {\n result[label] = this.messageFromTopic(topic)\n }\n })\n\n return result\n },\n { name: \"Mqtt.store.messagesByTopics\", equals: comparer.identity }\n )\n\n /**\n * Returns the current cached messages for MQTT topics specified via regex.\n *\n * React Components using this method will re-render when\n * values of any of the matched topics change. The components also re-render\n * when new MQTT topics are received and match needs to be checked.\n *\n * Using comparer.identity will trigger the re-renders any time\n * a message arrives for any of the matched topics. We rely on the fact\n * that MQTT will only re-send a message when the value changes,\n * or on a full keep alive.\n *\n * Note: Receiving the same message for a given topic will cause re-renders,\n * as we do not check structural identity of the message.\n *\n * @param wildcard - The MQTT wildcard to retrieve the message for\n * @returns The messages objects for the given topics, or empty dictionary if topics not found\n */\n messagesByWildcard = computedFn(\n (wildcard?: string) => {\n // Logger.log(`DEBUG: messagesByWildcard: ${JSON.stringify(wildcard)}`)\n // trace()\n if (wildcard === undefined || wildcard === \"\" || wildcard === null) return {}\n\n const topicRegex = new RegExp(wildcard.replace(/\\+/g, \"\\\\w*\")) // + in mqtt is anything -> .*\n\n return Object.fromEntries(\n Object.keys(this.messages)\n .filter((topic) => topic.match(topicRegex))\n .map((topic) => [topic, this.messages[topic]])\n // Filter out empty results\n .filter(\n ([_key, message]) =>\n message !== undefined &&\n message !== null &&\n (!Array.isArray(message) ||\n (message.length !== 0 && !message.every((v) => v === undefined || v === null)))\n )\n )\n },\n { name: \"Mqtt.store.messagesByWildcard\", equals: comparer.identity }\n )\n\n constructor() {\n makeAutoObservable(this, {\n messageQueue: false,\n urgentTopicPrefixes: false,\n setupKeepaliveTimer: false,\n clearKeepaliveTimer: false,\n sendFullKeepalive: false,\n sendSuppressedKeepalive: false,\n setupQueueWorker: false,\n removeQueueWorker: false,\n scheduleNextQueueWorkerPass: false,\n subscribeToTopic: false,\n subscribeToAllTopics: false,\n clearSubscribedTopics: false,\n })\n }\n\n get isConnected() {\n return this.status === STATUS.CONNECTED\n }\n\n subscribeToTopic = (topic?: string) => {\n if (!topic) return\n if (topic.includes(\"undefined\")) return\n\n if (!this.topicsSubscribed.has(topic)) {\n Logger.log(`Subscribing to ${topic}`)\n this.client?.subscribe(topic, (err, granted) => {\n if (err) {\n Logger.error(err)\n return\n }\n\n if (granted !== undefined && granted[0]) {\n Logger.log(`Subscribed to ${granted[0].topic} with Qos ${granted[0].qos}`)\n } else {\n Logger.log(`Subscribed to ${topic} with Qos unknown`)\n }\n })\n\n this.topicsSubscribed.add(topic)\n }\n }\n\n clearSubscribedTopics() {\n this.topicsSubscribed.clear()\n this.urgentTopicPrefixes = []\n runInAction(() => {\n this.portalId = undefined\n })\n }\n\n addMessage = (topic: string, message: { value: string | undefined }) => {\n // Logger.log(`DEBUG: addMessage: topic: ${topic}, urgentPrefixes: ${JSON.stringify(this.urgentTopicPrefixes)}`)\n if (this.urgentTopicPrefixes.some((prefix) => topic.startsWith(prefix))) {\n // NOTE: If topic starts with one of the urgent prefixes, deliver it immediately\n this.messages[topic] = message.value\n } else {\n // NOTE: Otherwise store message to the queue, and move messages from the queue\n // NOTE: to the React components that are MobX observers periodically and in batches\n this.messageQueue[topic] = message.value\n }\n }\n\n addMessagesFromQueue = () => {\n if (Object.values(this.messageQueue).length > 0) {\n // Logger.log(`DEBUG: addMessagesFromQueue: in queue: ${JSON.stringify(Object.values(this.messageQueue).length)}`)\n assign(this.messages, this.messageQueue)\n // Logger.log(`DEBUG: addMessagesFromQueue: to process: ${JSON.stringify(Object.values(this.messages).length)}`)\n this.messageQueue = {}\n }\n }\n\n scheduleNextQueueWorkerPass = (timeout: number) => {\n this.queueWorker = setTimeout(() => {\n const started = performance.now()\n this.addMessagesFromQueue()\n const ended = performance.now()\n this.meanQueueWorkerPassDuration = addToMean(this.meanQueueWorkerPassDuration, 10, ended - started)\n // Schedule next update after 1 - 3 seconds\n // depending on how fast we were able to process the incoming messages\n const newTimeout = Math.max(1000, Math.min(this.meanQueueWorkerPassDuration * 50, 3000))\n this.scheduleNextQueueWorkerPass(newTimeout)\n }, timeout)\n }\n\n setupQueueWorker = () => {\n this.removeQueueWorker()\n\n this.meanQueueWorkerPassDuration = 20 // ms\n this.scheduleNextQueueWorkerPass(1000) // ms\n }\n\n removeQueueWorker = () => {\n if (this.queueWorker) {\n clearTimeout(this.queueWorker)\n }\n this.queueWorker = undefined\n }\n\n setPortalId = (portalId: string) => {\n this.portalId = portalId\n this.urgentTopicPrefixes = [\n `N/${portalId}/switch/`,\n `N/${portalId}/system/0/SwitchableOutput`,\n `N/${portalId}/system/0/GenericInput`,\n ]\n }\n\n setStatus(status: string) {\n this.status = status\n }\n\n setError(error: object | null | boolean) {\n this.error = error\n }\n\n boot = (\n protocol: string,\n host: string = \"localhost\",\n port: number | null,\n path: string = \"websocket-mqtt\",\n remote: boolean = false,\n portalId?: string\n ) => {\n Logger.log(\"MQTT booting\")\n\n let client = this.client\n\n if (client) {\n client.end(true)\n this.client = undefined\n this.portalId = undefined\n this.topicsSubscribed = new Set<string>()\n this.urgentTopicPrefixes = []\n }\n\n let url\n if (remote) {\n if (!host) {\n return\n }\n // remote connection to VRM broker always uses MQTTS over 443\n url = `mqtts://${host}:443`\n } else {\n // local connection derives websocket protocol from web app protocol\n const wsproto = protocol === \"https:\" ? \"wss:\" : \"ws:\"\n if (port) {\n url = `${wsproto}//${host}:${port}/${path}`\n } else {\n url = `${wsproto}//${host}/${path}`\n }\n }\n\n Logger.log(`MQTT connecting to ${url}`)\n client = mqtt.connect(url, { resubscribe: false })\n\n this.client = client\n this.portalId = portalId\n\n client.on(\"error\", (error) => {\n Logger.log(\"MQTT error\")\n runInAction(() => {\n this.setError(error)\n this.setStatus(STATUS.DISCONNECTED)\n })\n this.removeQueueWorker()\n this.clearKeepaliveTimer()\n this.clearSubscribedTopics()\n })\n\n client.on(\"offline\", () => {\n Logger.log(\"MQTT offline\")\n runInAction(() => {\n this.setError(true)\n this.setStatus(STATUS.OFFLINE)\n })\n this.removeQueueWorker()\n this.clearKeepaliveTimer()\n this.clearSubscribedTopics()\n })\n\n client.on(\"connect\", () => {\n Logger.log(\"MQTT connected\")\n runInAction(() => {\n this.setError(null)\n this.setStatus(STATUS.CONNECTED)\n // Never use wildcard when connecting remotely\n this.subscribeToTopic(`N/${remote ? portalId : \"+\"}/system/0/Serial`)\n this.setupKeepaliveTimer()\n })\n })\n\n client.on(\"message\", (topic, message) => {\n // Logger.log(`DEBUG: Message received: ${topic} - ${message.toString()}`)\n\n if (topic.endsWith(\"/system/0/Serial\") && !this.portalId) {\n const portalId = getMessageJson(message).value\n\n if (this.portalId !== portalId && portalId !== undefined) {\n this.setPortalId(portalId)\n }\n\n runInAction(() => this.subscribeToAllTopics())\n }\n if (topic.endsWith(\"full_publish_completed\")) {\n const uniqueId = getMessageJson(message)[\"full-publish-completed-echo\"] || \"\"\n Logger.log(\n `Received full_publish_completed for ${this.portalId} with full-publish-completed-echo: '${uniqueId}'`\n )\n if (uniqueId === this.uniqueId) {\n this.addMessagesFromQueue()\n this.setupQueueWorker()\n }\n }\n\n if (message.toString() !== \"\") {\n this.addMessage(topic, getMessageJson(message))\n }\n })\n\n Logger.log(\"MQTT booted\")\n }\n\n subscribeToAllTopics = () => {\n const topics = [\n `N/${this.portalId}/settings/#`,\n `N/${this.portalId}/system/#`,\n `N/${this.portalId}/vebus/#`,\n `N/${this.portalId}/alternator/#`,\n `N/${this.portalId}/battery/#`,\n `N/${this.portalId}/charger/#`,\n `N/${this.portalId}/dcsource/#`,\n `N/${this.portalId}/generator/#`,\n `N/${this.portalId}/genset/#`,\n `N/${this.portalId}/dcgenset/#`,\n `N/${this.portalId}/inverter/#`,\n `N/${this.portalId}/tank/#`,\n `N/${this.portalId}/temperature/#`,\n `N/${this.portalId}/switch/#`,\n `N/${this.portalId}/full_publish_completed`,\n ]\n\n this.client?.subscribe(topics, (err) => {\n if (err) {\n Logger.error(err)\n return\n }\n\n // When we received all topics we send a full keepalive.\n this.sendFullKeepalive()\n })\n }\n\n sendSuppressedKeepalive = () => {\n if (this.portalId) {\n const options = JSON.stringify({ \"keepalive-options\": [\"suppress-republish\"] })\n const topic = `R/${this.portalId}/keepalive`\n\n Logger.log(`Sending keepalive for ${this.portalId} with ${options}`)\n this.client?.publish(topic, options)\n }\n }\n\n sendFullKeepalive = () => {\n if (this.portalId) {\n const topic = `R/${this.portalId}/keepalive`\n\n Logger.log(`Sending first keepalive for ${this.portalId} with full-publish-completed-echo: '${this.uniqueId}'`)\n this.client?.publish(topic, `{ \"keepalive-options\" : [ {\"full-publish-completed-echo\": \"${this.uniqueId}\" } ] }`)\n }\n }\n\n setupKeepaliveTimer = () => {\n this.clearKeepaliveTimer()\n\n this.keepAliveHandlerRef = setInterval(this.sendSuppressedKeepalive, 30000)\n\n this.sendFullKeepalive()\n }\n\n clearKeepaliveTimer = () => {\n const ref = this.keepAliveHandlerRef\n if (ref) {\n clearInterval(ref)\n }\n this.keepAliveHandlerRef = undefined\n }\n\n publish = (topic: string, data: string | number | { raw: string }, options?: IClientPublishOptions) => {\n if (this.status !== STATUS.CONNECTED || !this.client) {\n Logger.log(\"Could not publish value, not connected to MQTT broker\")\n return\n }\n const message =\n typeof data === \"object\" && data !== null && \"raw\" in data ? data.raw : JSON.stringify({ value: data })\n\n Logger.log(`Publishing to ${topic}: ${message}`)\n\n this.client?.publish(topic, message, options ?? {})\n }\n}\n\n/**\n * Compute mean by providing existing mean, number of samples, and new sample.\n *\n * @param {number} mean current mean\n * @param {number} n number of sampled values\n * @param {number} newValue the sample\n * @returns {number} the new mean\n *\n * @example\n * addToMean(14, 5, 53); // => 20.5\n */\nfunction addToMean(mean: number, n: number, newValue: number): number {\n return mean + (newValue - mean) / (n + 1)\n}\n\nfunction initializeStore() {\n const _store = store ?? new MqttStore()\n // For SSG and SSR always create a new store\n if (typeof window === \"undefined\") return _store\n // Create the store once in the client\n if (!store) store = _store\n\n return _store\n}\n\nexport function useMqtt() {\n return useMemo(() => initializeStore(), [])\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Mqtt.store.js","sourceRoot":"/","sources":["src/Modules/Mqtt/Mqtt.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,MAAM,CAAA;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,OAAO,EAAuC,MAAM,EAAU,MAAM,SAAS,CAAA;AAC7E,OAAO,MAAM,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAElC,IAAI,KAAgB,CAAA;AAEpB,MAAM,OAAO,SAAS;IAgIpB;QA/HA;;;;;WAA0B;QAC1B;;;;;WAA+B;QAC/B;;;;mBAAiB,MAAM,CAAC,UAAU;WAAA;QAClC;;;;mBAAyB,EAAE;WAAA;QAC3B;;;;mBAA6B,EAAE;WAAA;QAC/B;;;;mBAAgC,IAAI,GAAG,EAAU;WAAA;QACjD;;;;;WAAkB;QACl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,IAAY,EAAE,CAAS,EAAE,QAAgB;IAC1D,OAAO,IAAI,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;AAC3C,CAAC;AAED,SAAS,eAAe;IACtB,MAAM,MAAM,GAAG,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,IAAI,SAAS,EAAE,CAAA;IACvC,4CAA4C;IAC5C,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,MAAM,CAAA;IAChD,sCAAsC;IACtC,IAAI,CAAC,KAAK;QAAE,KAAK,GAAG,MAAM,CAAA;IAE1B,OAAO,MAAM,CAAA;AACf,CAAC;AAED,MAAM,UAAU,OAAO;IACrB,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,eAAe,EAAE,EAAE,EAAE,CAAC,CAAA;AAC7C,CAAC","sourcesContent":["import { comparer, makeAutoObservable, runInAction } from \"mobx\"\nimport { computedFn } from \"mobx-utils\"\nimport * as mqtt from \"mqtt\"\nimport { IClientPublishOptions, MqttClient } from \"mqtt\"\nimport { MqttMessage, MqttMessages, PortalId, STATUS, Topics } from \"../Mqtt\"\nimport Logger from \"../../utils/logger\"\nimport { getMessageJson } from \"../../utils/util\"\nimport { useMemo } from \"react\"\nimport { assign } from \"lodash-es\"\n\nlet store: MqttStore\n\nexport class MqttStore {\n client?: MqttClient | null\n error?: object | null | boolean\n status: string = STATUS.CONNECTING\n messages: MqttMessages = {}\n messageQueue: MqttMessages = {}\n topicsSubscribed: Set<string> = new Set<string>()\n portalId: PortalId\n uniqueId: string = Math.random().toString(16).substr(2, 8)\n keepAliveHandlerRef: ReturnType<typeof setInterval> | undefined\n queueWorker: ReturnType<typeof setTimeout> | undefined\n meanQueueWorkerPassDuration: number = 0\n urgentTopicPrefixes: string[] = []\n initialLoadComplete: boolean = false\n\n /**\n * Returns the current cached message for a given MQTT topic.\n *\n * React Components using this method will re-render when their specific\n * topic's message changes.\n *\n * Using comparer.identity will trigger the re-renders any time\n * a message arrives for the given topic. We rely on the fact\n * that MQTT will only re-send a message when the value changes,\n * or on a full keep alive.\n *\n * Note: Receiving the same message for a given topic will cause re-renders,\n * as we do not check structural identity of the message.\n *\n * @param topic - The MQTT topic to retrieve the message for\n * @returns The message object for the topic, or undefined if topic is not provided or not found\n */\n messageFromTopic = computedFn(\n (topic?: string) => {\n // Logger.log(`DEBUG: messageFromTopic: ${JSON.stringify(topic)}`)\n // trace()\n return topic ? this.messages[topic] : undefined\n },\n { name: \"Mqtt.store.messageFromTopic\", equals: comparer.identity }\n )\n\n /**\n * Returns the current cached messages for a given set of MQTT topics.\n *\n * This is a memoized computed function - each set of topics has its own cached value.\n *\n * React Components using this method will re-render when\n * any of the messages for specified topics change.\n *\n * Using comparer.identity will trigger the re-renders any time\n * a message arrives for any of the specified topics. We rely on the fact\n * that MQTT will only re-send a message when the value changes,\n * or on a full keep alive.\n\n * Note: Receiving the same message for a given topic will cause re-renders,\n * as we do not check structural identity of the message.\n *\n * @param topics - The MQTT topics to retrieve the messages for\n * @returns The messages objects for the given topics, or empty dictionary if topics not found\n */\n messagesByTopics = computedFn(\n (topics?: Topics) => {\n // Logger.log(`DEBUG: messagesByTopics: ${JSON.stringify(topics)}`)\n // trace()\n if (!topics) {\n return {}\n }\n\n const result: { [key: string]: MqttMessage | MqttMessage[] } = {}\n\n Object.entries(topics).forEach(([label, topic]) => {\n if (Array.isArray(topic)) {\n result[label] = topic.map((t) => this.messageFromTopic(t))\n } else if (topic === undefined) {\n result[label] = undefined\n } else {\n result[label] = this.messageFromTopic(topic)\n }\n })\n\n return result\n },\n { name: \"Mqtt.store.messagesByTopics\", equals: comparer.identity }\n )\n\n /**\n * Returns the current cached messages for MQTT topics specified via regex.\n *\n * React Components using this method will re-render when\n * values of any of the matched topics change. The components also re-render\n * when new MQTT topics are received and match needs to be checked.\n *\n * Using comparer.identity will trigger the re-renders any time\n * a message arrives for any of the matched topics. We rely on the fact\n * that MQTT will only re-send a message when the value changes,\n * or on a full keep alive.\n *\n * Note: Receiving the same message for a given topic will cause re-renders,\n * as we do not check structural identity of the message.\n *\n * @param wildcard - The MQTT wildcard to retrieve the message for\n * @returns The messages objects for the given topics, or empty dictionary if topics not found\n */\n messagesByWildcard = computedFn(\n (wildcard?: string) => {\n // Logger.log(`DEBUG: messagesByWildcard: ${JSON.stringify(wildcard)}`)\n // trace()\n if (wildcard === undefined || wildcard === \"\" || wildcard === null) return {}\n\n const topicRegex = new RegExp(wildcard.replace(/\\+/g, \"\\\\w*\")) // + in mqtt is anything -> .*\n\n return Object.fromEntries(\n Object.keys(this.messages)\n .filter((topic) => topic.match(topicRegex))\n .map((topic) => [topic, this.messages[topic]])\n // Filter out empty results\n .filter(\n ([_key, message]) =>\n message !== undefined &&\n message !== null &&\n (!Array.isArray(message) ||\n (message.length !== 0 && !message.every((v) => v === undefined || v === null)))\n )\n )\n },\n { name: \"Mqtt.store.messagesByWildcard\", equals: comparer.identity }\n )\n\n constructor() {\n makeAutoObservable(this, {\n messageQueue: false,\n urgentTopicPrefixes: false,\n initialLoadComplete: false,\n completeInitialLoad: false,\n setupKeepaliveTimer: false,\n clearKeepaliveTimer: false,\n sendFullKeepalive: false,\n sendSuppressedKeepalive: false,\n setupQueueWorker: false,\n removeQueueWorker: false,\n scheduleNextQueueWorkerPass: false,\n subscribeToTopic: false,\n subscribeToAllTopics: false,\n clearSubscribedTopics: false,\n })\n }\n\n get isConnected() {\n return this.status === STATUS.CONNECTED\n }\n\n subscribeToTopic = (topic?: string) => {\n if (!topic) return\n if (topic.includes(\"undefined\")) return\n\n if (!this.topicsSubscribed.has(topic)) {\n Logger.log(`Subscribing to ${topic}`)\n this.client?.subscribe(topic, (err, granted) => {\n if (err) {\n Logger.error(err)\n return\n }\n\n if (granted !== undefined && granted[0]) {\n Logger.log(`Subscribed to ${granted[0].topic} with Qos ${granted[0].qos}`)\n } else {\n Logger.log(`Subscribed to ${topic} with Qos unknown`)\n }\n })\n\n this.topicsSubscribed.add(topic)\n }\n }\n\n clearSubscribedTopics() {\n this.topicsSubscribed.clear()\n this.urgentTopicPrefixes = []\n this.initialLoadComplete = false\n runInAction(() => {\n this.portalId = undefined\n })\n }\n\n addMessage = (topic: string, message: { value: string | undefined }) => {\n // Logger.log(`DEBUG: addMessage: topic: ${topic}, urgentPrefixes: ${JSON.stringify(this.urgentTopicPrefixes)}`)\n if (this.initialLoadComplete && this.urgentTopicPrefixes.some((prefix) => topic.startsWith(prefix))) {\n // NOTE: If topic starts with one of the urgent prefixes, deliver it immediately\n this.messages[topic] = message.value\n } else {\n // NOTE: Otherwise store message to the queue, and move messages from the queue\n // NOTE: to the React components that are MobX observers periodically and in batches\n this.messageQueue[topic] = message.value\n }\n }\n\n completeInitialLoad = () => {\n this.addMessagesFromQueue()\n this.initialLoadComplete = true\n }\n\n addMessagesFromQueue = () => {\n // keys() avoids materializing all values just to check emptiness\n if (Object.keys(this.messageQueue).length > 0) {\n // Logger.log(`DEBUG: addMessagesFromQueue: in queue: ${JSON.stringify(Object.values(this.messageQueue).length)}`)\n assign(this.messages, this.messageQueue)\n // Logger.log(`DEBUG: addMessagesFromQueue: to process: ${JSON.stringify(Object.values(this.messages).length)}`)\n this.messageQueue = {}\n }\n }\n\n scheduleNextQueueWorkerPass = (timeout: number) => {\n this.queueWorker = setTimeout(() => {\n const started = performance.now()\n this.addMessagesFromQueue()\n const ended = performance.now()\n this.meanQueueWorkerPassDuration = addToMean(this.meanQueueWorkerPassDuration, 10, ended - started)\n // Schedule next update after 1 - 3 seconds\n // depending on how fast we were able to process the incoming messages\n const newTimeout = Math.max(1000, Math.min(this.meanQueueWorkerPassDuration * 50, 3000))\n this.scheduleNextQueueWorkerPass(newTimeout)\n }, timeout)\n }\n\n setupQueueWorker = () => {\n this.removeQueueWorker()\n\n this.meanQueueWorkerPassDuration = 20 // ms\n this.scheduleNextQueueWorkerPass(1000) // ms\n }\n\n removeQueueWorker = () => {\n if (this.queueWorker) {\n clearTimeout(this.queueWorker)\n }\n this.queueWorker = undefined\n }\n\n setPortalId = (portalId: string) => {\n this.portalId = portalId\n this.urgentTopicPrefixes = [\n `N/${portalId}/switch/`,\n `N/${portalId}/system/0/SwitchableOutput`,\n `N/${portalId}/system/0/GenericInput`,\n ]\n }\n\n setStatus(status: string) {\n this.status = status\n }\n\n setError(error: object | null | boolean) {\n this.error = error\n }\n\n boot = (\n protocol: string,\n host: string = \"localhost\",\n port: number | null,\n path: string = \"websocket-mqtt\",\n remote: boolean = false,\n portalId?: string\n ) => {\n Logger.log(\"MQTT booting\")\n\n let client = this.client\n\n if (client) {\n client.end(true)\n this.client = undefined\n this.portalId = undefined\n this.topicsSubscribed.clear()\n this.urgentTopicPrefixes = []\n this.initialLoadComplete = false\n }\n\n let url\n if (remote) {\n if (!host) {\n return\n }\n // remote connection to VRM broker always uses MQTTS over 443\n url = `mqtts://${host}:443`\n } else {\n // local connection derives websocket protocol from web app protocol\n const wsproto = protocol === \"https:\" ? \"wss:\" : \"ws:\"\n if (port) {\n url = `${wsproto}//${host}:${port}/${path}`\n } else {\n url = `${wsproto}//${host}/${path}`\n }\n }\n\n Logger.log(`MQTT connecting to ${url}`)\n client = mqtt.connect(url, { resubscribe: false })\n\n this.client = client\n this.portalId = portalId\n\n client.on(\"error\", (error) => {\n Logger.log(\"MQTT error\")\n runInAction(() => {\n this.setError(error)\n this.setStatus(STATUS.DISCONNECTED)\n })\n this.removeQueueWorker()\n this.clearKeepaliveTimer()\n this.clearSubscribedTopics()\n })\n\n client.on(\"offline\", () => {\n Logger.log(\"MQTT offline\")\n runInAction(() => {\n this.setError(true)\n this.setStatus(STATUS.OFFLINE)\n })\n this.removeQueueWorker()\n this.clearKeepaliveTimer()\n this.clearSubscribedTopics()\n })\n\n client.on(\"connect\", () => {\n Logger.log(\"MQTT connected\")\n runInAction(() => {\n this.setError(null)\n this.setStatus(STATUS.CONNECTED)\n // Never use wildcard when connecting remotely\n this.subscribeToTopic(`N/${remote ? portalId : \"+\"}/system/0/Serial`)\n this.setupKeepaliveTimer()\n })\n })\n\n client.on(\"message\", (topic, message) => {\n // Logger.log(`DEBUG: Message received: ${topic} - ${message.toString()}`)\n\n const str = message.toString()\n if (str === \"\") return\n\n const parsed = getMessageJson(str)\n\n if (topic.endsWith(\"/system/0/Serial\") && !this.portalId) {\n if (this.portalId !== parsed.value && parsed.value !== undefined) {\n this.setPortalId(parsed.value)\n }\n\n runInAction(() => this.subscribeToAllTopics())\n }\n if (!this.initialLoadComplete && topic.endsWith(\"full_publish_completed\")) {\n const uniqueId = (parsed[\"full-publish-completed-echo\"] as string) || \"\"\n Logger.log(\n `Received full_publish_completed for ${this.portalId} with full-publish-completed-echo: '${uniqueId}'`\n )\n if (uniqueId === this.uniqueId) {\n this.completeInitialLoad()\n this.setupQueueWorker()\n }\n }\n\n this.addMessage(topic, parsed)\n })\n\n Logger.log(\"MQTT booted\")\n }\n\n subscribeToAllTopics = () => {\n const topics = [\n `N/${this.portalId}/settings/#`,\n `N/${this.portalId}/system/#`,\n `N/${this.portalId}/vebus/#`,\n `N/${this.portalId}/alternator/#`,\n `N/${this.portalId}/battery/#`,\n `N/${this.portalId}/charger/#`,\n `N/${this.portalId}/dcsource/#`,\n `N/${this.portalId}/generator/#`,\n `N/${this.portalId}/genset/#`,\n `N/${this.portalId}/dcgenset/#`,\n `N/${this.portalId}/inverter/#`,\n `N/${this.portalId}/tank/#`,\n `N/${this.portalId}/temperature/#`,\n `N/${this.portalId}/switch/#`,\n `N/${this.portalId}/full_publish_completed`,\n ]\n\n this.client?.subscribe(topics, (err) => {\n if (err) {\n Logger.error(err)\n return\n }\n\n // When we received all topics we send a full keepalive.\n this.sendFullKeepalive()\n })\n }\n\n sendSuppressedKeepalive = () => {\n if (this.portalId) {\n const topic = `R/${this.portalId}/keepalive`\n\n Logger.log(`Sending keepalive for ${this.portalId} with ${SUPPRESSED_KEEPALIVE_OPTIONS}`)\n this.client?.publish(topic, SUPPRESSED_KEEPALIVE_OPTIONS)\n }\n }\n\n sendFullKeepalive = () => {\n if (this.portalId) {\n const topic = `R/${this.portalId}/keepalive`\n\n Logger.log(`Sending first keepalive for ${this.portalId} with full-publish-completed-echo: '${this.uniqueId}'`)\n this.client?.publish(topic, `{ \"keepalive-options\" : [ {\"full-publish-completed-echo\": \"${this.uniqueId}\" } ] }`)\n }\n }\n\n setupKeepaliveTimer = () => {\n this.clearKeepaliveTimer()\n\n this.keepAliveHandlerRef = setInterval(this.sendSuppressedKeepalive, 30000)\n\n this.sendFullKeepalive()\n }\n\n clearKeepaliveTimer = () => {\n const ref = this.keepAliveHandlerRef\n if (ref) {\n clearInterval(ref)\n }\n this.keepAliveHandlerRef = undefined\n }\n\n publish = (topic: string, data: string | number | { raw: string }, options?: IClientPublishOptions) => {\n if (this.status !== STATUS.CONNECTED || !this.client) {\n Logger.log(\"Could not publish value, not connected to MQTT broker\")\n return\n }\n const message =\n typeof data === \"object\" && data !== null && \"raw\" in data ? data.raw : JSON.stringify({ value: data })\n\n Logger.log(`Publishing to ${topic}: ${message}`)\n\n this.client?.publish(topic, message, options ?? {})\n }\n}\n\nconst SUPPRESSED_KEEPALIVE_OPTIONS = JSON.stringify({ \"keepalive-options\": [\"suppress-republish\"] })\n\n/**\n * Compute mean by providing existing mean, number of samples, and new sample.\n *\n * @param {number} mean current mean\n * @param {number} n number of sampled values\n * @param {number} newValue the sample\n * @returns {number} the new mean\n *\n * @example\n * addToMean(14, 5, 53); // => 20.5\n */\nfunction addToMean(mean: number, n: number, newValue: number): number {\n return mean + (newValue - mean) / (n + 1)\n}\n\nfunction initializeStore() {\n const _store = store ?? new MqttStore()\n // For SSG and SSR always create a new store\n if (typeof window === \"undefined\") return _store\n // Create the store once in the client\n if (!store) store = _store\n\n return _store\n}\n\nexport function useMqtt() {\n return useMemo(() => initializeStore(), [])\n}\n"]}
|
|
@@ -2,5 +2,6 @@ export type ShorePowerInputId = number | null | undefined;
|
|
|
2
2
|
export interface ShorePowerInputState {
|
|
3
3
|
inputId: ShorePowerInputId;
|
|
4
4
|
}
|
|
5
|
+
export declare function deriveInputId(acInput1: unknown, acInput2: unknown): ShorePowerInputId;
|
|
5
6
|
export declare function useShorePowerInput(): ShorePowerInputState;
|
|
6
7
|
//# sourceMappingURL=ShorePowerInput.provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShorePowerInput.provider.d.ts","sourceRoot":"/","sources":["src/Modules/ShorePowerInput/ShorePowerInput.provider.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;AAEzD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,iBAAiB,CAAA;CAC3B;
|
|
1
|
+
{"version":3,"file":"ShorePowerInput.provider.d.ts","sourceRoot":"/","sources":["src/Modules/ShorePowerInput/ShorePowerInput.provider.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;AAEzD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,iBAAiB,CAAA;CAC3B;AAOD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,iBAAiB,CAcrF;AAED,wBAAgB,kBAAkB,IAAI,oBAAoB,CAczD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
2
|
import { useMqtt, useTopicsState } from "../Mqtt";
|
|
3
3
|
import { AC_SOURCE_TYPE } from "../../utils/constants";
|
|
4
|
-
function deriveInputId(acInput1, acInput2) {
|
|
4
|
+
export function deriveInputId(acInput1, acInput2) {
|
|
5
5
|
if (acInput1 && (Number(acInput1) === AC_SOURCE_TYPE.SHORE || Number(acInput1) === AC_SOURCE_TYPE.GRID)) {
|
|
6
6
|
return 1;
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShorePowerInput.provider.js","sourceRoot":"/","sources":["src/Modules/ShorePowerInput/ShorePowerInput.provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAU,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAYtD,
|
|
1
|
+
{"version":3,"file":"ShorePowerInput.provider.js","sourceRoot":"/","sources":["src/Modules/ShorePowerInput/ShorePowerInput.provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAU,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAYtD,MAAM,UAAU,aAAa,CAAC,QAAiB,EAAE,QAAiB;IAChE,IAAI,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,cAAc,CAAC,KAAK,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;QACxG,OAAO,CAAC,CAAA;IACV,CAAC;IACD,IAAI,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,cAAc,CAAC,KAAK,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;QACxG,OAAO,CAAC,CAAA;IACV,CAAC;IACD,IAAI,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,cAAc,CAAC,UAAU,EAAE,CAAC;QAC/D,OAAO,CAAC,CAAA;IACV,CAAC;IACD,IAAI,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,cAAc,CAAC,UAAU,EAAE,CAAC;QAC/D,OAAO,CAAC,CAAA;IACV,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,MAAM,IAAI,GAAG,OAAO,EAAE,CAAA;IAEtB,MAAM,MAAM,GAAG,OAAO,CACpB,GAA0B,EAAE,CAAC,CAAC;QAC5B,QAAQ,EAAE,KAAK,IAAI,CAAC,QAAQ,2CAA2C;QACvE,QAAQ,EAAE,KAAK,IAAI,CAAC,QAAQ,2CAA2C;KACxE,CAAC,EACF,CAAC,IAAI,CAAC,QAAQ,CAAC,CAChB,CAAA;IAED,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,cAAc,CAA2C,MAAM,CAAC,CAAA;IAE/F,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAA;AACvD,CAAC","sourcesContent":["import { useMemo } from \"react\"\nimport { Topics, useMqtt, useTopicsState } from \"../Mqtt\"\nimport { AC_SOURCE_TYPE } from \"../../utils/constants\"\nexport type ShorePowerInputId = number | null | undefined\n\nexport interface ShorePowerInputState {\n inputId: ShorePowerInputId\n}\n\ninterface ShorePowerInputTopics extends Topics {\n acInput1?: string\n acInput2?: string\n}\n\nexport function deriveInputId(acInput1: unknown, acInput2: unknown): ShorePowerInputId {\n if (acInput1 && (Number(acInput1) === AC_SOURCE_TYPE.SHORE || Number(acInput1) === AC_SOURCE_TYPE.GRID)) {\n return 1\n }\n if (acInput2 && (Number(acInput2) === AC_SOURCE_TYPE.SHORE || Number(acInput2) === AC_SOURCE_TYPE.GRID)) {\n return 2\n }\n if (acInput1 && Number(acInput1) !== AC_SOURCE_TYPE.NOT_IN_USE) {\n return 1\n }\n if (acInput2 && Number(acInput2) !== AC_SOURCE_TYPE.NOT_IN_USE) {\n return 2\n }\n return undefined\n}\n\nexport function useShorePowerInput(): ShorePowerInputState {\n const mqtt = useMqtt()\n\n const topics = useMemo(\n (): ShorePowerInputTopics => ({\n acInput1: `N/${mqtt.portalId}/settings/0/Settings/SystemSetup/AcInput1`,\n acInput2: `N/${mqtt.portalId}/settings/0/Settings/SystemSetup/AcInput2`,\n }),\n [mqtt.portalId]\n )\n\n const { acInput1, acInput2 } = useTopicsState<{ acInput1: unknown; acInput2: unknown }>(topics)\n\n return { inputId: deriveInputId(acInput1, acInput2) }\n}\n"]}
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
+
import { SwitchingDeviceInstanceId } from "./SwitchingDevice.provider";
|
|
2
|
+
import { SwitchableOutputId } from "./SwitchableOutput.provider";
|
|
3
|
+
import { GenericInputId } from "./GenericInput.provider";
|
|
1
4
|
export declare const useSwitchingPane: (gxDeviceRelaysGroupName: string) => import("./SwitchingPane.store").SwitchingPaneStore;
|
|
5
|
+
export declare function extractSwitchableOutputInfo(topic: string): {
|
|
6
|
+
tree: "system" | "switch";
|
|
7
|
+
deviceId: SwitchingDeviceInstanceId;
|
|
8
|
+
outputId: SwitchableOutputId;
|
|
9
|
+
};
|
|
10
|
+
export declare function extractGenericInputInfo(topic: string): {
|
|
11
|
+
tree: "system" | "switch";
|
|
12
|
+
deviceId: SwitchingDeviceInstanceId;
|
|
13
|
+
inputId: GenericInputId;
|
|
14
|
+
};
|
|
15
|
+
export declare function arraysEqual<T>(a: T[], b: T[]): boolean;
|
|
2
16
|
//# sourceMappingURL=SwitchingPane.provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwitchingPane.provider.d.ts","sourceRoot":"/","sources":["src/Modules/SwitchingPane/SwitchingPane.provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SwitchingPane.provider.d.ts","sourceRoot":"/","sources":["src/Modules/SwitchingPane/SwitchingPane.provider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAiC,yBAAyB,EAAE,MAAM,4BAA4B,CAAA;AACrG,OAAO,EAIL,kBAAkB,EAKnB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAA8B,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAKpF,eAAO,MAAM,gBAAgB,GAAI,yBAAyB,MAAM,uDAyT/D,CAAA;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM;;cAQ8B,yBAAyB;cACjC,kBAAkB;EAEhG;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM;;cAQ0B,yBAAyB;aAC5B,cAAc;EAEzF;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,OAAO,CAGtD"}
|
|
@@ -90,77 +90,95 @@ export const useSwitchingPane = (gxDeviceRelaysGroupName) => {
|
|
|
90
90
|
const groupAssignmentsChanged = !arraysEqual(oldAssignments, newAssignments);
|
|
91
91
|
if (groupAssignmentsChanged) {
|
|
92
92
|
switchingPaneStore.setCustomGroupAssignments(newAssignments);
|
|
93
|
-
Logger.log(`Switchable outputs group assignments changed, recomputing...`);
|
|
94
93
|
}
|
|
95
94
|
const oldOutputTypes = switchingPaneStore.outputTypes;
|
|
96
95
|
const newOutputTypes = availableSwitchableOutputTypes;
|
|
97
96
|
const outputTypesChanged = !arraysEqual(oldOutputTypes, newOutputTypes);
|
|
98
97
|
if (outputTypesChanged) {
|
|
99
98
|
switchingPaneStore.setOutputTypes(newOutputTypes);
|
|
100
|
-
Logger.log(`Switchable outputs types changed, recomputing...`);
|
|
101
99
|
}
|
|
102
100
|
const oldOutputNames = switchingPaneStore.outputNames;
|
|
103
101
|
const newOutputNames = availableSwitchableOutputNames;
|
|
104
102
|
const outputNamesChanged = !arraysEqual(oldOutputNames, newOutputNames);
|
|
105
103
|
if (outputNamesChanged) {
|
|
106
104
|
switchingPaneStore.setOutputNames(newOutputNames);
|
|
107
|
-
Logger.log(`Switchable outputs names changed, recomputing...`);
|
|
108
105
|
}
|
|
109
106
|
const oldOutputVisibilityFlags = switchingPaneStore.outputVisibilityFlags;
|
|
110
107
|
const newOutputVisibilityFlags = availableSwitchableOutputVisibilityFlags;
|
|
111
108
|
const outputVisibilityFlagsChanged = !arraysEqual(oldOutputVisibilityFlags, newOutputVisibilityFlags);
|
|
112
109
|
if (outputVisibilityFlagsChanged) {
|
|
113
110
|
switchingPaneStore.setOutputVisibilityFlags(newOutputVisibilityFlags);
|
|
114
|
-
Logger.log(`Switchable outputs visibility flags changed, recomputing...`);
|
|
115
111
|
}
|
|
116
112
|
const oldOutputFunctions = switchingPaneStore.outputFunctions;
|
|
117
113
|
const newOutputFunctions = availableSwitchableOutputFunctions;
|
|
118
114
|
const outputFunctionsChanged = !arraysEqual(oldOutputFunctions, newOutputFunctions);
|
|
119
115
|
if (outputFunctionsChanged) {
|
|
120
116
|
switchingPaneStore.setOutputFunctions(newOutputFunctions);
|
|
121
|
-
Logger.log(`Switchable outputs functions changed, recomputing...`);
|
|
122
117
|
}
|
|
123
118
|
const oldSwitchingDevices = switchingPaneStore.switchingDevices;
|
|
124
119
|
const newSwitchingDevices = availableSwitchingDevices;
|
|
125
120
|
const switchingDevicesChanged = !arraysEqual(oldSwitchingDevices, newSwitchingDevices);
|
|
126
121
|
if (switchingDevicesChanged) {
|
|
127
122
|
switchingPaneStore.setSwitchingDevices(newSwitchingDevices);
|
|
128
|
-
Logger.log(`Switching devices changed, recomputing...`);
|
|
129
123
|
}
|
|
130
124
|
const oldSwitchingDeviceNames = switchingPaneStore.switchingDeviceNames;
|
|
131
125
|
const newSwitchingDeviceNames = availableSwitchingDeviceNames;
|
|
132
126
|
const switchingDeviceNamesChanged = !arraysEqual(oldSwitchingDeviceNames, newSwitchingDeviceNames);
|
|
133
127
|
if (switchingDeviceNamesChanged) {
|
|
134
128
|
switchingPaneStore.setSwitchingDeviceNames(newSwitchingDeviceNames);
|
|
135
|
-
Logger.log(`Switching device names changed, recomputing...`);
|
|
136
129
|
}
|
|
137
130
|
const oldGiAssignments = switchingPaneStore.genericInputGroupAssignments;
|
|
138
131
|
const newGiAssignments = genericInputGroupAssignments;
|
|
139
132
|
const giGroupAssignmentsChanged = !arraysEqual(oldGiAssignments, newGiAssignments);
|
|
140
133
|
if (giGroupAssignmentsChanged) {
|
|
141
134
|
switchingPaneStore.setGenericInputGroupAssignments(newGiAssignments);
|
|
142
|
-
Logger.log(`Generic input group assignments changed, recomputing...`);
|
|
143
135
|
}
|
|
144
136
|
const oldGiTypes = switchingPaneStore.genericInputTypes;
|
|
145
137
|
const newGiTypes = availableGenericInputTypes;
|
|
146
138
|
const giTypesChanged = !arraysEqual(oldGiTypes, newGiTypes);
|
|
147
139
|
if (giTypesChanged) {
|
|
148
140
|
switchingPaneStore.setGenericInputTypes(newGiTypes);
|
|
149
|
-
Logger.log(`Generic input types changed, recomputing...`);
|
|
150
141
|
}
|
|
151
142
|
const oldGiNames = switchingPaneStore.genericInputNames;
|
|
152
143
|
const newGiNames = availableGenericInputNames;
|
|
153
144
|
const giNamesChanged = !arraysEqual(oldGiNames, newGiNames);
|
|
154
145
|
if (giNamesChanged) {
|
|
155
146
|
switchingPaneStore.setGenericInputNames(newGiNames);
|
|
156
|
-
Logger.log(`Generic input names changed, recomputing...`);
|
|
157
147
|
}
|
|
158
148
|
const oldGiVisibilityFlags = switchingPaneStore.genericInputVisibilityFlags;
|
|
159
149
|
const newGiVisibilityFlags = availableGenericInputVisibilityFlags;
|
|
160
150
|
const giVisibilityFlagsChanged = !arraysEqual(oldGiVisibilityFlags, newGiVisibilityFlags);
|
|
161
151
|
if (giVisibilityFlagsChanged) {
|
|
162
152
|
switchingPaneStore.setGenericInputVisibilityFlags(newGiVisibilityFlags);
|
|
163
|
-
|
|
153
|
+
}
|
|
154
|
+
// On initial population (all old arrays empty), skip per-field logging
|
|
155
|
+
const isInitialLoad = oldAssignments.length === 0 &&
|
|
156
|
+
oldOutputTypes.length === 0 &&
|
|
157
|
+
oldSwitchingDevices.length === 0 &&
|
|
158
|
+
oldGiAssignments.length === 0;
|
|
159
|
+
if (!isInitialLoad) {
|
|
160
|
+
if (groupAssignmentsChanged)
|
|
161
|
+
Logger.log(`Switchable outputs group assignments changed, recomputing...`);
|
|
162
|
+
if (outputTypesChanged)
|
|
163
|
+
Logger.log(`Switchable outputs types changed, recomputing...`);
|
|
164
|
+
if (outputNamesChanged)
|
|
165
|
+
Logger.log(`Switchable outputs names changed, recomputing...`);
|
|
166
|
+
if (outputVisibilityFlagsChanged)
|
|
167
|
+
Logger.log(`Switchable outputs visibility flags changed, recomputing...`);
|
|
168
|
+
if (outputFunctionsChanged)
|
|
169
|
+
Logger.log(`Switchable outputs functions changed, recomputing...`);
|
|
170
|
+
if (switchingDevicesChanged)
|
|
171
|
+
Logger.log(`Switching devices changed, recomputing...`);
|
|
172
|
+
if (switchingDeviceNamesChanged)
|
|
173
|
+
Logger.log(`Switching device names changed, recomputing...`);
|
|
174
|
+
if (giGroupAssignmentsChanged)
|
|
175
|
+
Logger.log(`Generic input group assignments changed, recomputing...`);
|
|
176
|
+
if (giTypesChanged)
|
|
177
|
+
Logger.log(`Generic input types changed, recomputing...`);
|
|
178
|
+
if (giNamesChanged)
|
|
179
|
+
Logger.log(`Generic input names changed, recomputing...`);
|
|
180
|
+
if (giVisibilityFlagsChanged)
|
|
181
|
+
Logger.log(`Generic input visibility flags changed, recomputing...`);
|
|
164
182
|
}
|
|
165
183
|
if (groupAssignmentsChanged ||
|
|
166
184
|
outputTypesChanged ||
|
|
@@ -242,7 +260,7 @@ export const useSwitchingPane = (gxDeviceRelaysGroupName) => {
|
|
|
242
260
|
]);
|
|
243
261
|
return switchingPaneStore;
|
|
244
262
|
};
|
|
245
|
-
function extractSwitchableOutputInfo(topic) {
|
|
263
|
+
export function extractSwitchableOutputInfo(topic) {
|
|
246
264
|
var _a;
|
|
247
265
|
const pattern = new RegExp(`/(${SWITCHABLE_OUTPUT_TREES.join("|")})/`);
|
|
248
266
|
const match = topic.match(pattern);
|
|
@@ -254,7 +272,7 @@ function extractSwitchableOutputInfo(topic) {
|
|
|
254
272
|
outputId: topic.substring(outputStart, topic.indexOf("/", outputStart)),
|
|
255
273
|
};
|
|
256
274
|
}
|
|
257
|
-
function extractGenericInputInfo(topic) {
|
|
275
|
+
export function extractGenericInputInfo(topic) {
|
|
258
276
|
var _a;
|
|
259
277
|
const pattern = new RegExp(`/(${SWITCHABLE_OUTPUT_TREES.join("|")})/`);
|
|
260
278
|
const match = topic.match(pattern);
|
|
@@ -266,7 +284,7 @@ function extractGenericInputInfo(topic) {
|
|
|
266
284
|
inputId: topic.substring(inputStart, topic.indexOf("/", inputStart)),
|
|
267
285
|
};
|
|
268
286
|
}
|
|
269
|
-
function arraysEqual(a, b) {
|
|
287
|
+
export function arraysEqual(a, b) {
|
|
270
288
|
if (a.length !== b.length)
|
|
271
289
|
return false;
|
|
272
290
|
return a.every((element, index) => b[index] === element);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwitchingPane.provider.js","sourceRoot":"/","sources":["src/Modules/SwitchingPane/SwitchingPane.provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAC9B,OAAO,MAAM,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAY,OAAO,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,EAAE,6BAA6B,EAA6B,MAAM,4BAA4B,CAAA;AACrG,OAAO,EACL,kCAAkC,EAClC,8BAA8B,EAC9B,uBAAuB,GAMxB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,0BAA0B,EAAkB,MAAM,yBAAyB,CAAA;AACpF,OAAO,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAA;AAEvH,MAAM,WAAW,GAAG,CAAC,QAA4C,EAAE,EAAE,CAAC,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;AAElH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,uBAA+B,EAAE,EAAE;IAClE,M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\"\nimport { useMemo, useEffect } from \"react\"\nimport { useSwitchingPaneStore } from \"./SwitchingPane.store\"\nimport { getSwitchingDeviceStateTopics, SwitchingDeviceInstanceId } from \"./SwitchingDevice.provider\"\nimport {\n getSwitchingPaneItemNameForDisplay,\n getSwitchableOutputStateTopics,\n SWITCHABLE_OUTPUT_TREES,\n SwitchableOutputId,\n SwitchableOutputState,\n SwitchableOutputTree,\n GenericInputState,\n SwitchingPaneItem,\n} from \"./SwitchableOutput.provider\"\nimport { getGenericInputStateTopics, GenericInputId } from \"./GenericInput.provider\"\nimport { remapGenericInputType, SWITCHABLE_OUTPUT_FUNCTION, SWITCHABLE_OUTPUT_VISIBILITY } from \"../../utils/constants\"\n\nconst hasMessages = (messages: Record<string, string> | undefined) => messages && Object.keys(messages).length > 0\n\nexport const useSwitchingPane = (gxDeviceRelaysGroupName: string) => {\n const switchingPaneStore = useSwitchingPaneStore()\n\n const getTopics = (portalId: PortalId) => ({\n switchableOutputs: `N/${portalId}/(${SWITCHABLE_OUTPUT_TREES.join(\"|\")})/+/SwitchableOutput/+/Settings/+`,\n genericInputs: `N/${portalId}/(${SWITCHABLE_OUTPUT_TREES.join(\"|\")})/+/GenericInput/+/Settings/+`,\n switchingDevices: `N/${portalId}/switch/+`,\n })\n\n const mqtt = useMqtt()\n const topics = useMemo(() => getTopics(mqtt.portalId), [mqtt.portalId])\n\n const messagesForSwitchableOutputs = mqtt.messagesByWildcard(topics.switchableOutputs)\n const messagesForGenericInputs = mqtt.messagesByWildcard(topics.genericInputs)\n const messagesForSwitchingDevices = mqtt.messagesByWildcard(topics.switchingDevices)\n\n // Examine MQTT to find all available switchable outputs, generic inputs, and their group assignments\n useEffect(() => {\n if (!hasMessages(messagesForSwitchableOutputs) && !hasMessages(messagesForGenericInputs)) {\n Logger.log(\"Waiting for switchable outputs or generic inputs...\")\n return\n }\n\n // All switchable outputs in array sorted by topic\n const availableSwitchableOutputs = messagesForSwitchableOutputs\n ? (Object.keys(messagesForSwitchableOutputs)\n .filter((key) => key.endsWith(\"/Settings/Group\"))\n .sort() as string[])\n : []\n\n // All switchable outputs group assignments in array sorted by topic\n const customGroupAssigments = availableSwitchableOutputs.map((topic) => {\n return messagesForSwitchableOutputs[topic]\n })\n // All switchable outputs types in array sorted by topic\n const availableSwitchableOutputTypes = availableSwitchableOutputs.map((topic) => {\n return messagesForSwitchableOutputs[`${topic.slice(0, -\"/Group\".length)}/Type`]\n })\n // All switchable outputs names in array sorted by topic\n const availableSwitchableOutputNames = availableSwitchableOutputs.map((topic) => {\n return messagesForSwitchableOutputs[`${topic.slice(0, -\"/Group\".length)}/CustomName`]\n })\n // All switchable outputs visibility in array sorted by topic\n const availableSwitchableOutputVisibilityFlags = availableSwitchableOutputs.map((topic) => {\n return messagesForSwitchableOutputs[`${topic.slice(0, -\"/Group\".length)}/ShowUIControl`]\n })\n // All switchable outputs functions in array sorted by topic\n const availableSwitchableOutputFunctions = availableSwitchableOutputs.map((topic) => {\n return messagesForSwitchableOutputs[`${topic.slice(0, -\"/Group\".length)}/Function`]\n })\n\n // All generic inputs in array sorted by topic\n const availableGenericInputs = messagesForGenericInputs\n ? (Object.keys(messagesForGenericInputs)\n .filter((key) => key.endsWith(\"/Settings/Group\"))\n .sort() as string[])\n : []\n\n // All generic input group assignments in array sorted by topic\n const genericInputGroupAssignments = availableGenericInputs.map((topic) => {\n return messagesForGenericInputs[topic]\n })\n // All generic input types in array sorted by topic\n const availableGenericInputTypes = availableGenericInputs.map((topic) => {\n return messagesForGenericInputs[`${topic.slice(0, -\"/Group\".length)}/Type`]\n })\n // All generic input names in array sorted by topic\n const availableGenericInputNames = availableGenericInputs.map((topic) => {\n return messagesForGenericInputs[`${topic.slice(0, -\"/Group\".length)}/CustomName`]\n })\n // All generic input visibility in array sorted by topic\n const availableGenericInputVisibilityFlags = availableGenericInputs.map((topic) => {\n return messagesForGenericInputs[`${topic.slice(0, -\"/Group\".length)}/ShowUIInput`]\n })\n\n // All switching devices in array sorted by instance number\n const availableSwitchingDevices = Object.keys(messagesForSwitchingDevices)\n .filter((key) => key.endsWith(\"/DeviceInstance\"))\n .sort() as string[]\n\n // All switching device names in array sorted by instance number\n const availableSwitchingDeviceNames = availableSwitchingDevices.map((topic) => {\n const topicPrefix = topic.slice(0, -\"/DeviceInstance\".length)\n return (\n messagesForSwitchingDevices[`${topicPrefix}/CustomName`] ||\n messagesForSwitchingDevices[`${topicPrefix}/ProductName`]\n )\n })\n\n const dispose = autorun(() => {\n const oldAssignments = switchingPaneStore.customGroupAssignments\n const newAssignments = customGroupAssigments\n const groupAssignmentsChanged = !arraysEqual(oldAssignments, newAssignments)\n if (groupAssignmentsChanged) {\n switchingPaneStore.setCustomGroupAssignments(newAssignments)\n Logger.log(`Switchable outputs group assignments changed, recomputing...`)\n }\n\n const oldOutputTypes = switchingPaneStore.outputTypes\n const newOutputTypes = availableSwitchableOutputTypes\n const outputTypesChanged = !arraysEqual(oldOutputTypes, newOutputTypes)\n if (outputTypesChanged) {\n switchingPaneStore.setOutputTypes(newOutputTypes)\n Logger.log(`Switchable outputs types changed, recomputing...`)\n }\n\n const oldOutputNames = switchingPaneStore.outputNames\n const newOutputNames = availableSwitchableOutputNames\n const outputNamesChanged = !arraysEqual(oldOutputNames, newOutputNames)\n if (outputNamesChanged) {\n switchingPaneStore.setOutputNames(newOutputNames)\n Logger.log(`Switchable outputs names changed, recomputing...`)\n }\n\n const oldOutputVisibilityFlags = switchingPaneStore.outputVisibilityFlags\n const newOutputVisibilityFlags = availableSwitchableOutputVisibilityFlags\n const outputVisibilityFlagsChanged = !arraysEqual(oldOutputVisibilityFlags, newOutputVisibilityFlags)\n if (outputVisibilityFlagsChanged) {\n switchingPaneStore.setOutputVisibilityFlags(newOutputVisibilityFlags)\n Logger.log(`Switchable outputs visibility flags changed, recomputing...`)\n }\n\n const oldOutputFunctions = switchingPaneStore.outputFunctions\n const newOutputFunctions = availableSwitchableOutputFunctions\n const outputFunctionsChanged = !arraysEqual(oldOutputFunctions, newOutputFunctions)\n if (outputFunctionsChanged) {\n switchingPaneStore.setOutputFunctions(newOutputFunctions)\n Logger.log(`Switchable outputs functions changed, recomputing...`)\n }\n\n const oldSwitchingDevices = switchingPaneStore.switchingDevices\n const newSwitchingDevices = availableSwitchingDevices\n const switchingDevicesChanged = !arraysEqual(oldSwitchingDevices, newSwitchingDevices)\n if (switchingDevicesChanged) {\n switchingPaneStore.setSwitchingDevices(newSwitchingDevices)\n Logger.log(`Switching devices changed, recomputing...`)\n }\n\n const oldSwitchingDeviceNames = switchingPaneStore.switchingDeviceNames\n const newSwitchingDeviceNames = availableSwitchingDeviceNames\n const switchingDeviceNamesChanged = !arraysEqual(oldSwitchingDeviceNames, newSwitchingDeviceNames)\n if (switchingDeviceNamesChanged) {\n switchingPaneStore.setSwitchingDeviceNames(newSwitchingDeviceNames)\n Logger.log(`Switching device names changed, recomputing...`)\n }\n\n const oldGiAssignments = switchingPaneStore.genericInputGroupAssignments\n const newGiAssignments = genericInputGroupAssignments\n const giGroupAssignmentsChanged = !arraysEqual(oldGiAssignments, newGiAssignments)\n if (giGroupAssignmentsChanged) {\n switchingPaneStore.setGenericInputGroupAssignments(newGiAssignments)\n Logger.log(`Generic input group assignments changed, recomputing...`)\n }\n\n const oldGiTypes = switchingPaneStore.genericInputTypes\n const newGiTypes = availableGenericInputTypes\n const giTypesChanged = !arraysEqual(oldGiTypes, newGiTypes)\n if (giTypesChanged) {\n switchingPaneStore.setGenericInputTypes(newGiTypes)\n Logger.log(`Generic input types changed, recomputing...`)\n }\n\n const oldGiNames = switchingPaneStore.genericInputNames\n const newGiNames = availableGenericInputNames\n const giNamesChanged = !arraysEqual(oldGiNames, newGiNames)\n if (giNamesChanged) {\n switchingPaneStore.setGenericInputNames(newGiNames)\n Logger.log(`Generic input names changed, recomputing...`)\n }\n\n const oldGiVisibilityFlags = switchingPaneStore.genericInputVisibilityFlags\n const newGiVisibilityFlags = availableGenericInputVisibilityFlags\n const giVisibilityFlagsChanged = !arraysEqual(oldGiVisibilityFlags, newGiVisibilityFlags)\n if (giVisibilityFlagsChanged) {\n switchingPaneStore.setGenericInputVisibilityFlags(newGiVisibilityFlags)\n Logger.log(`Generic input visibility flags changed, recomputing...`)\n }\n\n if (\n groupAssignmentsChanged ||\n outputTypesChanged ||\n outputNamesChanged ||\n outputVisibilityFlagsChanged ||\n outputFunctionsChanged ||\n switchingDevicesChanged ||\n switchingDeviceNamesChanged ||\n giGroupAssignmentsChanged ||\n giTypesChanged ||\n giNamesChanged ||\n giVisibilityFlagsChanged\n ) {\n // Collect all switching pane items (switchable outputs + generic inputs) with their group info\n const items: { groupName: string; item: SwitchingPaneItem }[] = []\n\n availableSwitchableOutputs.forEach((output, index) => {\n const swo = extractSwitchableOutputInfo(output)\n const switchingDevice = mqtt.messagesByTopics(\n getSwitchingDeviceStateTopics(mqtt.portalId, swo.tree, swo.deviceId)\n )\n const customGroupAssignment = customGroupAssigments[index].trim()\n const deviceName = switchingDevice.customName || switchingDevice.productName || gxDeviceRelaysGroupName\n const groupName = customGroupAssignment === \"\" ? deviceName : customGroupAssignment\n const switchableOutput = mqtt.messagesByTopics(\n getSwitchableOutputStateTopics(mqtt.portalId, swo.tree, swo.deviceId, swo.outputId)\n ) as unknown as SwitchableOutputState\n\n if (\n !(\n switchableOutput.showUIControl & SWITCHABLE_OUTPUT_VISIBILITY.VISIBLE ||\n switchableOutput.showUIControl & SWITCHABLE_OUTPUT_VISIBILITY.VISIBLE_LOCAL_UI\n )\n ) {\n return\n }\n\n // GX system relays: only show when Function is Manual (matching gui-v2)\n if (\n swo.tree === \"system\" &&\n switchableOutput.function != null &&\n switchableOutput.function !== SWITCHABLE_OUTPUT_FUNCTION.MANUAL\n ) {\n return\n }\n\n items.push({\n groupName,\n item: {\n ...switchableOutput,\n kind: \"switchableOutput\",\n tree: swo.tree,\n deviceId: swo.deviceId,\n outputId: swo.outputId,\n parentDeviceName: deviceName as string,\n },\n })\n })\n\n availableGenericInputs.forEach((input, index) => {\n const gi = extractGenericInputInfo(input)\n const switchingDevice = mqtt.messagesByTopics(\n getSwitchingDeviceStateTopics(mqtt.portalId, gi.tree, gi.deviceId)\n )\n const customGroupAssignment = genericInputGroupAssignments[index].trim()\n const deviceName = switchingDevice.customName || switchingDevice.productName || gxDeviceRelaysGroupName\n const groupName = customGroupAssignment === \"\" ? deviceName : customGroupAssignment\n const genericInput = mqtt.messagesByTopics(\n getGenericInputStateTopics(mqtt.portalId, gi.tree, gi.deviceId, gi.inputId)\n ) as unknown as GenericInputState\n\n if (\n !(\n genericInput.showUIControl & SWITCHABLE_OUTPUT_VISIBILITY.VISIBLE ||\n genericInput.showUIControl & SWITCHABLE_OUTPUT_VISIBILITY.VISIBLE_LOCAL_UI\n )\n ) {\n return\n }\n\n items.push({\n groupName,\n item: {\n ...genericInput,\n kind: \"genericInput\",\n tree: gi.tree,\n deviceId: gi.deviceId,\n outputId: gi.inputId,\n parentDeviceName: deviceName as string,\n type: remapGenericInputType(genericInput.type as number),\n },\n })\n })\n\n // Distribute items to groups\n const newGroups: { [key: string]: SwitchingPaneItem[] } = {}\n items.forEach(({ groupName, item }) => {\n newGroups[groupName] ||= []\n newGroups[groupName].push(item)\n })\n\n // Sort items in each group by display name\n Object.values(newGroups).forEach((array) => {\n array.sort((a, b) => {\n const aName = getSwitchingPaneItemNameForDisplay(a, a.parentDeviceName)\n const bName = getSwitchingPaneItemNameForDisplay(b, b.parentDeviceName)\n return aName.localeCompare(bName)\n })\n })\n\n Logger.log(`New switching pane groups: ${JSON.stringify(Object.keys(newGroups))}`)\n switchingPaneStore.setGroups(newGroups)\n }\n })\n return () => dispose()\n }, [\n messagesForSwitchableOutputs,\n messagesForGenericInputs,\n messagesForSwitchingDevices,\n gxDeviceRelaysGroupName,\n mqtt,\n switchingPaneStore,\n ])\n\n return switchingPaneStore\n}\n\nfunction extractSwitchableOutputInfo(topic: string) {\n const pattern = new RegExp(`/(${SWITCHABLE_OUTPUT_TREES.join(\"|\")})/`)\n const match = topic.match(pattern)\n const switchStart = match ? match.index! + match[0].length : -1 // length of `/system/`, or `/switch/`, or ...\n const outputStart = topic.indexOf(\"/SwitchableOutput/\") + 18 // length of `/SwitchableOutput/`\n\n return {\n tree: (match?.[1] as SwitchableOutputTree) ?? null, // \"switch\", \"system\", ...\n deviceId: Number(topic.substring(switchStart, topic.indexOf(\"/\", switchStart))) as SwitchingDeviceInstanceId,\n outputId: topic.substring(outputStart, topic.indexOf(\"/\", outputStart)) as SwitchableOutputId,\n }\n}\n\nfunction extractGenericInputInfo(topic: string) {\n const pattern = new RegExp(`/(${SWITCHABLE_OUTPUT_TREES.join(\"|\")})/`)\n const match = topic.match(pattern)\n const treeEnd = match ? match.index! + match[0].length : -1\n const inputStart = topic.indexOf(\"/GenericInput/\") + 14 // length of `/GenericInput/`\n\n return {\n tree: (match?.[1] as SwitchableOutputTree) ?? null,\n deviceId: Number(topic.substring(treeEnd, topic.indexOf(\"/\", treeEnd))) as SwitchingDeviceInstanceId,\n inputId: topic.substring(inputStart, topic.indexOf(\"/\", inputStart)) as GenericInputId,\n }\n}\n\nfunction arraysEqual<T>(a: T[], b: T[]): boolean {\n if (a.length !== b.length) return false\n return a.every((element, index) => b[index] === element)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SwitchingPane.provider.js","sourceRoot":"/","sources":["src/Modules/SwitchingPane/SwitchingPane.provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAC9B,OAAO,MAAM,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAY,OAAO,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,EAAE,6BAA6B,EAA6B,MAAM,4BAA4B,CAAA;AACrG,OAAO,EACL,kCAAkC,EAClC,8BAA8B,EAC9B,uBAAuB,GAMxB,MAAM,6BAA6B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AC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAC3D,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAA,CAAC,6BAA6B;IAErF,OAAO;QACL,IAAI,EAAE,MAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAG,CAAC,CAA0B,mCAAI,IAAI;QAClD,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAA8B;QACpG,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,CAAmB;KACvF,CAAA;AACH,CAAC;AAED,MAAM,UAAU,WAAW,CAAI,CAAM,EAAE,CAAM;IAC3C,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QAAE,OAAO,KAAK,CAAA;IACvC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,CAAA;AAC1D,CAAC","sourcesContent":["import { autorun } from \"mobx\"\nimport Logger from \"../../utils/logger\"\nimport { PortalId, useMqtt } from \"../Mqtt\"\nimport { useMemo, useEffect } from \"react\"\nimport { useSwitchingPaneStore } from \"./SwitchingPane.store\"\nimport { getSwitchingDeviceStateTopics, SwitchingDeviceInstanceId } from \"./SwitchingDevice.provider\"\nimport {\n getSwitchingPaneItemNameForDisplay,\n getSwitchableOutputStateTopics,\n SWITCHABLE_OUTPUT_TREES,\n SwitchableOutputId,\n SwitchableOutputState,\n SwitchableOutputTree,\n GenericInputState,\n SwitchingPaneItem,\n} from \"./SwitchableOutput.provider\"\nimport { getGenericInputStateTopics, GenericInputId } from \"./GenericInput.provider\"\nimport { remapGenericInputType, SWITCHABLE_OUTPUT_FUNCTION, SWITCHABLE_OUTPUT_VISIBILITY } from \"../../utils/constants\"\n\nconst hasMessages = (messages: Record<string, string> | undefined) => messages && Object.keys(messages).length > 0\n\nexport const useSwitchingPane = (gxDeviceRelaysGroupName: string) => {\n const switchingPaneStore = useSwitchingPaneStore()\n\n const getTopics = (portalId: PortalId) => ({\n switchableOutputs: `N/${portalId}/(${SWITCHABLE_OUTPUT_TREES.join(\"|\")})/+/SwitchableOutput/+/Settings/+`,\n genericInputs: `N/${portalId}/(${SWITCHABLE_OUTPUT_TREES.join(\"|\")})/+/GenericInput/+/Settings/+`,\n switchingDevices: `N/${portalId}/switch/+`,\n })\n\n const mqtt = useMqtt()\n const topics = useMemo(() => getTopics(mqtt.portalId), [mqtt.portalId])\n\n const messagesForSwitchableOutputs = mqtt.messagesByWildcard(topics.switchableOutputs)\n const messagesForGenericInputs = mqtt.messagesByWildcard(topics.genericInputs)\n const messagesForSwitchingDevices = mqtt.messagesByWildcard(topics.switchingDevices)\n\n // Examine MQTT to find all available switchable outputs, generic inputs, and their group assignments\n useEffect(() => {\n if (!hasMessages(messagesForSwitchableOutputs) && !hasMessages(messagesForGenericInputs)) {\n Logger.log(\"Waiting for switchable outputs or generic inputs...\")\n return\n }\n\n // All switchable outputs in array sorted by topic\n const availableSwitchableOutputs = messagesForSwitchableOutputs\n ? (Object.keys(messagesForSwitchableOutputs)\n .filter((key) => key.endsWith(\"/Settings/Group\"))\n .sort() as string[])\n : []\n\n // All switchable outputs group assignments in array sorted by topic\n const customGroupAssigments = availableSwitchableOutputs.map((topic) => {\n return messagesForSwitchableOutputs[topic]\n })\n // All switchable outputs types in array sorted by topic\n const availableSwitchableOutputTypes = availableSwitchableOutputs.map((topic) => {\n return messagesForSwitchableOutputs[`${topic.slice(0, -\"/Group\".length)}/Type`]\n })\n // All switchable outputs names in array sorted by topic\n const availableSwitchableOutputNames = availableSwitchableOutputs.map((topic) => {\n return messagesForSwitchableOutputs[`${topic.slice(0, -\"/Group\".length)}/CustomName`]\n })\n // All switchable outputs visibility in array sorted by topic\n const availableSwitchableOutputVisibilityFlags = availableSwitchableOutputs.map((topic) => {\n return messagesForSwitchableOutputs[`${topic.slice(0, -\"/Group\".length)}/ShowUIControl`]\n })\n // All switchable outputs functions in array sorted by topic\n const availableSwitchableOutputFunctions = availableSwitchableOutputs.map((topic) => {\n return messagesForSwitchableOutputs[`${topic.slice(0, -\"/Group\".length)}/Function`]\n })\n\n // All generic inputs in array sorted by topic\n const availableGenericInputs = messagesForGenericInputs\n ? (Object.keys(messagesForGenericInputs)\n .filter((key) => key.endsWith(\"/Settings/Group\"))\n .sort() as string[])\n : []\n\n // All generic input group assignments in array sorted by topic\n const genericInputGroupAssignments = availableGenericInputs.map((topic) => {\n return messagesForGenericInputs[topic]\n })\n // All generic input types in array sorted by topic\n const availableGenericInputTypes = availableGenericInputs.map((topic) => {\n return messagesForGenericInputs[`${topic.slice(0, -\"/Group\".length)}/Type`]\n })\n // All generic input names in array sorted by topic\n const availableGenericInputNames = availableGenericInputs.map((topic) => {\n return messagesForGenericInputs[`${topic.slice(0, -\"/Group\".length)}/CustomName`]\n })\n // All generic input visibility in array sorted by topic\n const availableGenericInputVisibilityFlags = availableGenericInputs.map((topic) => {\n return messagesForGenericInputs[`${topic.slice(0, -\"/Group\".length)}/ShowUIInput`]\n })\n\n // All switching devices in array sorted by instance number\n const availableSwitchingDevices = Object.keys(messagesForSwitchingDevices)\n .filter((key) => key.endsWith(\"/DeviceInstance\"))\n .sort() as string[]\n\n // All switching device names in array sorted by instance number\n const availableSwitchingDeviceNames = availableSwitchingDevices.map((topic) => {\n const topicPrefix = topic.slice(0, -\"/DeviceInstance\".length)\n return (\n messagesForSwitchingDevices[`${topicPrefix}/CustomName`] ||\n messagesForSwitchingDevices[`${topicPrefix}/ProductName`]\n )\n })\n\n const dispose = autorun(() => {\n const oldAssignments = switchingPaneStore.customGroupAssignments\n const newAssignments = customGroupAssigments\n const groupAssignmentsChanged = !arraysEqual(oldAssignments, newAssignments)\n if (groupAssignmentsChanged) {\n switchingPaneStore.setCustomGroupAssignments(newAssignments)\n }\n\n const oldOutputTypes = switchingPaneStore.outputTypes\n const newOutputTypes = availableSwitchableOutputTypes\n const outputTypesChanged = !arraysEqual(oldOutputTypes, newOutputTypes)\n if (outputTypesChanged) {\n switchingPaneStore.setOutputTypes(newOutputTypes)\n }\n\n const oldOutputNames = switchingPaneStore.outputNames\n const newOutputNames = availableSwitchableOutputNames\n const outputNamesChanged = !arraysEqual(oldOutputNames, newOutputNames)\n if (outputNamesChanged) {\n switchingPaneStore.setOutputNames(newOutputNames)\n }\n\n const oldOutputVisibilityFlags = switchingPaneStore.outputVisibilityFlags\n const newOutputVisibilityFlags = availableSwitchableOutputVisibilityFlags\n const outputVisibilityFlagsChanged = !arraysEqual(oldOutputVisibilityFlags, newOutputVisibilityFlags)\n if (outputVisibilityFlagsChanged) {\n switchingPaneStore.setOutputVisibilityFlags(newOutputVisibilityFlags)\n }\n\n const oldOutputFunctions = switchingPaneStore.outputFunctions\n const newOutputFunctions = availableSwitchableOutputFunctions\n const outputFunctionsChanged = !arraysEqual(oldOutputFunctions, newOutputFunctions)\n if (outputFunctionsChanged) {\n switchingPaneStore.setOutputFunctions(newOutputFunctions)\n }\n\n const oldSwitchingDevices = switchingPaneStore.switchingDevices\n const newSwitchingDevices = availableSwitchingDevices\n const switchingDevicesChanged = !arraysEqual(oldSwitchingDevices, newSwitchingDevices)\n if (switchingDevicesChanged) {\n switchingPaneStore.setSwitchingDevices(newSwitchingDevices)\n }\n\n const oldSwitchingDeviceNames = switchingPaneStore.switchingDeviceNames\n const newSwitchingDeviceNames = availableSwitchingDeviceNames\n const switchingDeviceNamesChanged = !arraysEqual(oldSwitchingDeviceNames, newSwitchingDeviceNames)\n if (switchingDeviceNamesChanged) {\n switchingPaneStore.setSwitchingDeviceNames(newSwitchingDeviceNames)\n }\n\n const oldGiAssignments = switchingPaneStore.genericInputGroupAssignments\n const newGiAssignments = genericInputGroupAssignments\n const giGroupAssignmentsChanged = !arraysEqual(oldGiAssignments, newGiAssignments)\n if (giGroupAssignmentsChanged) {\n switchingPaneStore.setGenericInputGroupAssignments(newGiAssignments)\n }\n\n const oldGiTypes = switchingPaneStore.genericInputTypes\n const newGiTypes = availableGenericInputTypes\n const giTypesChanged = !arraysEqual(oldGiTypes, newGiTypes)\n if (giTypesChanged) {\n switchingPaneStore.setGenericInputTypes(newGiTypes)\n }\n\n const oldGiNames = switchingPaneStore.genericInputNames\n const newGiNames = availableGenericInputNames\n const giNamesChanged = !arraysEqual(oldGiNames, newGiNames)\n if (giNamesChanged) {\n switchingPaneStore.setGenericInputNames(newGiNames)\n }\n\n const oldGiVisibilityFlags = switchingPaneStore.genericInputVisibilityFlags\n const newGiVisibilityFlags = availableGenericInputVisibilityFlags\n const giVisibilityFlagsChanged = !arraysEqual(oldGiVisibilityFlags, newGiVisibilityFlags)\n if (giVisibilityFlagsChanged) {\n switchingPaneStore.setGenericInputVisibilityFlags(newGiVisibilityFlags)\n }\n\n // On initial population (all old arrays empty), skip per-field logging\n const isInitialLoad =\n oldAssignments.length === 0 &&\n oldOutputTypes.length === 0 &&\n oldSwitchingDevices.length === 0 &&\n oldGiAssignments.length === 0\n\n if (!isInitialLoad) {\n if (groupAssignmentsChanged) Logger.log(`Switchable outputs group assignments changed, recomputing...`)\n if (outputTypesChanged) Logger.log(`Switchable outputs types changed, recomputing...`)\n if (outputNamesChanged) Logger.log(`Switchable outputs names changed, recomputing...`)\n if (outputVisibilityFlagsChanged) Logger.log(`Switchable outputs visibility flags changed, recomputing...`)\n if (outputFunctionsChanged) Logger.log(`Switchable outputs functions changed, recomputing...`)\n if (switchingDevicesChanged) Logger.log(`Switching devices changed, recomputing...`)\n if (switchingDeviceNamesChanged) Logger.log(`Switching device names changed, recomputing...`)\n if (giGroupAssignmentsChanged) Logger.log(`Generic input group assignments changed, recomputing...`)\n if (giTypesChanged) Logger.log(`Generic input types changed, recomputing...`)\n if (giNamesChanged) Logger.log(`Generic input names changed, recomputing...`)\n if (giVisibilityFlagsChanged) Logger.log(`Generic input visibility flags changed, recomputing...`)\n }\n\n if (\n groupAssignmentsChanged ||\n outputTypesChanged ||\n outputNamesChanged ||\n outputVisibilityFlagsChanged ||\n outputFunctionsChanged ||\n switchingDevicesChanged ||\n switchingDeviceNamesChanged ||\n giGroupAssignmentsChanged ||\n giTypesChanged ||\n giNamesChanged ||\n giVisibilityFlagsChanged\n ) {\n // Collect all switching pane items (switchable outputs + generic inputs) with their group info\n const items: { groupName: string; item: SwitchingPaneItem }[] = []\n\n availableSwitchableOutputs.forEach((output, index) => {\n const swo = extractSwitchableOutputInfo(output)\n const switchingDevice = mqtt.messagesByTopics(\n getSwitchingDeviceStateTopics(mqtt.portalId, swo.tree, swo.deviceId)\n )\n const customGroupAssignment = customGroupAssigments[index].trim()\n const deviceName = switchingDevice.customName || switchingDevice.productName || gxDeviceRelaysGroupName\n const groupName = customGroupAssignment === \"\" ? deviceName : customGroupAssignment\n const switchableOutput = mqtt.messagesByTopics(\n getSwitchableOutputStateTopics(mqtt.portalId, swo.tree, swo.deviceId, swo.outputId)\n ) as unknown as SwitchableOutputState\n\n if (\n !(\n switchableOutput.showUIControl & SWITCHABLE_OUTPUT_VISIBILITY.VISIBLE ||\n switchableOutput.showUIControl & SWITCHABLE_OUTPUT_VISIBILITY.VISIBLE_LOCAL_UI\n )\n ) {\n return\n }\n\n // GX system relays: only show when Function is Manual (matching gui-v2)\n if (\n swo.tree === \"system\" &&\n switchableOutput.function != null &&\n switchableOutput.function !== SWITCHABLE_OUTPUT_FUNCTION.MANUAL\n ) {\n return\n }\n\n items.push({\n groupName,\n item: {\n ...switchableOutput,\n kind: \"switchableOutput\",\n tree: swo.tree,\n deviceId: swo.deviceId,\n outputId: swo.outputId,\n parentDeviceName: deviceName as string,\n },\n })\n })\n\n availableGenericInputs.forEach((input, index) => {\n const gi = extractGenericInputInfo(input)\n const switchingDevice = mqtt.messagesByTopics(\n getSwitchingDeviceStateTopics(mqtt.portalId, gi.tree, gi.deviceId)\n )\n const customGroupAssignment = genericInputGroupAssignments[index].trim()\n const deviceName = switchingDevice.customName || switchingDevice.productName || gxDeviceRelaysGroupName\n const groupName = customGroupAssignment === \"\" ? deviceName : customGroupAssignment\n const genericInput = mqtt.messagesByTopics(\n getGenericInputStateTopics(mqtt.portalId, gi.tree, gi.deviceId, gi.inputId)\n ) as unknown as GenericInputState\n\n if (\n !(\n genericInput.showUIControl & SWITCHABLE_OUTPUT_VISIBILITY.VISIBLE ||\n genericInput.showUIControl & SWITCHABLE_OUTPUT_VISIBILITY.VISIBLE_LOCAL_UI\n )\n ) {\n return\n }\n\n items.push({\n groupName,\n item: {\n ...genericInput,\n kind: \"genericInput\",\n tree: gi.tree,\n deviceId: gi.deviceId,\n outputId: gi.inputId,\n parentDeviceName: deviceName as string,\n type: remapGenericInputType(genericInput.type as number),\n },\n })\n })\n\n // Distribute items to groups\n const newGroups: { [key: string]: SwitchingPaneItem[] } = {}\n items.forEach(({ groupName, item }) => {\n newGroups[groupName] ||= []\n newGroups[groupName].push(item)\n })\n\n // Sort items in each group by display name\n Object.values(newGroups).forEach((array) => {\n array.sort((a, b) => {\n const aName = getSwitchingPaneItemNameForDisplay(a, a.parentDeviceName)\n const bName = getSwitchingPaneItemNameForDisplay(b, b.parentDeviceName)\n return aName.localeCompare(bName)\n })\n })\n\n Logger.log(`New switching pane groups: ${JSON.stringify(Object.keys(newGroups))}`)\n switchingPaneStore.setGroups(newGroups)\n }\n })\n return () => dispose()\n }, [\n messagesForSwitchableOutputs,\n messagesForGenericInputs,\n messagesForSwitchingDevices,\n gxDeviceRelaysGroupName,\n mqtt,\n switchingPaneStore,\n ])\n\n return switchingPaneStore\n}\n\nexport function extractSwitchableOutputInfo(topic: string) {\n const pattern = new RegExp(`/(${SWITCHABLE_OUTPUT_TREES.join(\"|\")})/`)\n const match = topic.match(pattern)\n const switchStart = match ? match.index! + match[0].length : -1 // length of `/system/`, or `/switch/`, or ...\n const outputStart = topic.indexOf(\"/SwitchableOutput/\") + 18 // length of `/SwitchableOutput/`\n\n return {\n tree: (match?.[1] as SwitchableOutputTree) ?? null, // \"switch\", \"system\", ...\n deviceId: Number(topic.substring(switchStart, topic.indexOf(\"/\", switchStart))) as SwitchingDeviceInstanceId,\n outputId: topic.substring(outputStart, topic.indexOf(\"/\", outputStart)) as SwitchableOutputId,\n }\n}\n\nexport function extractGenericInputInfo(topic: string) {\n const pattern = new RegExp(`/(${SWITCHABLE_OUTPUT_TREES.join(\"|\")})/`)\n const match = topic.match(pattern)\n const treeEnd = match ? match.index! + match[0].length : -1\n const inputStart = topic.indexOf(\"/GenericInput/\") + 14 // length of `/GenericInput/`\n\n return {\n tree: (match?.[1] as SwitchableOutputTree) ?? null,\n deviceId: Number(topic.substring(treeEnd, topic.indexOf(\"/\", treeEnd))) as SwitchingDeviceInstanceId,\n inputId: topic.substring(inputStart, topic.indexOf(\"/\", inputStart)) as GenericInputId,\n }\n}\n\nexport function arraysEqual<T>(a: T[], b: T[]): boolean {\n if (a.length !== b.length) return false\n return a.every((element, index) => b[index] === element)\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"/","sources":["src/utils/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;CAIzB,CAAA;AAED,eAAO,MAAM,sBAAsB;;CAElC,CAAA;AAGD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;CAevB,CAAA;AAGD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;CAkBxB,CAAA;AAGD,eAAO,MAAM,aAAa;;;;;;;;;;;;CAYzB,CAAA;AAED,eAAO,MAAM,SAAS;;;;;;CAMrB,CAAA;AAED,eAAO,MAAM,cAAc;;;;;CAK1B,CAAA;AAED,eAAO,MAAM,YAAY;;;;CAIxB,CAAA;AAED,eAAO,MAAM,WAAW;;;;;CAKvB,CAAA;AAED,eAAO,MAAM,YAAY;;;CAGxB,CAAA;AA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AACtE,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,MAAM,EAAE,CAAC;CACD,CAAA;AAKV,iFAAiF;AACjF,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAA;AAE5C,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,QAAQ,EAAE,GAAG;IACb,cAAc,EAAE,GAAG;IACnB,gBAAgB,EAAE,GAAG;IACrB,WAAW,EAAE,GAAG;CACR,CAAA;AAIV,MAAM,UAAU,qBAAqB,CAAC,OAAe;IACnD,OAAO,CAAC,OAAO,GAAG,yBAAyB,CAAqB,CAAA;AAClE,CAAC;AAED,MAAM,CAAC,MAAM,iCAAiC,GAAG,MAAM,CAAC,WAAW,CACjE,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,yBAAyB,CAAC,CAAC,CAAC,CACpD,CAAA;AAKvD,iFAAiF;AACjF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,EAAE,EAAE,IAAI;IACR,KAAK,EAAE,IAAI;IACX,WAAW,EAAE,IAAI;CACT,CAAA;AAIV,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,UAAU,EAAE,YAAY;IACxB,OAAO,EAAE,SAAS;IAClB,qCAAqC,EAAE,uCAAuC;IAC9E,cAAc,EAAE,gBAAgB;IAChC,gBAAgB,EAAE,kBAAkB;IACpC,KAAK,EAAE,OAAO;CACf,CAAA","sourcesContent":["export const BATTERY_STATE = {\n IDLE: 0,\n CHARGING: 1,\n DISCHARGING: 2,\n}\n\nexport const DC_SOURCE_MONITOR_MODE = {\n WIND_GENERATOR: -8,\n}\n\n// Taken from: https://github.com/victronenergy/venus/wiki/dbus#vebus\nexport const VEBUS_STATE = {\n OFF: 0,\n LOW_POWER: 1,\n FAULT_CONDITION: 2,\n BULK_CHARGING: 3,\n ABSORPTION_CHARGING: 4,\n FLOAT_CHARGING: 5,\n STORAGE_MODE: 6,\n EQUALISATION_CHARGING: 7,\n PASSTHRU: 8,\n INVERTING: 9,\n ASSISTING: 10,\n POWER_SUPPLY_MODE: 11,\n SUSTAIN: 244,\n EXTERNAL_CONTROL: 252,\n}\n\n// Taken from: https://github.com/victronenergy/venus/wiki/dbus#system\nexport const SYSTEM_STATE = {\n OFF: 0,\n LOW_POWER: 1,\n FAULT_CONDITION: 2,\n BULK_CHARGING: 3,\n ABSORPTION_CHARGING: 4,\n FLOAT_CHARGING: 5,\n STORAGE_MODE: 6,\n EQUALISATION_CHARGING: 7,\n PASSTHRU: 8,\n INVERTING: 9,\n ASSISTING: 10,\n SUSTAIN: 244,\n EXTERNAL_CONTROL: 252,\n DISCHARGING: 256,\n ESS_SUSTAIN: 257,\n RECHARGE: 258,\n SCHEDULED_RECHARGE: 259,\n}\n\n// Taken from: https://github.com/victronenergy/venus/wiki/dbus#charger\nexport const CHARGER_STATE = {\n OFF: 0,\n FAULT_CONDITION: 2,\n BULK_CHARGING: 3,\n ABSORPTION_CHARGING: 4,\n FLOAT_CHARGING: 5,\n STORAGE_MODE: 6,\n EQUALISATION_CHARGING: 7,\n POWER_SUPPLY_MODE: 11,\n REPEATED_ABSORPTION: 246,\n AUTO_EQUALIZE: 247,\n BATTERY_SAFE: 248,\n}\n\nexport const AC_SOURCE = {\n NOT_AVAILABLE: 0,\n GRID: 1,\n GENSET: 2,\n SHORE: 3,\n INVERTING_ISLAND_MODE: 240,\n}\n\nexport const AC_SOURCE_TYPE = {\n NOT_IN_USE: 0,\n GRID: 1,\n GENERATOR: 2,\n SHORE: 3,\n}\n\nexport const ACTIVE_INPUT = {\n INPUT_0: 0,\n INPUT_1: 1,\n NONE: 240, // Inverting\n}\n\nexport const SYSTEM_MODE = {\n CHARGER_ONLY: 1,\n INVERTER_ONLY: 2,\n ON: 3,\n OFF: 4,\n}\n\nexport const CHARGER_MODE = {\n OFF: 4,\n ON: 1,\n}\n\nexport const INVERTER_MODE = {\n ON: 2,\n VEBUS_ON: 3, // Vebus inverters use mode 3 in stead of 2 for ON.\n OFF: 4,\n ECO: 5,\n}\n\nexport const FISCHER_PANDA_GENSET_PRODUCT_ID = 45120 /// 0xB040 VE_PROD_ID_FISCHER_PANDA_GENSET\n\nexport const FISCHER_PANDA_GENSET_AUTOSTART = {\n DISABLED: 0,\n ENABLED: 1,\n}\n\nexport const RELAY_FUNCTION = {\n GENERATOR_START_STOP: 1,\n}\n\nexport const GENERATOR_START_STOP = {\n STOP: 0,\n START: 1,\n AUTO_ON: 1,\n AUTO_OFF: 0,\n}\n\n// Taken from: https://github.com/victronenergy/venus/wiki/dbus#tank-levels\nexport const TANK_FLUID_TYPE = {\n FUEL: 0,\n FRESH_WATER: 1,\n WASTE_WATER: 2,\n LIVE_WELL: 3,\n OIL: 4,\n BLACK_WATER: 5,\n GASOLINE: 6,\n DIESEL: 7,\n LPG: 8,\n LNG: 9,\n HYDRAULIC_OIL: 10,\n RAW_WATER: 11,\n}\n\n// Taken from: https://github.com/victronenergy/venus/wiki/dbus#switch\nexport const SWITCHABLE_OUTPUT_TYPE = {\n MOMENTARY_SWITCH: 0,\n TOGGLE_SWITCH: 1,\n DIMMABLE: 2,\n TEMPERATURE_SETPOINT: 3,\n STEPPED_SWITCH: 4,\n SLAVE_MODE: 5,\n DROPDOWN: 6,\n SLIDER: 7,\n UNRANGED_SETPOINT: 8,\n THREE_STATE_SWITCH: 9,\n BILGE_PUMP_CONTROL: 10,\n RGB_COLOR_WHEEL: 11,\n CCT_COLOR_WHEEL: 12,\n RGBW_COLOR_WHEEL: 13,\n} as const\n\nexport type SwitchableOutputType = (typeof SWITCHABLE_OUTPUT_TYPE)[keyof typeof SWITCHABLE_OUTPUT_TYPE]\n\nexport const SWITCHABLE_OUTPUT_VALID_TYPES_BITMASK = Object.fromEntries(\n Object.entries(SWITCHABLE_OUTPUT_TYPE).map(([key, value]) => [key, 1 << value])\n) as { [K in keyof typeof SWITCHABLE_OUTPUT_TYPE]: number }\n\nexport type SwitchableOutputValidTypesBitmask =\n (typeof SWITCHABLE_OUTPUT_VALID_TYPES_BITMASK)[keyof typeof SWITCHABLE_OUTPUT_VALID_TYPES_BITMASK]\n\n// Taken from: https://github.com/victronenergy/venus/wiki/dbus#switch\nexport const SWITCHABLE_OUTPUT_STATUS = {\n STATUS_OFF: 0x00,\n STATUS_ON: 0x09,\n STATUS_POWERED: 0x01,\n STATUS_TRIPPED: 0x02,\n STATUS_OVER_TEMPERATURE: 0x04,\n STATUS_OUTPUT_FAULT: 0x08,\n STATUS_SHORT_FAULT: 0x10,\n STATUS_DISABLED: 0x20,\n STATUS_BYPASSED: 0x40,\n STATUS_EXT_CONTROL: 0x80,\n} as const\n\nexport type SwitchableOutputStatus = (typeof SWITCHABLE_OUTPUT_STATUS)[keyof typeof SWITCHABLE_OUTPUT_STATUS]\n\n// Taken from: https://github.com/victronenergy/venus/wiki/dbus#switch\nexport const SWITCHABLE_OUTPUT_VISIBILITY = {\n INVISIBLE: 0,\n VISIBLE: 1,\n VISIBLE_LOCAL_UI: 1 << 1,\n VISIBLE_REMOTE_UI: 1 << 2,\n} as const\n\nexport type SwitchableOutputVisibility =\n (typeof SWITCHABLE_OUTPUT_VISIBILITY)[keyof typeof SWITCHABLE_OUTPUT_VISIBILITY]\n\n// Taken from: https://github.com/victronenergy/venus/wiki/dbus#switch\nexport const SWITCHABLE_OUTPUT_FUNCTION = {\n MANUAL: 2,\n} as const\n\nexport type SwitchableOutputFunction =\n (typeof SWITCHABLE_OUTPUT_FUNCTION)[keyof typeof SWITCHABLE_OUTPUT_FUNCTION]\n\n// Taken from: https://github.com/victronenergy/venus/wiki/dbus#generic-input-api\nexport const GENERIC_INPUT_TYPE_OFFSET = 100\n\nexport const GENERIC_INPUT_TYPE = {\n DISCRETE: 100,\n VALUE_NO_RANGE: 101,\n VALUE_WITH_RANGE: 102,\n TEMPERATURE: 103,\n} as const\n\nexport type GenericInputType = (typeof GENERIC_INPUT_TYPE)[keyof typeof GENERIC_INPUT_TYPE]\n\nexport function remapGenericInputType(rawType: number): GenericInputType {\n return (rawType + GENERIC_INPUT_TYPE_OFFSET) as GenericInputType\n}\n\nexport const GENERIC_INPUT_VALID_TYPES_BITMASK = Object.fromEntries(\n Object.entries(GENERIC_INPUT_TYPE).map(([key, value]) => [key, 1 << (value - GENERIC_INPUT_TYPE_OFFSET)])\n) as { [K in keyof typeof GENERIC_INPUT_TYPE]: number }\n\nexport type GenericInputValidTypesBitmask =\n (typeof GENERIC_INPUT_VALID_TYPES_BITMASK)[keyof typeof GENERIC_INPUT_VALID_TYPES_BITMASK]\n\n// Taken from: https://github.com/victronenergy/venus/wiki/dbus#generic-input-api\nexport const GENERIC_INPUT_STATUS = {\n OK: 0x00,\n FAULT: 0x01,\n BATTERY_LOW: 0x02,\n} as const\n\nexport type GenericInputStatus = (typeof GENERIC_INPUT_STATUS)[keyof typeof GENERIC_INPUT_STATUS]\n\nexport const VIEWS = {\n CONNECTING: \"CONNECTING\",\n METRICS: \"METRICS\",\n INVERTER_CHARGER_INPUT_LIMIT_SELECTOR: \"INVERTER_CHARGER_INPUT_LIMIT_SELECTOR\",\n REMOTE_CONSOLE: \"REMOTE_CONSOLE\",\n MQTT_UNAVAILABLE: \"MQTT_UNAVAILABLE\",\n ERROR: \"ERROR\",\n}\n"]}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"/","sources":["src/utils/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,CAAC;IACP,QAAQ,EAAE,CAAC;IACX,WAAW,EAAE,CAAC;CACf,CAAA;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,cAAc,EAAE,CAAC,CAAC;CACnB,CAAA;AAED,qEAAqE;AACrE,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,GAAG,EAAE,CAAC;IACN,SAAS,EAAE,CAAC;IACZ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ND_GENERATOR: -8,\n}\n\n// Taken from: https://github.com/victronenergy/venus/wiki/dbus#vebus\nexport const VEBUS_STATE = {\n OFF: 0,\n LOW_POWER: 1,\n FAULT_CONDITION: 2,\n BULK_CHARGING: 3,\n ABSORPTION_CHARGING: 4,\n FLOAT_CHARGING: 5,\n STORAGE_MODE: 6,\n EQUALISATION_CHARGING: 7,\n PASSTHRU: 8,\n INVERTING: 9,\n ASSISTING: 10,\n POWER_SUPPLY_MODE: 11,\n SUSTAIN: 244,\n EXTERNAL_CONTROL: 252,\n}\n\n// Taken from: https://github.com/victronenergy/venus/wiki/dbus#system\nexport const SYSTEM_STATE = {\n OFF: 0,\n LOW_POWER: 1,\n FAULT_CONDITION: 2,\n BULK_CHARGING: 3,\n ABSORPTION_CHARGING: 4,\n FLOAT_CHARGING: 5,\n STORAGE_MODE: 6,\n EQUALISATION_CHARGING: 7,\n PASSTHRU: 8,\n INVERTING: 9,\n ASSISTING: 10,\n SUSTAIN: 244,\n EXTERNAL_CONTROL: 252,\n DISCHARGING: 256,\n ESS_SUSTAIN: 257,\n RECHARGE: 258,\n SCHEDULED_RECHARGE: 259,\n}\n\n// Taken from: https://github.com/victronenergy/venus/wiki/dbus#charger\nexport const CHARGER_STATE = {\n OFF: 0,\n FAULT_CONDITION: 2,\n BULK_CHARGING: 3,\n ABSORPTION_CHARGING: 4,\n FLOAT_CHARGING: 5,\n STORAGE_MODE: 6,\n EQUALISATION_CHARGING: 7,\n POWER_SUPPLY_MODE: 11,\n REPEATED_ABSORPTION: 246,\n AUTO_EQUALIZE: 247,\n BATTERY_SAFE: 248,\n}\n\nexport const AC_SOURCE = {\n NOT_AVAILABLE: 0,\n GRID: 1,\n GENSET: 2,\n SHORE: 3,\n INVERTING_ISLAND_MODE: 240,\n}\n\nexport const AC_SOURCE_TYPE = {\n NOT_IN_USE: 0,\n GRID: 1,\n GENERATOR: 2,\n SHORE: 3,\n}\n\nexport const ACTIVE_INPUT = {\n INPUT_0: 0,\n INPUT_1: 1,\n NONE: 240, // Inverting\n}\n\nexport const SYSTEM_MODE = {\n CHARGER_ONLY: 1,\n INVERTER_ONLY: 2,\n ON: 3,\n OFF: 4,\n}\n\nexport const CHARGER_MODE = {\n OFF: 4,\n ON: 1,\n}\n\nexport const INVERTER_MODE = {\n ON: 2,\n VEBUS_ON: 3, // Vebus inverters use mode 3 in stead of 2 for ON.\n OFF: 4,\n ECO: 5,\n}\n\nexport const FISCHER_PANDA_GENSET_PRODUCT_ID = 45120 /// 0xB040 VE_PROD_ID_FISCHER_PANDA_GENSET\n\nexport const FISCHER_PANDA_GENSET_AUTOSTART = {\n DISABLED: 0,\n ENABLED: 1,\n}\n\nexport const RELAY_FUNCTION = {\n GENERATOR_START_STOP: 1,\n}\n\nexport const GENERATOR_START_STOP = {\n STOP: 0,\n START: 1,\n AUTO_ON: 1,\n AUTO_OFF: 0,\n}\n\n// Taken from: https://github.com/victronenergy/venus/wiki/dbus#tank-levels\nexport const TANK_FLUID_TYPE = {\n FUEL: 0,\n FRESH_WATER: 1,\n WASTE_WATER: 2,\n LIVE_WELL: 3,\n OIL: 4,\n BLACK_WATER: 5,\n GASOLINE: 6,\n DIESEL: 7,\n LPG: 8,\n LNG: 9,\n HYDRAULIC_OIL: 10,\n RAW_WATER: 11,\n}\n\n// Taken from: https://github.com/victronenergy/venus/wiki/dbus#switch\nexport const SWITCHABLE_OUTPUT_TYPE = {\n MOMENTARY_SWITCH: 0,\n TOGGLE_SWITCH: 1,\n DIMMABLE: 2,\n TEMPERATURE_SETPOINT: 3,\n STEPPED_SWITCH: 4,\n SLAVE_MODE: 5,\n DROPDOWN: 6,\n SLIDER: 7,\n UNRANGED_SETPOINT: 8,\n THREE_STATE_SWITCH: 9,\n BILGE_PUMP_CONTROL: 10,\n RGB_COLOR_WHEEL: 11,\n CCT_COLOR_WHEEL: 12,\n RGBW_COLOR_WHEEL: 13,\n} as const\n\nexport type SwitchableOutputType = (typeof SWITCHABLE_OUTPUT_TYPE)[keyof typeof SWITCHABLE_OUTPUT_TYPE]\n\nexport const SWITCHABLE_OUTPUT_VALID_TYPES_BITMASK = Object.fromEntries(\n Object.entries(SWITCHABLE_OUTPUT_TYPE).map(([key, value]) => [key, 1 << value])\n) as { [K in keyof typeof SWITCHABLE_OUTPUT_TYPE]: number }\n\nexport type SwitchableOutputValidTypesBitmask =\n (typeof SWITCHABLE_OUTPUT_VALID_TYPES_BITMASK)[keyof typeof SWITCHABLE_OUTPUT_VALID_TYPES_BITMASK]\n\n// Taken from: https://github.com/victronenergy/venus/wiki/dbus#switch\nexport const SWITCHABLE_OUTPUT_STATUS = {\n STATUS_OFF: 0x00,\n STATUS_ON: 0x09,\n STATUS_POWERED: 0x01,\n STATUS_TRIPPED: 0x02,\n STATUS_OVER_TEMPERATURE: 0x04,\n STATUS_OUTPUT_FAULT: 0x08,\n STATUS_SHORT_FAULT: 0x10,\n STATUS_DISABLED: 0x20,\n STATUS_BYPASSED: 0x40,\n STATUS_EXT_CONTROL: 0x80,\n} as const\n\nexport type SwitchableOutputStatus = (typeof SWITCHABLE_OUTPUT_STATUS)[keyof typeof SWITCHABLE_OUTPUT_STATUS]\n\n// Taken from: https://github.com/victronenergy/venus/wiki/dbus#switch\nexport const SWITCHABLE_OUTPUT_VISIBILITY = {\n INVISIBLE: 0,\n VISIBLE: 1,\n VISIBLE_LOCAL_UI: 1 << 1,\n VISIBLE_REMOTE_UI: 1 << 2,\n} as const\n\nexport type SwitchableOutputVisibility =\n (typeof SWITCHABLE_OUTPUT_VISIBILITY)[keyof typeof SWITCHABLE_OUTPUT_VISIBILITY]\n\n// Taken from: https://github.com/victronenergy/venus/wiki/dbus#switch\nexport const SWITCHABLE_OUTPUT_FUNCTION = {\n MANUAL: 2,\n} as const\n\nexport type SwitchableOutputFunction = (typeof SWITCHABLE_OUTPUT_FUNCTION)[keyof typeof SWITCHABLE_OUTPUT_FUNCTION]\n\n// Taken from: https://github.com/victronenergy/venus/wiki/dbus#generic-input-api\nexport const GENERIC_INPUT_TYPE_OFFSET = 100\n\nexport const GENERIC_INPUT_TYPE = {\n DISCRETE: 100,\n VALUE_NO_RANGE: 101,\n VALUE_WITH_RANGE: 102,\n TEMPERATURE: 103,\n} as const\n\nexport type GenericInputType = (typeof GENERIC_INPUT_TYPE)[keyof typeof GENERIC_INPUT_TYPE]\n\nexport function remapGenericInputType(rawType: number): GenericInputType {\n return (rawType + GENERIC_INPUT_TYPE_OFFSET) as GenericInputType\n}\n\nexport const GENERIC_INPUT_VALID_TYPES_BITMASK = Object.fromEntries(\n Object.entries(GENERIC_INPUT_TYPE).map(([key, value]) => [key, 1 << (value - GENERIC_INPUT_TYPE_OFFSET)])\n) as { [K in keyof typeof GENERIC_INPUT_TYPE]: number }\n\nexport type GenericInputValidTypesBitmask =\n (typeof GENERIC_INPUT_VALID_TYPES_BITMASK)[keyof typeof GENERIC_INPUT_VALID_TYPES_BITMASK]\n\n// Taken from: https://github.com/victronenergy/venus/wiki/dbus#generic-input-api\nexport const GENERIC_INPUT_STATUS = {\n OK: 0x00,\n FAULT: 0x01,\n BATTERY_LOW: 0x02,\n} as const\n\nexport type GenericInputStatus = (typeof GENERIC_INPUT_STATUS)[keyof typeof GENERIC_INPUT_STATUS]\n\nexport const VIEWS = {\n CONNECTING: \"CONNECTING\",\n METRICS: \"METRICS\",\n INVERTER_CHARGER_INPUT_LIMIT_SELECTOR: \"INVERTER_CHARGER_INPUT_LIMIT_SELECTOR\",\n REMOTE_CONSOLE: \"REMOTE_CONSOLE\",\n MQTT_UNAVAILABLE: \"MQTT_UNAVAILABLE\",\n ERROR: \"ERROR\",\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"/","sources":["src/utils/logger.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"/","sources":["src/utils/logger.ts"],"names":[],"mappings":";mBAOsB,OAAO,EAAE;oBAGR,OAAO,EAAE;qBAGR,OAAO,EAAE;;AAIjC,wBAAmC"}
|
package/dist/src/utils/logger.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const isLoggingDisabled = typeof
|
|
1
|
+
const isLoggingDisabled = (typeof process !== "undefined" && !!process.env.VITEST) ||
|
|
2
|
+
(typeof window !== "undefined" && new URLSearchParams(window.location.search).has("nolog"));
|
|
2
3
|
const log = (...msgs) => {
|
|
3
4
|
if (!isLoggingDisabled)
|
|
4
5
|
console.log(...msgs);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"/","sources":["src/utils/logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"/","sources":["src/utils/logger.ts"],"names":[],"mappings":"AAGA,MAAM,iBAAiB,GACrB,CAAC,OAAO,OAAO,KAAK,WAAW,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;IACxD,CAAC,OAAO,MAAM,KAAK,WAAW,IAAI,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;AAE7F,MAAM,GAAG,GAAG,CAAC,GAAG,IAAe,EAAE,EAAE;IACjC,IAAI,CAAC,iBAAiB;QAAE,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAA;AAC9C,CAAC,CAAA;AACD,MAAM,IAAI,GAAG,CAAC,GAAG,IAAe,EAAE,EAAE;IAClC,IAAI,CAAC,iBAAiB;QAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAA;AAC/C,CAAC,CAAA;AACD,MAAM,KAAK,GAAG,CAAC,GAAG,IAAe,EAAE,EAAE;IACnC,IAAI,CAAC,iBAAiB;QAAE,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAA;AAChD,CAAC,CAAA;AAED,eAAe,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA","sourcesContent":["// Minimal ambient type — we avoid @types/node to prevent Node APIs leaking into this browser-targeted project\ndeclare const process: { env: Record<string, string | undefined> } | undefined\n\nconst isLoggingDisabled =\n (typeof process !== \"undefined\" && !!process.env.VITEST) ||\n (typeof window !== \"undefined\" && new URLSearchParams(window.location.search).has(\"nolog\"))\n\nconst log = (...msgs: unknown[]) => {\n if (!isLoggingDisabled) console.log(...msgs)\n}\nconst warn = (...msgs: unknown[]) => {\n if (!isLoggingDisabled) console.warn(...msgs)\n}\nconst error = (...msgs: unknown[]) => {\n if (!isLoggingDisabled) console.error(...msgs)\n}\n\nexport default { log, warn, error }\n"]}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@victronenergy/mfd-modules",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"test": "
|
|
8
|
+
"test": "vitest run",
|
|
9
|
+
"test:watch": "vitest",
|
|
9
10
|
"build": "tsc",
|
|
10
11
|
"postbuild": "es-check es2015 'dist/**/*.js' --module",
|
|
11
12
|
"semantic-release": "semantic-release",
|
|
@@ -34,6 +35,7 @@
|
|
|
34
35
|
"@eslint/js": "^10.0.1",
|
|
35
36
|
"@semantic-release/git": "^10.0.1",
|
|
36
37
|
"@semantic-release/npm": "^13.1.5",
|
|
38
|
+
"@testing-library/react": "^16.3.2",
|
|
37
39
|
"@types/js-cookie": "^3.0.6",
|
|
38
40
|
"@types/lodash-es": "^4.17.12",
|
|
39
41
|
"@types/react": "^19.2.16",
|
|
@@ -43,10 +45,14 @@
|
|
|
43
45
|
"eslint-plugin-compat": "^7.0.2",
|
|
44
46
|
"eslint-plugin-prettier": "^5.5.6",
|
|
45
47
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
48
|
+
"jsdom": "^29.1.1",
|
|
46
49
|
"prettier": "^3.8.3",
|
|
50
|
+
"react": "^19.2.7",
|
|
51
|
+
"react-dom": "^19.2.7",
|
|
47
52
|
"semantic-release": "^25.0.3",
|
|
48
53
|
"typescript": "^6.0.3",
|
|
49
|
-
"typescript-eslint": "^8.60.1"
|
|
54
|
+
"typescript-eslint": "^8.60.1",
|
|
55
|
+
"vitest": "^4.1.8"
|
|
50
56
|
},
|
|
51
57
|
"peerDependencies": {
|
|
52
58
|
"react": "17 || 18 || 19"
|