MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. blaukon
    3. Topics
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    B
    Offline
    • Profile
    • Following 0
    • Followers 1
    • Topics 3
    • Posts 18
    • Groups 0

    Topics

    • B

      2nd mirror! 175x45cm

      Watching Ignoring Scheduled Pinned Locked Moved Show your Mirror
      7
      5 Votes
      7 Posts
      3k Views
      FoziF
      That’s a really great build! Congrats! I like the (physical) mail notification and pickup idea very much. So please keep us in the loop with how it works out,
    • B

      MagicMirror project for sister

      Watching Ignoring Scheduled Pinned Locked Moved Show your Mirror
      32
      4 Votes
      32 Posts
      15k Views
      B
      @stro voice responses are downloaded from google translate :-) http://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&q=hey, how are you&tl=En-us
    • B

      Multiple requests within one function

      Watching Ignoring Scheduled Pinned Locked Moved Troubleshooting
      4
      0 Votes
      4 Posts
      2k Views
      B
      yeey, I got it working, although I don’t know why :P var NodeHelper = require("node_helper"); var request = require('request'); var Promise = require("promise"); var result = new Array(); module.exports = NodeHelper.create({ start: function() { console.log("Starting node_helper for module [" + this.name + "]"); }, // subclass socketNotificationReceived socketNotificationReceived: function(notification, payload){ if (notification === 'get_values') { this.getJSON(payload); } }, requestp: function(url, key, name) { return new Promise(function (resolve, reject) { request({url:url, method: 'GET'}, function (err, res, body) { if (err) { return reject(err); } else if (res.statusCode !== 200) { err = new Error("Unexpected status code: " + res.statusCode); err.res = res; return reject(err); } result.push({url: url, name: name, temp: body}); resolve(body); }); }); }, getJSON: function(object) { var self = this; for (var key in object) { //console.log(object[key]); self.requestp(object[key].url, key, object[key].name).then(function (info) { //console.log(info); }, function (err) { console.error("%s; %s", err.message, url); console.log("%j", err.res.statusCode); }); } //console.log(result); self.sendSocketNotification('received_values', result); result = []; } }); I wasn’t able to add a “temp” property to the original object - it was actually added, but it did not want to work outside the .then function :(
    • 1 / 1