Skip to content

Commit 38358b5

Browse files
committed
fix secondary topics
1 parent 7e41a89 commit 38358b5

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

web/setupMqttServices.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ var topicsToSubscribe = {
1111
"openWB/general/extern": false,
1212
"openWB/general/web_theme": false,
1313
}
14-
var isssTopicsToSubscribe = {
15-
"openWB/isss/parentWB": false,
16-
"openWB/isss/parentCPlp1": false,
17-
"openWB/isss/parentCPlp2": false,
14+
var secondaryTopicsToSubscribe = {
15+
"openWB/internal_chargepoint/global_data": false,
16+
"openWB/internal_chargepoint/0/data/parent_cp": false,
17+
"openWB/internal_chargepoint/1/data/parent_cp": false,
1818
};
1919

2020
var data = {};
@@ -35,7 +35,7 @@ var options = {
3535
Object.keys(topicsToSubscribe).forEach((topic) => {
3636
client.subscribe(topic, { qos: 0 });
3737
});
38-
Object.keys(isssTopicsToSubscribe).forEach((topic) => {
38+
Object.keys(secondaryTopicsToSubscribe).forEach((topic) => {
3939
client.subscribe(topic, { qos: 0 });
4040
});
4141
},
@@ -62,13 +62,13 @@ client.onConnectionLost = function (responseObject) {
6262

6363
// Gets called whenever you receive a message
6464
client.onMessageArrived = function (message) {
65-
updateProgress();
66-
if (message.destinationName.includes("/isss/")) {
67-
isssTopicsToSubscribe[message.destinationName] = true;
65+
if (message.destinationName.includes("/internal_chargepoint/")) {
66+
secondaryTopicsToSubscribe[message.destinationName] = true;
6867
} else {
6968
topicsToSubscribe[message.destinationName] = true;
7069
}
7170
data[message.destinationName] = JSON.parse(message.payloadString);
71+
updateProgress();
7272
handleMessage(message.destinationName, message.payloadString);
7373
};
7474

@@ -93,7 +93,7 @@ function publish(payload, topic) {
9393
function totalTopicCount() {
9494
var counter = Object.keys(topicsToSubscribe).length;
9595
if (data["openWB/general/extern"]) {
96-
counter += Object.keys(isssTopicsToSubscribe).length;
96+
counter += Object.keys(secondaryTopicsToSubscribe).length;
9797
}
9898
return counter;
9999
}
@@ -106,8 +106,8 @@ function missingTopics() {
106106
};
107107
});
108108
if (data["openWB/general/extern"]) {
109-
Object.keys(isssTopicsToSubscribe).forEach((topic) => {
110-
if (!isssTopicsToSubscribe[topic]) {
109+
Object.keys(secondaryTopicsToSubscribe).forEach((topic) => {
110+
if (!secondaryTopicsToSubscribe[topic]) {
111111
counter++;
112112
};
113113
});

0 commit comments

Comments
 (0)