charliegerard / whereami.js

Node.js module to predict indoor location using machine learning and WiFi information πŸ“Ά
GNU General Public License v3.0
357 stars 17 forks source link

UnhandledPromiseRejectionWarning #3

Open imagineering-uk opened 3 years ago

imagineering-uk commented 3 years ago

Hey Charlie, wonder if you can help with this....

simon@Simons-Air whereami.js % node server.js -p
(node:10796) UnhandledPromiseRejectionWarning: TypeError: Cannot set property 'room' of undefined at /Users/simon/Documents/Projects/whereami.js/predict.js:99:53 at Array.map () at predict (/Users/simon/Documents/Projects/whereami.js/predict.js:99:22) (Use node --trace-warnings ... to show where the warning was created) (node:10796) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:10796) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Room command works fine.....

simon@Simons-Air whereami.js % node server.js rooms
backroom bathroom hall kitchen lounge mainbedroom

Recent installation of the repo. MacBook Air 2020 11.2.3 (BigSur)

Any help would be appreciated. Thankyou

charliegerard commented 3 years ago

Hey!

I was able to reproduce this issue when using data recorded in an environment with different wifi networks from the one i'm currently in.

Could you double check if the wifi network you are connected to when using the predict command is included in your training data networks? They should be found in the whereamijs-data folder generated when training locations πŸ™‚

If it's not in there, you will probably need to delete the whereamijs-data folder and retrain locations.

Please let me know if this is the issue so I can publish a fix for this πŸ™‚

Thanks!!

imagineering-uk commented 3 years ago

That's AWESOME Charlie! I'll check it out shortly and let you know.

Thankyou so much for responding to me. Was t sure if user error, which would make sense to me.

Take care and thanks again. Cheers Simon

On Fri, 23 Apr 2021, 4:04 pm Charlie, @.***> wrote:

Hey!

I was able to reproduce this issue when using data recorded in an environment with different wifi networks from the one i'm currently in.

Could you double check if the wifi network you are connected to when using the predict command is included in your training data networks? They should be found in the whereamijs-data folder generated when training locations πŸ™‚

If it's not in there, you will probably need to delete the whereamijs-data folder and retrain locations.

Please let me know if this is the issue so I can publish a fix for this πŸ™‚

Thanks!!

β€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/charliegerard/whereami.js/issues/3#issuecomment-825721082, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATZA6TJU2QD4K4CSOKTE6O3TKGD75ANCNFSM43K54IYQ .

imagineering-uk commented 3 years ago

HEY Charlie, Just checked the folder and the rooms i trained where in there.

[image: Screenshot 2021-04-23 at 18.13.29.png]

I'll check the contents of the JSON docs, but with only 1 wifi network on here, Im not sure. I will double check.

Ok, checked a couple of the JSON docs, and there are some spurious results. Some just show the wifi here, and others show some Ive not seen before.

"The Hindley Empire cc:32:e5:e1:22:9e":12,"VM3251399 40:0d:10:28:10:3f":16,"SKYE8F7A a0:bd:cd:15:e1:b5":22,"Virgin Media 52:0d:10:28:10:39":36,"VM3251399 40:0d:10:28:10:39":36,"SKYE8F7A a0:bd:cd:15:e1:b2":42,"SKYE8F7A 20:47:ed:49:5e:53":44,"SKYE8F7A 20:47:ed:49:5e:56":56,"VodafoneConnect63328897 b8:08:d7:bc:36:2a":78},{"The Hindley Empire cc:32:e5:e1:22:9e":12,"VM3251399 40:0d:10:28:10:3f":16,"SKYE8F7A a0:bd:cd:15:e1:b5":16,"Virgin Media 52:0d:10:28:10:39":36,"VM3251399 40:0d:10:28:10:39":36,"SKYE8F7A a0:bd:cd:15:e1:b2":40,"SKYE8F7A 20:47:ed:49:5e:53":46,"SKYE8F7A 20:47:ed:49:5e:56":56,"VodafoneConnect63328897 b8:08:d7:bc:36:2a":88},{"The Hindley Empire cc:32:e5:e1:22:9e":12,"VM3251399 40:0d:10:28:10:3f":16,"SKYE8F7A a0:bd:cd:15:e1:b5":16,"Virgin Media 52:0d:10:28:10:39":36,"VM3251399 40:0d:10:28:10:39":36,"SKYE8F7A 20:47:ed:49:5e:53":46,"SKYE8F7A a0:bd:cd:15:e1:b2":48,"SKYE8F7A 20:47:ed:49:5e:56":66,"VodafoneConnect63328897 b8:08:d7:bc:36:2a":86},{"VM3251399 40:0d:10:28:10:3f":16,"SKYE8F7A a0:bd:cd:15:e1:b5":16,"Virgin Media 52:0d:10:28:10:39":36,"VM3251399 40:0d:10:28:10:39":36,"SKYE8F7A 20:47:ed:49:5e:53":40,"SKYE8F7A a0:bd:cd:15:e1:b2":48,"SKYE8F7A 20:47:ed:49:5e:56":68,"VodafoneConnect63328897 b8:08:d7:bc:36:2a":90},{"VM3251399 40:0d:10:28:10:3f":16,"SKYE8F7A a0:bd:cd:15:e1:b5":16,"Virgin Media 52:0d:10:28:10:39":36,"VM3251399 40:0d:10:28:10:39":36,"BTWi-fi 62:86:20:13:5f:61":40,"VesiLud69 f0:86:20:13:5f:60":40,"SKYE8F7A a0:bd:cd:15:e1:b2":44,"SKYE8F7A 20:47:ed:49:5e:53":48,"SKYE8F7A 20:47:ed:49:5e:56":66,"VodafoneConnect63328897 b8:08:d7:bc:36:2a":88}]

