ianperrin / MMM-NetworkScanner

A module for MagicMirror which determines the status of devices on the network based on their MAC or IP address

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KeepAlive not working properly ?

ThijsVredenbregt opened this issue · comments

commented

keepAlive: how long (in seconds) a device should be considered 'alive' since it was last found on the network

It appears that after every updateInterval all devices that are not detected are set as offline (dimmed). I would expect devices that had previously been detected (within keepAlive time window) to be displayed as not-dimmed even though they were not found during the last scan.

Example:
keepAlive: 300 seconds
updateInterval: 15 seconds
My phone got detected 20 seconds ago. In the first scan it got detected and displayed as online (not-dimmed). During the second scan my phone was not online and did not get detected, even though it is within the keepAlive time period my phone will get displayed as offline (dimmed)

Am i misunderstanding how keepAlive works ?

Here is my config:
config: {
devices: [
{ macAddress: "--:--:--:--:--:--", name: "Thijs", icon: "mobile"},
{ macAddress: "--:--:--:--:--:--", name: "Name", icon: "mobile"},
{ macAddress: "--:--:--:--:--:--", name: "Name", icon: "mobile"},
{ macAddress: "--:--:--:--:--:--", name: "Name", icon: "mobile"},
],
showUnknown: false,
showOffline: true,
showLastSeen: true,
keepAlive: 300,
updateInterval: 15,
residents: ["Thijs","Name","Name","Name"],
occupiedCMD: {},
vacantCMD: {},
}

I am experiencing the same issue. my keep alive is set for 3 minutes (the default) but my phone goes offline within 10 seconds (my updateInterval duration).

commented

I'm a bit disappointed in the support we are getting, after almost one month still no answer from the developer.

DISCLAIMER im a backend developer (java, c#) so i know my way around but am not an expert on JS
I dove into the code and saw that device.lastSeen (MMM-NetworkScanner.js#L194) is not always present for devices that have been seen earlier. The config property (self.config.showLastSeen) does seem to be working accordingly.

pretty sure there was another post by dev saying he didnt have time and would gladly have someone else take up the project.

commented

pretty sure there was another post by dev saying he didnt have time and would gladly have someone else take up the project.

He should put that on the front README page with big letters!

I'm having the same issue and I'd love to see a resolution. This is one of my favorite MM modules and I'd hate to see it be abandoned.

@ThijsVredenbregt

It appears that after every updateInterval all devices that are not detected are set as offline (dimmed).

That's exactly what's happening, as you can see here. There's no local cache of lastSeen times for each mac address.

I'm just discovering this module but I plan to install later tonight and I'll start fooling around with it. Unfortunately this is not a one-line fix and actually requires a some restructuring. I'll do what I can and keep everyone posted.

@kyle-kelly my fork has this fixed, but also includes a lot of other changes. I've been meaning to open a PR for a bit now, but I'm doubtful it would ever get merged.

@leveneg Awesome! Lol I started looking at your fork earlier and was about to link it here.

I'll definitely grab yours then. You might want to issue the PR just for the sake of preservation.

Please do issue it, @leveneg . I would love to see some updates to this module. I use it a lot and would really enjoy some of this little fixes.

Fair enough. I'll see if I can't get something up before too long here.

commented

@leveneg @kyle-kelly - really pleased you both have picked this up. I simply haven’t had the opportunity to give my MagicMirror any time in the last 12 months.

Submit PR and I will merge them.

Thanks again

KeepAlive seems to be not working again, does anyone else have this issue?

@Jord7529 is it the same breakage noted in the original issue?

Yes so my device will show up in the list and will then disappear after 5 seconds which is my Update Interval timing. I did try the config above and also from the PR but that seamed to not work either