Emoncms WiFi Module - special characters not supported in network password?

Hi,

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.

My EmonPi is running EmonSD build 03May16.

You might have needed to escape the ‘+’.

Thanks for letting us know, I will try and look at this soon. Ive opened an issue on the Wifi module github:

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:

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-driver wext
wpa-ap-scan 1
wpa-proto RSN
wpa-pairwise CCMP
wpa-group CCMP
wpa-key-mgmt WPA-PSK
wpa-ssid “[my ssid]”
wpa-psk [my PSK in hex]

1 Like

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?

Sorry not official fix, the workaround posted by @Chaffelson is a viable alternative.

This issue should now be fixed please update to WiFi module V1.2.0 via emonPi update. All new emonPi’s will contain this fix.

@glyn.hudson

I can confirm this is still not working on emonSD v10.1.0

I had to remove both a plus sign and a period from my router’s password before my emonPi
would connect to my router via Wi-Fi.

The issue is repeatable. i.e. if I put either of the two characters back in the router password,
the emonPi will not connect to my router.

The relevant part of the update log:

------------------------------------------
Updating /var/www/emoncms/Modules/wifi module
------------------------------------------
- git branch: stable
- git tags: 1.2.0-39-gb67783d
- no local changes
- running: git pull origin stable

From https://github.com/emoncms/wifi
 * branch            stable     -> FETCH_HEAD
Already up-to-date.

Here’s a screenshot of a sucessful connction, i.e. no period or plus sign in the router password,
as well as the emonCMS version number

Ok, thanks. I’ve re-opened the issue