Read the statement by Michael Teeuw here.
[MMM-FlightsAbove] Problem receiving and seing JSON from node_helper
-
@yawns That is not correct.
console.log()
works fine in your module. But the output is not shown on the log of your mirror but on the browser’s log. You need to open the developer tools in your browser to see it. -
Oh, really? Maybe this was changed, in the beginning it wasn’t working at all in the main module file.
-
@E3V3A This function works just fine:
radarPing: function () { radar(53.05959, 12.52388, 51.98161, 14.29552) .then((flights) => { this.sendSocketNotification("NEW_DATA", flights); //self? console.log("New radar data: "); console.log(flights); }) .catch(function (error) { //console.log("ERROR:") console.log(error); }); },
It receives data, prints them on the mirror’s log and sends it to the module. The module is receiving the data and logs them to the browser’s console. And your table is populated too.
-
-
@E3V3A
console.log()
is a standard Javascript function it works anywhere.Log.info()
and so on are functions from the MagicMirror’s module system. So they will only work in the module file.node_helper.js
is executed in the server context. Any console output is therefore on the server’s log.The module file is executed in the client context (the browser). So console output from the module file is logged in the browser console.
-
@raywo OMG!! I missed your post by not updating my open tabs. Now I found it and it bloody hell it works! I got so excited I fell off my chair!
I have no idea why the eeek I have been trying to over-engineer this thing. I guess I’m simply not familiar enough with the JS/node notations, and constantly get bogged down with beginners conceptual trivialities.
Thank you! Tomorrow it will be party!
-
@yawns BTW. The
console.log
from main module didn’t want to work in my Firefox (Dev Tools), butconsole.error()
do. It could be a browser issue… -
The module is now working and alive!! Thank you all for all your patience!!