WiFi SSID Limitations and Scans

#1

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

#2

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

#3

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

#4

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?

#5

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

#6

Any further thoughts?

#7

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.