WiFi SSID Limitations and Scans

Greetings all:

We’ve run into an issue where some customer WiFi SSID names that are not compatible with the mDash client library. Specifically, if there is an apostrophe in the SSID (e.g. Bob’s Network) then the ESP32 device is unable to connect. I’ve tried using \’ without success.

Q1: What is the proper way to specify such an SSID using the the /setup REST API and setup() client API?

On a related topic, it would very valuable to show the customer a list of available networks when provisioning a new device. Mongoose has a nice RPC called Wifi.Scan that would be very helpful.

Q2: Is the Wifi.Scan RPC available using the mDash client device API?

Thanks!
-AD

Q1. Try to URL-encode non-alphanumeric characters. ' -> %27
Q2. No, mdash library does not provide Wifi.Scan() function

lsm,

Thanks for the response. No luck on the special characters. I’ve tried the following permutations via the serial terminal (set wifi.sta.ssid xxx) without success:

  • Bob’s Network
  • Bob’s Network
  • Bob%27s Network
  • Bob\u0027s Network
  • “Bob’s Network”

Any other suggestions? The use of apostrophes is very common in mobile hotspot SSIDs and more than a few last names in Cesanta’s hometown. :slight_smile:

…as for the WiFi.Scan, bummer. That would be especially helpful in AP mode when provisioning devices for the first time (e.g. provide the user with a list of available networks).

-AD

Thanks.

Could you share the code snippet that sends a request, please?
Also, if a request is sent by a browser, could you catch it using a developer tools and double-check the HTTP body, please?

My Web App code is identical to this section of your Smart Light example.

Here is the body captured from a browser request:

  "postData": {
    "mimeType": "application/x-www-form-urlencoded",
    "text": "{\"ssid\":\"Bob's Network\",\"pass\":\"mdashiskewl\"}",
    "params": [
      {
        "name": "{\"ssid\":\"Bob's Network\",\"pass\":\"mdashiskewl\"}",
        "value": ""
      }
    ]
  }

Lastly, if we eliminate the browser/HTTP and enter the SSID directly using the serial port and mDashCLI() OR update mdash.cfg via the dashboard the results are the same.

Thanks for your help!
-AD

Any further thoughts?

It is not identical.

The body of the request should look like this:

{"ssid":"...","pass":"..."}

In your case, it does not. In the Smart Light example, it does.

Closing out this thread for posterity…

The root cause of our WiFi connection issue had to do with a mismatch of special characters:

  • Looking at the user SSID we assumed Bob’s Network had an apostrophe (U+0027). In fact, it was right single quote (U+2019). Most smartphones will use “smart quotes” to automatically convert apostrophes to more visually-appealing special characters. That’s what happened here
  • Of course the mDash device does not use smart quotes and so the device SSID string using (U+0027) did not exactly match the user SSID which used (U+2019). This mismatch prevented the WiFi connection

When there is an exact match, WiFi works as intended - even when an apostrophe is used.

-AD