Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnhandledPromiseRejectionWarning #3

Open
imagineering-uk opened this issue Apr 21, 2021 · 7 comments
Open

UnhandledPromiseRejectionWarning #3

imagineering-uk opened this issue Apr 21, 2021 · 7 comments

Comments

@imagineering-uk
Copy link

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
Copy link
Owner

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
Copy link
Author

imagineering-uk commented Apr 23, 2021 via email

@imagineering-uk
Copy link
Author

imagineering-uk commented Apr 23, 2021 via email

@imagineering-uk
Copy link
Author

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
Copy link
Author

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
Copy link
Owner

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
Copy link
Author

imagineering-uk commented Apr 27, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants