MMM-NetworkScanner icon indicating copy to clipboard operation
MMM-NetworkScanner copied to clipboard

Fix bug when both showOffline and showUnknown is enabled

Open O5ten opened this issue 6 years ago • 7 comments

I have a lot of machines in the house aswell as airbnb-guests coming and going with devices so i want to keep track of who is in and not. With this module i was expecting that both showOffline and showUnknown works together to show offline mac-adresses aswell as unknown machines.

So i noticed that it wasn't, so if i turned off showing offline units with showOffline: false then mac-adresses for unknowns were showing up. So i started digging and it turned out that the part that was setting the offline-status were only mapping through the configured devices. It saved only them when creating the new state if showOffline was enabled. The same behavior can still be enabled but by using showUnknown: false of course.

Instead we now add the missing configured devices to the nextState and loop over that collection instead.This allows us to have both settings enabled at the same time as in the example below.

Example with one machine Cybercom turned off and one machine unconfigured machines

O5ten avatar May 22 '18 21:05 O5ten

@ianperrin no longer actively maintaining the project perhaps?

O5ten avatar Jun 08 '18 08:06 O5ten

@O5ten - @E3V3A and myself have put a fair amount of effort into the module recently to restore and improve functionality, so it’s definately not abandoned. However, given other commitments I cannot continually work on the module so efforts are sporadic.

Thanks for your pull request. Can you confirm you have tested your changes with various combinations of config options using both MAC addresses and IP addresses?

ianperrin avatar Jun 10 '18 17:06 ianperrin

Yes, i have tested the various combinations of showOffline and showUnknown with devices defined with MacAddress configuration as that is the only type of device that is affected by those configuration options.

I'm fairly confident that i haven't broken anything as this is used and inspected daily in my own mirror. But then again, it's hard to be sure without proper tests. :)

O5ten avatar Jun 10 '18 19:06 O5ten

Great, thanks.

If you can give me sometime to test the changes with ipAddresses before accepting the pull request, that would be appreciated.

If you want to write some tests...

On 10 Jun 2018, at 20:04, Mikael Östberg [email protected] wrote:

Yes, i have tested the various combinations of showOffline and showUnknown with devices defined with MacAddress configuration as that is the only type of device that is affected by those configuration options.

I'm fairly confident that i haven't broken anything as this is used and inspected daily in my own mirror. But then again, it's hard to be sure without proper tests. :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

ianperrin avatar Jun 11 '18 06:06 ianperrin

No problem, i'll look into how testing is intended to be made in MagicMirror and give it a go.

O5ten avatar Jun 11 '18 06:06 O5ten

@O5ten - I haven't found a common testing approach for MM modules. However I have now set up Travis CI in the master branch. It's currently failing due to a number of lifting issues but the concept is there certainly to test the node helper file. Feel free to take a look.

ianperrin avatar Jun 18 '18 07:06 ianperrin

@ianperrin @O5ten Hi Guys! Sorry I've been too busy lately, with no time at all for MM stuff. Not sure how long this will be until I can get a chance to have look at this again. This PR look like a good improvement though... but need testing -- of course.

E3V3A avatar Jun 20 '18 10:06 E3V3A

I'll just close this as 6 years seems a bit excessive for testing. :)

O5ten avatar Mar 11 '24 14:03 O5ten