I received my EmonPi today, and I couldn’t get it connected to my WiFi network. It’s working now, but it appears that the problem was that the EmonPi didn’t recognise my network password because it contained a “+” symbol.
If you enter a password that contains a “+”, and then click the eye icon to show the password, the + is replaced with a space. This might just be a quirk of the user interface, but I couldn’t get the EmonPi to connect to my wifi network until I changed my network password to something simpler. Once the + was removed from the network password, the EmonPi connected to my wifi straight away.
Ok, I’ve just taken a look. I thought it would be an easy fix but it seems not.
I thought the issue was being caused by the line and the escapeshellarg command:
It seems stripped out non-ASCII characters is a known issue with escapeshellarg. The fix for this as documented in php manual is to add setlocale(LC_CTYPE, "en_US.UTF-8");. I tried this and it didn’t seems to make a difference.
Maybe this is because the data type headers are being already sent from Emoncms. Has anyone come across this issue before?
escapeshellarg is used to ensure only ‘safe’ strings are passed to the shell ready to be inserted into wpa_supplicant.conf. We need to be careful that by allowing special characters we will permit potentially dangerous attack commands to be passed.
Came across this when troubleshooting the Nov16 build on EmonPi being unable to connect to my router with a typical “wlan0: WPA: 4-Way Handshake failed - pre-shared key may be incorrect” error. This often happens when using RPi wpa_supplicant. I thought it might be this error because I have special characters in my PSK. I suspect it is simply that wpa_supplicant on Rpi is a bit rubbish.
Resolved by bypassing the emoncms/wifi setup in the browser, and explicitly setting parameters in /etc/network/interfaces to connect to a broadcasted ssid with WPA2 using a pre-shared key:
I ran into the same issue with my wlan config, I use a PSK with a ! in it and wpa_passphrase fails because of that.
Is there a official fix for this or is the only way to get this working to use manual configuration, and if so how do you generate a PSK with a ! in it?