Read the statement by Michael Teeuw here.
skywriter - python to javascript
-
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
-
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? }
-
@kclemen Are you searching for the output in your browser console? The
console.log("...")
command fromnode_helper.js
is shown on the console, howeverconsole.log("...")
commands of your module will appear in your developer tools console in the browser (e.g. electron). -
@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!
-
@kclemen I was just pointing you in the right direction sometimes. ;) Best of luck with finishing the rest of the module.
-
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");
-
Try
this.config.gesture_up
instead -
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.