• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

help converting code for module...

Scheduled Pinned Locked Moved Development
21 Posts 4 Posters 7.2k Views 4 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    A Former User @justjim1220
    last edited by Oct 30, 2018, 8:24 AM

    @justjim1220

    
    const exec = require('child_process').exec
    var NodeHelper = require("node_helper")
    
    module.exports = NodeHelper.create({
      socketNotificationReceived: function(noti, payload) {
        if (noti == "GIVE_ME_RESULT") {
          setTimeout(()=>{
            exec("C:\WINDOWS\system32\get-temperature", //I don't know WINDOWS system at all. Is it right?
              (err, sto, ste) => {
                if (!err) {
                  this.sendSocketNotification("HERE_IS_RESULT", sto)
                } else {
                  console.log("Error", err)
                }
              }
            )
          }, 1000)
        }
      }
    })
    

    It isn’t tested. But you can catch the idea.

    1 Reply Last reply Reply Quote 1
    • 1
    • 2
    • 3
    • 3 / 3
    3 / 3
    • First post
      21/21
      Last post
    Enjoying MagicMirror? Please consider a donation!
    MagicMirror created by Michael Teeuw.
    Forum managed by Sam, technical setup by Karsten.
    This forum is using NodeBB as its core | Contributors
    Contact | Privacy Policy