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

    Posts

    Recent Best Controversial
    • RE: MMM-MealViewer

      Mmmm… not working yet…
      My current node_helper.js:

      const NodeHelper = require('node_helper');
      const request = require('request');
      
      module.exports = NodeHelper.create({
      
          start: function() {
              console.log("Starting node_helper for: " + this.name);
          },
      	
      	// Changes XML to JSON
      	xmlToJson: function(xml) {
      		
      		// Create the return object
      		var obj = {};
      
      		if (xml.nodeType == 1) { // element
      			// do attributes
      			if (xml.attributes.length > 0) {
      			obj["@attributes"] = {};
      				for (var j = 0; j < xml.attributes.length; j++) {
      					var attribute = xml.attributes.item(j);
      					obj["@attributes"][attribute.nodeName] = attribute.nodeValue;
      				}
      			}
      		} else if (xml.nodeType == 3) { // text
      			obj = xml.nodeValue;
      		}
      
      		// do children
      		if (xml.hasChildNodes()) {
      			for(var i = 0; i < xml.childNodes.length; i++) {
      				var item = xml.childNodes.item(i);
      				var nodeName = item.nodeName;
      				if (typeof(obj[nodeName]) == "undefined") {
      					obj[nodeName] = xmlToJson(item);
      				} else {
      					if (typeof(obj[nodeName].push) == "undefined") {
      						var old = obj[nodeName];
      						obj[nodeName] = [];
      						obj[nodeName].push(old);
      					}
      					obj[nodeName].push(xmlToJson(item));
      				}
      			}
      		}
      		return obj;
      	},
      		
      	
      	getMTVM: function(url) {
      		request(url, function(err, res, body) {
      		// if no error and server was happy
      			if(err == null && res.statusCode ==200){
      			console.log(body);
      			var json_data = this.xmlToJson(body)
      			console.log("Text is " + json_data.film[0].titel)
      			}
      		});
      	},
      
      
          socketNotificationReceived: function(notification, payload) {
              if (notification === 'GET_MTVM') {
                  this.getMTVM(payload);
              }
          }
      });
      
      

      In the dev console I get an error:

      Whoops! There was an uncaught exception...
      TypeError: this.xmlToJson is not a function
      
      posted in Development
      htilburgsH
      htilburgs
    • RE: MMM-MealViewer

      So in my case the URL produces:

      0_1576260496007_7fa5a24c-528a-4697-9557-2a9058df2860-image.png image url)

      json_data.SD[0].SPEED@attributes.TEXT will be:

      json.data.film[0].titel    --> 'Bellicher: Cel'
      

      Correct?

      posted in Development
      htilburgsH
      htilburgs
    • RE: MMM-MealViewer

      @sdetweil , I’ve found them, but I don’t know how to use it in combination with the URL that creates the XML.

      Indeed the last one with no extra libs looks promising. I tried to simply add this in the node_helper.js but getting stuck at how to use it.
      I’ve looked into all the MMM Modules but cannot seem to find an example.

      posted in Development
      htilburgsH
      htilburgs
    • RE: MMM-MealViewer

      @cowboysdude, I’m looking for the part where you “change” the XML data to JSON data. I’m trying to write a new MMM, but the data is presented in XML. I like the have it in JSON, so I can use it.

      Maybe I read over it, but I cannot figure out where you do this.

      posted in Development
      htilburgsH
      htilburgs
    • RE: MMM-MyTraffic

      Because this is an english forum, I prefer to speak english ;-)
      The problem is unknown to me. I’ve tried it several times, but it’s loading within a few seconds.

      Maybe you didn’t apply filters in the roads?
      Then it’s trying to load the complete list.

      posted in Utilities
      htilburgsH
      htilburgs
    • RE: MMM-MyTraffic

      @timm-rombouts, currently not.
      I’m working on a new release, but due to not having a lot of time, it’s taking me more time.

      posted in Utilities
      htilburgsH
      htilburgs
    • RE: MMM-MyPrayerTimes

      @zam many thanks and ramadan mubarak!

      posted in Utilities
      htilburgsH
      htilburgs
    • RE: MMM-MyTraffic

      @Caimin I see what you mean. I will take a look at it in a few days. Currently I’m having a short leave with the family.

      posted in Utilities
      htilburgsH
      htilburgs
    • RE: Where are you from?

      Eindhoven, Netherlands.
      Home town of PSV and Philips.

      posted in General Discussion
      htilburgsH
      htilburgs
    • RE: Motion Sensor/PIR

      @BandNerd1002
      If you understand Dutch :winking_face:
      I din’t use a MM Module, because that didn’t work for me. I like the mirror to blank even if MM is not running. So I use this alternative Python script.

      http://magicmirror.tilburgs.com/pir-configuratie/

      posted in Troubleshooting
      htilburgsH
      htilburgs
    • 1 / 1