Read the statement by Michael Teeuw here.
MMM-NetworkScanner
-
@BenNewsome Thank you for the reply! I increased the interval as you suggested, and reverted a change I forgot I made to the .js, which got things going.
I remembered I altered the code to show: “Robert - Last seen 23 minutes ago”.
This has been working really nicely except when one of the devices is not online at module load time … My lack of JS skills catching up with me.
//Name deviceItem.innerHTML += (device.name ? device.name + ". Last seen " + device.lastSeen.fromNow(): device.macAddress ) ;
I reverted to the original code and all is back to working, I’ll need to work on troubleshooting the “last seen” functionality to keep working if a device has not yet been seen. (if you see anything obvious, a penny for your thoughts!)
Thanks again
-
@outjet i guess the problem is that you try to access
device.lastSeen.fromNow()
this will probably result in cannot run method fromNow of undefined -
@BenNewsome Hi Ben - I’m commited elsewhere at the moment so sorry for not getting back to you sooner. Thanks for the pull request - I’ve accepted it and merged it into the module for all to share!
-
@outjet I’ve not been able to spend much time on the Mirror (or this module) recently but I’ve just updated the module to include @BenNewsome’s additional functionality along with a
showLastSeen
optionCan you try updating your module and adding this to your config.js file e.g.
showLastSeen: true,
-
This was working great for me until the latest git pull. I am getting the following errors now.
mm-0 (err): at Function.Module._resolveFilename (/home/pi/MagicMirror/node_modules/electron-prebuilt/dist/resources/electron.asar/common/reset-search-paths.js:35:12)
mm-0 (err): at Function.Module._load (module.js:403:25)
mm-0 (err): at Module.require (module.js:483:17)
mm-0 (err): at require (internal/module.js:20:19)
mm-0 (err): at Object. (/home/pi/MagicMirror/modules/MMM-NetworkScanner/node_helper.js:10:14)
mm-0 (err): at Module._compile (module.js:556:32)
mm-0 (err): at Object.Module._extensions…js (module.js:565:10)
mm-0 (err): at Module.load (module.js:473:32)
mm-0 (err): at tryModuleLoad (module.js:432:12)
mm-0 (err): { Error: Cannot find module ‘ping’
mm-0 (err): at Module._resolveFilename (module.js:455:15)
mm-0 (err): at Function.Module._resolveFilename (/home/pi/MagicMirror/node_modules/electron-prebuilt/dist/resources/electron.asar/common/reset-search-paths.js:35:12)
mm-0 (err): at Function.Module._load (module.js:403:25)
mm-0 (err): at Module.require (module.js:483:17)
mm-0 (err): at require (internal/module.js:20:19)
mm-0 (err): at Object. (/home/pi/MagicMirror/modules/MMM-NetworkScanner/node_helper.js:10:14)
mm-0 (err): at Module._compile (module.js:556:32)
mm-0 (err): at Object.Module._extensions…js (module.js:565:10)
mm-0 (err): at Module.load (module.js:473:32)
mm-0 (err): at tryModuleLoad (module.js:432:12) code: ‘MODULE_NOT_FOUND’ } -
@ianperrin No problem, thanks for the great module(s). I hope I accidentally didn’t break anything as I’m pretty new to Node.
-
@pugsly Sorry thats from my update. Have you done a NPM install inside the module as it has a new dependency?
Hopefully this will fix the problem.
-
@BenNewsome yes I did
-
@BenNewsome I see that it installed two things under \Magicmirror\modules\MMM-NetworkScanner\node_modules
one dir called ping which is what the error says it can’t find
the other called sudo (that one kinda worries me).Anyway it still doesn’t work.
-
@pugsly Hi pugsly,
sudo is for arp-scan which is the MAC address checker as this requires sudo to be called.Ping is the one I added which just calls the ping command from node.
Could you try editing the file:
/home/pi/MagicMirror/modules/MMM-NetworkScanner/node_helper.js
On line 10 it says
const ping = require('ping')
Could you replace it with:
const ping = require("ping");
(Change the speach marks and add a semicolon.)
I have no idea if this is the reason as it works fine on my system, but it is my current best guess.