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

    Posts

    Recent Best Controversial
    • RE: child_process won't execute

      @sdetweil thanks for the response. that doesn’t seem to be working either.
      Is there something I need to install to be able to use stdout?

      posted in Development
      T
      Temisola1
    • RE: Module creation workflow - Newbie

      @sdetweil How can I construct ModuleName as an html?

      posted in Development
      T
      Temisola1
    • child_process won't execute

      I’m trying to execute a python script using the child_process. However my function doesn’t seem to be triggering.

      const spawn = require("child_process").spawn
      var NodeHelper = require("node_helper")
      const process = spawn("python3", ["return_something.py"])
      
      module.exports = NodeHelper.create({
        start: function() {
          this.countDown = 10000000
        },
        socketNotificationReceived: function(notification, payload) {
            switch(notification){
                case "DO_YOUR_JOB":
                  console.log(payload)
                  this.sendSocketNotification("I_DID", (this.countDown - payload))
                  break
                case "RETRIEVE_DATA":
                  console.log(payload)
                  this.job()
                  break
            }
        },
        job: function(){
          console.log("I'm trying to retrieve data")
          process.stdout.on('data', (data)=>{
            //********everything works up till here
              console.log("inside")
            var result = String.fromCharCode.apply(null, new Uint16Array((data)))
            this.sendSocketNotification("DATA_RETRIEVED", result)
          })
        }
      })
      

      Python script.

      import sys
      
      print("Hello, I'm Amira")
      
      sys.stdout.flush()
      
      posted in Development
      T
      Temisola1
    • Module creation workflow - Newbie

      Hello all. I’m currently trying to build a custom module. I’ve been trying to wrap my head around it for a few days but I think I finally have a decent understanding. I’m not that familiar with node.js so my question might sound stupid. I understand that the MMM-ModuleName.js pretty much passes data or documents to the main html. Is it possible to have an html file with custom html already defined, a table of data for example, load it in your MMM-ModuleName.js using nodejs, modify the contents using the elementid and then pass that to the main html? As opposed to creating the html using nodejs. Again, I’m pretty green when it comes to nodejs please forgive me.

      posted in Development
      T
      Temisola1
    • 1 / 1