Skip to content

Commit

Permalink
Enable multiple users
Browse files Browse the repository at this point in the history
  • Loading branch information
m-roberts committed May 17, 2020
1 parent aa5c64c commit 430d350
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions MMM-Fitbit2.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ Module.register("MMM-Fitbit2", {
// Override socket notification handler.
socketNotificationReceived: function(notification, payload) {
if (notification === "API_DATA_RECEIVED") {
if (payload.clientId != this.config.credentials.clientId) {
// Not for this user
return
}

resource = payload.resource;
if (this.inResources(resource)) {
this.userData[resource]["value"] = payload.values.data;
Expand Down
1 change: 1 addition & 0 deletions node_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ module.exports = NodeHelper.create({
console.log("MMM-Fitbit2: Message received: " + JSON.stringify(message))
}
if (message.type == "data") {
message.clientId = config.credentials.clientId
self.sendSocketNotification("API_DATA_RECEIVED", message);
}
});
Expand Down

0 comments on commit 430d350

Please sign in to comment.