Skip to content

Commit

Permalink
Fix subsequent API calls
Browse files Browse the repository at this point in the history
  • Loading branch information
m-roberts committed Feb 3, 2020
1 parent de466c3 commit f049fe2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
25 changes: 9 additions & 16 deletions MMM-Fitbit2.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,17 @@ Module.register("MMM-Fitbit2", {
}
},

getData: function(trigger) {
payload = {};
payload.config = this.config;
payload.trigger = trigger;
this.sendSocketNotification("GET DATA", payload);
},

// Initialisation
start: function() {
Log.info("Starting module: " + this.name);
getDataPayload = {}

config = {}
config.clientId = this.config.credentials.clientId
config.clientSecret = this.config.credentials.clientSecret
config.resources = this.config.resources
config.debug = this.config.debug
config.test = this.config.test

getDataPayload.config = config
getDataPayload.trigger = "Initial"
this.sendSocketNotification("GET DATA", getDataPayload);
this.getData("Initial");

this.fadeSpeed = 500;

Expand All @@ -134,10 +130,7 @@ Module.register("MMM-Fitbit2", {

// Updates the data from fitbit
updateData: function() {
getDataPayload = {}
getDataPayload.config = this.config.resources
getDataPayload.trigger = "Update"
this.sendSocketNotification("GET DATA", getDataPayload);
this.getData("Update");
},

// Checks whether the user wants to lookup a resource type
Expand Down
4 changes: 2 additions & 2 deletions node_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ module.exports = NodeHelper.create({
pyArgs.push("--test")
}

pyArgs.push(config.clientId)
pyArgs.push(config.clientSecret)
pyArgs.push(config.credentials.clientId)
pyArgs.push(config.credentials.clientSecret)

pyArgs.push("--resources")
pyArgs = pyArgs.concat(config.resources)
Expand Down

0 comments on commit f049fe2

Please sign in to comment.