Wifi

From Let's Control It
Revision as of 08:59, 5 June 2018 by TD-er (talk | contribs)
Jump to navigation Jump to search

This page will cover everything you need to know about ESP Easy WiFi and connecting it to an AP (Access Point).

Hidden SSID

Currently there's a problem if you use hidden SSID on channels 11 - 14. Hidden channels are shown in the scan, but when selected it is not possible to connect to them on channel 11 and above. This is probably related to the ESP core libraries.

Sometimes connecting to a hidden SSID may fail the first time, even when the channel number is below 1 - 10. For these situations, it may help to temporally change the WiFi to not hidden and then after the units are connected hide the SSID again.

Connection problems

ESPeasy can switch to another AP with the same SSID and password when the original connection is lost. The rules to reconnect are:

  • First retry to connect to the previously connected AP (using the BSSID of that AP)
  • Perform a scan and connect to the AP with the strongest RSSI (signal strength)

In practice there may be some issues.

Not using the AP with best signal

Both the ESP82xx and almost all Access Points do use power save options, which means the wifi radio is not always active and enabled. An access point sends at a Beacon Interval of typical 100 ms. Some Access Points may allow changing this to lower values to improve response times for VoIP-like applications.

This Beacon Interval is to keep (idle) connections alive and to allow other devices to 'see' and connect to an access point. An AP does not have to send a beacon signal every interval, as long as it sends the next one at the same interval. A sent beacon signal may also get lost due to the shared nature of the WiFi medium.

A typical scan for available SSID's may miss a beacon signal, since it will only listen for a short time (about 250 msec) to a channel and then hop to the next. Also the ESP may receive some interrupt from a sensor during a scan and just miss the beacon signal.

This results in a list of found SSIDs from which the strongest one with the matching SSID is chosen. Due to the issues mentioned above, the actual strongest AP may be omitted.

When a connection is lost, ESPeasy will try to reconnect to the last known AP (based on the BSSID) and thus keep reconnecting to the AP with a sub-optimal signal strength.


Refuse to connect to another AP with same SSID

There have been reports of users unable to connect to a different AP with the same SSID. Even with the original AP switched off.

It seems like the ESP core libraries may store connection state to a different part of the flash memory. This may affect other WiFi connections. Current versions of ESPeasy prevent writing these settings, but when other firmware versions were used on the node, these settings may be present.

To wipe these conflicting settings, the whole flash has to be wiped clean using a tool like ESPtool.py. After flashing the ESPeasy firmware again, it will allow connecting to any accesspoint again.

Future versions of ESPeasy may be able to clear these settings.

WiFi disconnect codes

The following codes may appear in the log:

Code Reason Explanation
0 Reserved Normal working operation
1 Unspecific Reason We don’t know what’s wrong
2 Previous authentication no longer valid Client has associated but is not authorised.
3 Deauthenticated because sending STA is leaving (or has left) IBSS or ESS The access point went offline, deauthenticating the client.
4 Disassociated due to inactivity Client session timeout exceeded.
5 Disassociated because AP is unable to handle all currently associated STAs The access point is busy, performing load balancing, for example.
6 Class 2 frame received from nonauthenticated STA Client attempted to transfer data before it was authenticated.
7 Class 3 frame received from nonassociated STA Client attempted to transfer data before it was associated.
8 Disassociated because sending STA is leaving (or has left) BSS Operating System moved the client to another access point using non-aggressive load balancing.
9 STA requesting (re)association is not authenticated with responding STA Client not authorized yet, still attempting to associate with an access point.
10 Disassociated because the information in the Power Capability element is unacceptable
11 Disassociated because the information in the Supported Channels element is unacceptable
12 Reserved Not Used or Special Purpose
13 Invalid information element.
14 Message integrity code (MIC) failure
15 4-Way Handshake timeout
16 Group Key Handshake timeout
17 Information element in 4-Way Handshake different from (Re)Association Request/Probe Response/Beacon frame
18 Invalid group cipher
or
The link speed requested by the client or AP is incompatible. (i,e. trying to operate N only speeds on a G AP)
Association denied due to requesting STA not supporting all of the data rates in the BSSBasicRateSet parameter
19 Invalid pairwise cipher
20 Invalid AKMP
21 Unsupported RSN information element version
22 Invalid RSN information element capabilities
23 IEEE 802.1X authentication failed
24 Cipher suite rejected because of the security policy
25-31 Reserved Not Used or Special Purpose
32 Disassociated for unspecified, QoS-related reason Quality of Service has denied the action.
33 Disassociated because QoS AP lacks sufficient bandwidth for this QoS STA
34 Disassociated because excessive number of frames need to be acknowledged, but are not acknowledged due to AP transmissions and/or poor channel conditions
35 Disassociated because STA is transmitting outside the limits of its TXOPs
36 Requested from peer STA as the STA is leaving the BSS (or resetting)
37 Requested from peer STA as it does not want to use the mechanism
38 Requested from peer STA as the STA received frames using the mechanism for which a setup is required
39 Requested from peer STA due to timeout
45 Peer STA does not support the requested cipher suite
45-65 Reserved Not Used or Special Purpose
99 Typically “No Reason Code” / Unknown State
535 Reserved Not Used or Special Purpose