For reference, mine is VodafoneConnect63328897, which is waaaaay off to the right in the above line form the JSON.

Does that help at all?

Cheers Simon

On Fri, Apr 23, 2021 at 5:25 PM Simon Hodgson @.***> wrote:

That's AWESOME Charlie! I'll check it out shortly and let you know.

Thankyou so much for responding to me. Was t sure if user error, which would make sense to me.

Take care and thanks again. Cheers Simon

On Fri, 23 Apr 2021, 4:04 pm Charlie, @.***> wrote:

Hey!

I was able to reproduce this issue when using data recorded in an environment with different wifi networks from the one i'm currently in.

Could you double check if the wifi network you are connected to when using the predict command is included in your training data networks? They should be found in the whereamijs-data folder generated when training locations πŸ™‚

If it's not in there, you will probably need to delete the whereamijs-data folder and retrain locations.

Please let me know if this is the issue so I can publish a fix for this πŸ™‚

Thanks!!

β€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/charliegerard/whereami.js/issues/3#issuecomment-825721082, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATZA6TJU2QD4K4CSOKTE6O3TKGD75ANCNFSM43K54IYQ .

imagineering-uk commented 3 years ago

Looks like it is trying to connect to other wireless networks in the area which are secured. Just looked up other available networks and these are all there are around.

Cheers Simon

imagineering-uk commented 3 years ago

Deleted the whereamijs-data folder, retrained a single room, and predict worked just fine for that.

Trained another 3 rooms which all worked fine, the 5th room returned the original error.

Hope that helps Cheers Simon

charliegerard commented 3 years ago

Hey @imagineering-uk!

Ok, I think I found the issue! πŸ™‚ πŸŽ‰ For the prediction to work, there has to be at least 1 wifi network name that's common to all training files. I think what happened is that when you tried with 3 rooms, it worked because they all contained at least 1 common network name, but when you trained a 5th room, maybe that file did not contain any network that could also be found in all other files. This could be due to spotty wifi, changing network you're connected to OR, what your case might be, while moving around your house, your network SSID VodafoneConnect63328897 can be the same but the BSSID can change! In general, people won't realise it because it doesn't directly affect your connectivity, but as I use the BSSID as part of the network name in the data, my logic sees it as a different network.

I didn't experience this issue before probably because I'm in a small apartment.

I didn't want to only use the SSID alone because some people can call their networks the same name and this can result in wrong data fed to the machine learning algorithm and predict wrong results. πŸ€”

The only quick thing I can do for now is log an error message with some explanation when this case happens πŸ™‚

There might be a way to have a more robust solution for this but right now I don't have the capacity to spend too much time on this.

I pushed some changes and released v2.0.0 so now people should see an error message when this happens πŸ™‚

imagineering-uk commented 3 years ago

Youre a superstar Charlie, Didnt want to make a big deal of it, and its not been a problem, just wanted to get your code working to a) prove that I could do that and b) see what might be possible with such a fine level of location detection.

Its SUPER COOL, and I cant thankyou enough for sharing the code, and also being super helpful in helping me out. Really appreciate your time.

Take care and thankyou again!!!

Cheers Simon

On Tue, Apr 27, 2021 at 1:02 PM Charlie @.***> wrote:

Hey @imagineering-uk https://github.com/imagineering-uk!

Ok, I think I found the issue! πŸ™‚ πŸŽ‰ For the prediction to work, there has to be at least 1 wifi network name that's common to all training files. I think what happened is that when you tried with 3 rooms, it worked because they all contained at least 1 common network name, but when you trained a 5th room, maybe that file did not contain any network that could also be found in all other files. This could be due to spotty wifi, changing network you're connected to OR, what your case might be, while moving around your house, your network SSID VodafoneConnect63328897 can be the same but the BSSID can change! In general, people won't realise it because it doesn't directly affect your connectivity, but as I use the BSSID as part of the network name in the data, my logic sees it as a different network.

I didn't experience this issue before probably because I'm in a small apartment.

I didn't want to only use the SSID alone because some people can call their networks the same name and this can result in wrong data fed to the machine learning algorithm and predict wrong results. πŸ€”

The only quick thing I can do for now is log an error message with some explanation when this case happens πŸ™‚

There might be a way to have a more robust solution for this but right now I don't have the capacity to spend too much time on this.

I pushed some changes and released v2.0.0 so now people should see an error message when this happens πŸ™‚

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/charliegerard/whereami.js/issues/3#issuecomment-827551743, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATZA6TI3CPSIWWZTFOFRZD3TK2RT3ANCNFSM43K54IYQ .