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.

    MMM-NetworkScanner-loading...indefinitely

    Scheduled Pinned Locked Moved Solved Troubleshooting
    54 Posts 6 Posters 18.7k Views 7 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.
    • S Do not disturb
      sdetweil @jthirasilpa
      last edited by sdetweil

      @jthirasilpa said in MMM-NetworkScanner-loading...indefinitely:

      SyntaxError: Unexpected token ;

      sorry, take off the ‘;’ after the actual password

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      1 Reply Last reply Reply Quote 0
      • J Offline
        jthirasilpa
        last edited by

        Thanks - see error log below

        [22:23:34.736] [ERROR] ReferenceError: options is not defined
        at Class.scanNetworkMAC (/home/jojo/MagicMirror/modules/MMM-NetworkScanner/node_helper.js:42:54)
        at Class.socketNotificationReceived (/home/jojo/MagicMirror/modules/MMM-NetworkScanner/node_helper.js:29:18)
        at Socket. (/home/jojo/MagicMirror/js/node_helper.js:113:11)
        at Socket.emit (events.js:198:13)
        at /home/jojo/MagicMirror/node_modules/socket.io/lib/socket.js:528:12
        at process._tickCallback (internal/process/next_tick.js:61:11)
        [22:24:03.590] [ERROR] TypeError: Cannot read property ‘network’ of undefined
        at Class.scanNetworkMAC (/home/jojo/MagicMirror/modules/MMM-NetworkScanner/node_helper.js:45:36)
        at Class.socketNotificationReceived (/home/jojo/MagicMirror/modules/MMM-NetworkScanner/node_helper.js:29:18)
        at Socket. (/home/jojo/MagicMirror/js/node_helper.js:113:11)
        at Socket.emit (events.js:198:13)
        at /home/jojo/MagicMirror/node_modules/socket.io/lib/socket.js:528:12
        at process._tickCallback (internal/process/next_tick.js:61:11)
        [22:24:05.534] [ERROR] TypeError: Cannot read property ‘network’ of undefined
        at Class.scanNetworkMAC (/home/jojo/MagicMirror/modules/MMM-NetworkScanner/node_helper.js:45:36)
        at Class.socketNotificationReceived (/home/jojo/MagicMirror/modules/MMM-NetworkScanner/node_helper.js:29:18)
        at Socket. (/home/jojo/MagicMirror/js/node_helper.js:113:11)
        at Socket.emit (events.js:198:13)
        at /home/jojo/MagicMirror/node_modules/socket.io/lib/socket.js:528:12
        at process._tickCallback (internal/process/next_tick.js:61:11)

        S 1 Reply Last reply Reply Quote 0
        • S Do not disturb
          sdetweil @jthirasilpa
          last edited by

          @jthirasilpa said in MMM-NetworkScanner-loading...indefinitely:

          [22:23:34.736] [ERROR] ReferenceError: options is not defined

          but you added the 4 lines, right?

          var options = {              
              cachePassword: true,
              prompt: 'Password, ???? '     // put your password where ???? are (notice the quotes around)
          }
          

          and then the updated line

           var arp = sudo(['arp-scan', '-q', arpHosts], options);    
          

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • karsten13K Offline
            karsten13
            last edited by

            what is the result of sudo arp-scan -l running on your machine?

            J 1 Reply Last reply Reply Quote 0
            • S Do not disturb
              sdetweil @jthirasilpa
              last edited by sdetweil

              @jthirasilpa just do this… get my version of the module

              cd ~/MagicMirror/modules
              mv MMM-NetworkScanner MMM-NetworkScanner.original
              git clone https://github.com/sdetweil/MMM-NetworkScanner
              cd MMM-NetworkScanner
              npm install
              cd ~/MagicMirror/config
              nano config.js
              

              add the following line to the config section of the network scanner module

              Password: '??????',    // where '?????' is you password in quotes, for example 'raspberry', note the trailing comma
              

              ctrl-o at save the config.js
              ctrl-x to exit nano

              Restart your MM

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              J 1 Reply Last reply Reply Quote 1
              • J Offline
                jthirasilpa @sdetweil
                last edited by

                @sdetweil
                Thanks Sam - tried your version of the module and modified the config.js accordingly. Still not quite working. Error logs as follows:

                0|mm       |     at process._tickCallback (internal/process/next_tick.js:61:11)
                0|mm       | [09:41:25.508] [ERROR]  ReferenceError: options is not defined
                0|mm       |     at Class.scanNetworkMAC (/home/jojo/MagicMirror/modules/MMM-NetworkScanner/node_helper.js:42:54)
                0|mm       |     at Class.socketNotificationReceived (/home/jojo/MagicMirror/modules/MMM-NetworkScanner/node_helper.js:29:18)
                0|mm       |     at Socket.<anonymous> (/home/jojo/MagicMirror/js/node_helper.js:113:11)
                0|mm       |     at Socket.emit (events.js:198:13)
                0|mm       |     at /home/jojo/MagicMirror/node_modules/socket.io/lib/socket.js:528:12
                0|mm       |     at process._tickCallback (internal/process/next_tick.js:61:11)
                0|mm       | [09:41:55.508] [ERROR]  ReferenceError: options is not defined
                0|mm       |     at Class.scanNetworkMAC (/home/jojo/MagicMirror/modules/MMM-NetworkScanner/node_helper.js:42:54)
                0|mm       |     at Class.socketNotificationReceived (/home/jojo/MagicMirror/modules/MMM-NetworkScanner/node_helper.js:29:18)
                0|mm       |     at Socket.<anonymous> (/home/jojo/MagicMirror/js/node_helper.js:113:11)
                0|mm       |     at Socket.emit (events.js:198:13)
                0|mm       |     at /home/jojo/MagicMirror/node_modules/socket.io/lib/socket.js:528:12
                0|mm       |     at process._tickCallback (internal/process/next_tick.js:61:11)
                
                S 1 Reply Last reply Reply Quote 0
                • S Do not disturb
                  sdetweil @jthirasilpa
                  last edited by

                  @jthirasilpa hm… can u show me show me these lines from node_helper.js

                  scanNetworkMAC: function() {
                          this.log(this.name + " is performing arp-scan");
                  
                          var self = this;
                          // Target hosts/network supplied in config or entire localnet
                          var arpHosts = this.config.network || '-l';
                  				var options = {              
                  						cachePassword: true,
                  						prompt: 'Password,' + this.config.Password     // put your password where ???? are (notice the quotes around)
                  				}
                          var arp = sudo(['arp-scan', '-q', arpHosts], options);
                  

                  I tested here with three different addresses… some coming online later… worked, no errors…

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  J 1 Reply Last reply Reply Quote 0
                  • J Offline
                    jthirasilpa @karsten13
                    last edited by

                    @karsten13
                    Hi - it seems to function correctly - it returns the IP and MAC addresses of the various clients on the network.

                    1 Reply Last reply Reply Quote 0
                    • J Offline
                      jthirasilpa @sdetweil
                      last edited by

                      @sdetweil
                      I tried it both ways - but should the ‘password’ field in the helper file be filled in?

                      S 1 Reply Last reply Reply Quote 0
                      • S Do not disturb
                        sdetweil @jthirasilpa
                        last edited by sdetweil

                        @jthirasilpa no… use the config.js

                        the reference to the options variable should be from line 47, not 42…

                        so, something is wrong with the code u have in node_helper.js

                        did u follow my steps above exactly?

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        1 Reply Last reply Reply Quote 0
                        • J Offline
                          jthirasilpa
                          last edited by

                          Sorry I’m not being clear. I know that I need to modify the config.js (and have done so), but in line 45 of node_helper.js (as shown below) there is:

                           prompt: 'Password,' + this.config.Password     // put your password where ???? are (notice the quotes around)
                          

                          Should I leave this as is or fill in the password? That is where I have tried it both ways.

                          Code you asked for from node_helper.js:

                              scanNetworkMAC: function() {
                           38         this.log(this.name + " is performing arp-scan");
                           39
                           40         var self = this;
                           41         // Target hosts/network supplied in config or entire localnet
                           42         var arpHosts = this.config.network || '-l';
                           43                                 var options = {
                           44                                                 cachePassword: true,
                           45                                                 prompt: 'Password,' + this.config.Password     // put your password where ???? are (notice the quotes around)
                           46                                 }
                           47         var arp = sudo(['arp-scan', '-q', arpHosts], options);
                          
                          S 1 Reply Last reply Reply Quote 0
                          • S Do not disturb
                            sdetweil @jthirasilpa
                            last edited by

                            @jthirasilpa oh, i see I should have removed the comment… you do not need to change any code…

                            but the error does not match the code u are running now…

                            please do

                            pm2 stop 0
                            pm2 flush
                            pm2 start 0
                            pm2 logs
                            

                            that error must have been from yesterday

                            Sam

                            How to add modules

                            learning how to use browser developers window for css changes

                            1 Reply Last reply Reply Quote 0
                            • J Offline
                              jthirasilpa
                              last edited by

                              Hmm

                              So with the password entered only in the config file, the error output still references line 42

                               var arpHosts = this.config.network || '-l';
                              

                              Error output:

                              0|mm       | [19:37:36.956] [ERROR]  TypeError: Cannot read property 'network' of undefined
                              0|mm       |     at Class.scanNetworkMAC (/home/jojo/MagicMirror/modules/MMM-NetworkScanner/node_helper.js:42:36)
                              0|mm       |     at Class.socketNotificationReceived (/home/jojo/MagicMirror/modules/MMM-NetworkScanner/node_helper.js:30:18)
                              0|mm       |     at Socket.<anonymous> (/home/jojo/MagicMirror/js/node_helper.js:113:11)
                              0|mm       |     at Socket.emit (events.js:198:13)
                              0|mm       |     at /home/jojo/MagicMirror/node_modules/socket.io/lib/socket.js:528:12
                              0|mm       |     at process._tickCallback (internal/process/next_tick.js:61:11)
                              
                              0|mm  | [19:37:50.982] [LOG]    MMM-NetworkScanner received SCAN_NETWORK
                              0|mm  | [19:37:50.983] [LOG]    MMM-NetworkScanner is performing arp-scan
                              0|mm  | [19:37:50.984] [LOG]    Whoops! There was an uncaught exception...
                              0|mm  | [19:37:50.984] [ERROR]
                              0|mm  | TypeError: Cannot read property 'network' of undefined
                              0|mm  |     at Class.scanNetworkMAC (/home/jojo/MagicMirror/modules/MMM-NetworkScanner/node_helper.js:42:36)
                              0|mm  |     at Class.socketNotificationReceived (/home/jojo/MagicMirror/modules/MMM-NetworkScanner/node_helper.js:30:18)
                              0|mm  |     at Socket.<anonymous> (/home/jojo/MagicMirror/js/node_helper.js:113:11)
                              0|mm  |     at Socket.emit (events.js:198:13)
                              0|mm  |     at /home/jojo/MagicMirror/node_modules/socket.io/lib/socket.js:528:12
                              0|mm  |     at process._tickCallback (internal/process/next_tick.js:61:11)
                              0|mm  | [19:37:50.985] [LOG]
                              0|mm  | MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
                              0|mm  | [19:37:50.986] [LOG]    If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
                              0|mm  | [19:38:21.046] [LOG]
                              0|mm  | MMM-NetworkScanner received SCAN_NETWORK
                              0|mm  | [19:38:21.047] [LOG]
                              0|mm  | MMM-NetworkScanner is performing arp-scan
                              0|mm  | [19:38:21.048] [LOG]    Whoops! There was an uncaught exception...
                              0|mm  | [19:38:21.048] [ERROR]
                              0|mm  | TypeError: Cannot read property 'network' of undefined
                              0|mm  |     at Class.scanNetworkMAC (/home/jojo/MagicMirror/modules/MMM-NetworkScanner/node_helper.js:42:36)
                              0|mm  |     at Class.socketNotificationReceived (/home/jojo/MagicMirror/modules/MMM-NetworkScanner/node_helper.js:30:18)
                              0|mm  |     at Socket.<anonymous> (/home/jojo/MagicMirror/js/node_helper.js:113:11)
                              0|mm  |     at Socket.emit (events.js:198:13)
                              0|mm  |     at /home/jojo/MagicMirror/node_modules/socket.io/lib/socket.js:528:12
                              0|mm  |     at process._tickCallback (internal/process/next_tick.js:61:11)
                              
                              S 1 Reply Last reply Reply Quote 0
                              • S Do not disturb
                                sdetweil @jthirasilpa
                                last edited by sdetweil

                                @jthirasilpa said in MMM-NetworkScanner-loading...indefinitely:

                                0|mm | [19:37:36.956] [ERROR] TypeError: Cannot read property ‘network’ of undefined
                                0|mm | at Class.scanNetworkMAC (/home/jojo/MagicMirror/modules/MMM-NetworkScanner/node_helper.js:42:36)

                                Ok, but not ‘options’…

                                now, to check, this system is case sensitive… so in config.js it MUST look like this, right?

                                            keepAlive: 300,
                                            updateInterval: 5,
                                	    Password: 'pi'                        // added password (note capital P)
                                        }
                                

                                using your password of course

                                Sam

                                How to add modules

                                learning how to use browser developers window for css changes

                                1 Reply Last reply Reply Quote 0
                                • J Offline
                                  jthirasilpa
                                  last edited by

                                  That is how the config looks.

                                  Still getting the node_helper line 42 error. Will park this for now. Thank you for spending so much time on this Sam - much appreciated. Will come back to this later in the week.

                                  S 1 Reply Last reply Reply Quote 0
                                  • S Do not disturb
                                    sdetweil @jthirasilpa
                                    last edited by

                                    @jthirasilpa update the current code

                                    cd ~MagicMirror/modules/MMM-NetworkScanner
                                    git pull
                                    

                                    then you can shutdown and restart the MM app

                                    there was a tiny timing gap where the config info is not yet set, when the helper is asked to scan the network…

                                    let me know

                                    Sam

                                    How to add modules

                                    learning how to use browser developers window for css changes

                                    J 1 Reply Last reply Reply Quote 0
                                    • O Offline
                                      OldSunGuy
                                      last edited by OldSunGuy

                                      Is it bad to have this?

                                      pi@raspberrypi ~ % sudo -l|grep NOPASS
                                          (ALL) NOPASSWD: ALL
                                      pi@raspberrypi ~ %
                                      

                                      Edit: To expand further, I have MMM-NetworkScanner running. I do not need to supply a password when I run sudo and I don’t have a password stored in a config file.

                                      1 Reply Last reply Reply Quote 0
                                      • J Offline
                                        jthirasilpa @sdetweil
                                        last edited by

                                        @sdetweil
                                        Hi Sam - thanks I tried the update. Still getting the same error - from the log:

                                        [19:00:49.868] [ERROR]  TypeError: Cannot read property 'network' of undefined
                                            at Class.scanNetworkMAC (/home/jojo/MagicMirror/modules/MMM-NetworkScanner/node_helper.js:42:36)
                                            at Class.socketNotificationReceived (/home/jojo/MagicMirror/modules/MMM-NetworkScanner/node_helper.js:30:18)
                                            at Socket.<anonymous> (/home/jojo/MagicMirror/js/node_helper.js:113:11)
                                            at Socket.emit (events.js:198:13)
                                            at /home/jojo/MagicMirror/node_modules/socket.io/lib/socket.js:528:12
                                            at process._tickCallback (internal/process/next_tick.js:61:11)
                                        
                                        S 1 Reply Last reply Reply Quote 0
                                        • S Do not disturb
                                          sdetweil @jthirasilpa
                                          last edited by

                                          @jthirasilpa do another git pull from my repo… and try again

                                          Sam

                                          How to add modules

                                          learning how to use browser developers window for css changes

                                          J 1 Reply Last reply Reply Quote 0
                                          • J Offline
                                            jthirasilpa @sdetweil
                                            last edited by

                                            @sdetweil
                                            Thanks Sam

                                            Tried update. Error log below:

                                            [11:45:29.130] [ERROR]  TypeError: Cannot read property 'network' of undefined
                                                at Class.scanNetworkMAC (/home/jojo/MagicMirror/modules/MMM-NetworkScanner/node_helper.js:46:36)
                                                at Class.socketNotificationReceived (/home/jojo/MagicMirror/modules/MMM-NetworkScanner/node_helper.js:33:18)
                                                at Socket.<anonymous> (/home/jojo/MagicMirror/js/node_helper.js:113:11)
                                                at Socket.emit (events.js:198:13)
                                                at /home/jojo/MagicMirror/node_modules/socket.io/lib/socket.js:528:12
                                                at process._tickCallback (internal/process/next_tick.js:61:11)
                                            

                                            Node_helper code:

                                                    // Target hosts/network supplied in config or entire localnet
                                             46         var arpHosts = self.config.network || '-l';
                                             47                                 var options = {
                                             48                                                 cachePassword: true,
                                             49                                                 prompt: 'Password,' + self.config.Password     // put your password where ???? are (notice the quotes around)
                                             50                                 }
                                             51         var arp = sudo(['arp-scan', '-q', arpHosts]) //, options);
                                            

                                            Module entry in config.js:

                                                            {
                                            139                         module:                 "MMM-NetworkScanner",
                                            140                         position:               "bottom_center",
                                            141                         header:                 "Devices Online",
                                            142                         config: {
                                            143                                 devices: [
                                            144                                 { ipAddress: "192.168.1.11", name: "Champagne", icon: "server"},
                                            145                                 { ipAddress: "192.168.1.15", name: "Millie", icon: "server"},
                                            146                                 { ipAddress: "192.168.1.17", name:  "Marmite", icon:  "server"}
                                            147                                 ],
                                            148                                 showUnknown: false,
                                            149                                 showOffline:  true,
                                            150                                 keepAlive:  600,
                                            151                                 showLastSeen:  true,
                                            152                                 updateInterval:  30,
                                            153                                 Password:  'xxxx'
                                            154                                 }
                                            155                 },
                                            
                                            S 1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 3
                                            • 2 / 3
                                            • First post
                                              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