• 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.

skywriter - python to javascript

Scheduled Pinned Locked Moved Development
18 Posts 3 Posters 12.0k Views 3 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.
  • K Offline
    kclemen
    last edited by Dec 8, 2016, 6:36 PM

    Ok, the script is performing without any errors at the moment.

    Would somebody be so kind to check why console.log(“payload.action is up”); is not executed in MMM-skywriter.js?

    I only get the message from node-helper.js : console.log(“[” + self.name + "] " + message.gesture);

    Files can be found here: https://github.com/Kclemen/MMM-skywriter

    1 Reply Last reply Reply Quote 0
    • K Offline
      kclemen
      last edited by kclemen Dec 9, 2016, 2:03 PM Dec 9, 2016, 2:02 PM

      Node helper:
      self.sendSocketNotification('gesture', message.gesture);

      script:

      Module.register("MMM-skywriter",{
      	
      	//	gesture_up: 0,
      	//	gesture_right: 0,	
      
      	// Override socket notification handler.
      	socketNotificationReceived: function(notification, payload) {
      			console.log ("socketnotificationreceived.")
      		if (payload === "up"){
      			console.log("test - up");
      		}
      		else if (payload === "left"){
      			console.log("test - left");
      		}
      		else if (payload === "down") {
      			console.log("test - down");
      		}
      } ```
      
      Why is there no ccommunication between the helper and the script?	}
      J 1 Reply Last reply Dec 9, 2016, 3:38 PM Reply Quote -1
      • J Offline
        Jopyth Moderator @kclemen
        last edited by Jopyth Dec 9, 2016, 3:39 PM Dec 9, 2016, 3:38 PM

        @kclemen Are you searching for the output in your browser console? The console.log("...") command from node_helper.js is shown on the console, however console.log("...") commands of your module will appear in your developer tools console in the browser (e.g. electron).

        Helpful sticky: How to troubleshoot

        K 1 Reply Last reply Dec 9, 2016, 4:00 PM Reply Quote 1
        • K Offline
          kclemen @Jopyth
          last edited by kclemen Dec 9, 2016, 4:24 PM Dec 9, 2016, 4:00 PM

          @Jopyth said in skywriter - python to javascript:

          developer tools console in the browser (e.g. electron).

          Indeed, I want to see the output to verify the communication works.
          Could you elaborate some more about the developer tools console?

          ctrl + shift + i does the trick :)

          @Jopyth you are a HERO. Last 2 days working on it, antd the trick was that simple!

          J 1 Reply Last reply Dec 9, 2016, 4:52 PM Reply Quote 0
          • J Offline
            Jopyth Moderator @kclemen
            last edited by Dec 9, 2016, 4:52 PM

            @kclemen I was just pointing you in the right direction sometimes. ;) Best of luck with finishing the rest of the module.

            Helpful sticky: How to troubleshoot

            1 Reply Last reply Reply Quote 0
            • K Offline
              kclemen
              last edited by Dec 9, 2016, 5:10 PM

              ok, for now the last question ;):

              Uncaught reference error: gesture_up is not defined. I understand what this means, but I can’t figure out why it says that :s

              	
              	// Default module config.
              	defaults: {
              		gesture_up: 0,
              		gesture_right: 0,
              		
              	},
              
              	// Override socket notification handler.
              	socketNotificationReceived: function(notification, payload) {
              		if (notification === "gesture_observed"){
              			const self = this;
              			
              			console.log ("socketnotificationreceived.");
              		
              			//self.sendNotification(notification, payload);
              			
              			if (payload === "up"){
              				
              				if (gesture_up == 0) {
              					
              					if (gesture_up == 0){
              						gesture_up = gesture_up+1;
              						
              						console.log("gesture_up is nu 1");
              
              1 Reply Last reply Reply Quote 0
              • Y Offline
                yawns Moderator
                last edited by Dec 9, 2016, 5:50 PM

                Try this.config.gesture_up instead

                1 Reply Last reply Reply Quote 1
                • K Offline
                  kclemen
                  last edited by Dec 9, 2016, 9:22 PM

                  This helps indeed for the error, thanks. But how to use it like I want? I mean, how can you do calculations within following up socketnotifications? It looks like with every gesture the this.config;gesture_up starts with the value 0.

                  1 Reply Last reply Reply Quote 0
                  • 1
                  • 2
                  • 2 / 2
                  2 / 2
                  • First post
                    12/18
                    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