Skip to main content

Retrieve the imp’s preferred wireless router or access point BSSID, and WiFi channel


Device (from impOS™ 38)


Table — the imp’s WiFi hints


This method returns the WiFi ‘hints’ that the imp records to accelerate future re-connections to local wireless networks.

When an imp connects to a local wireless router or access point for the first time, it records both the network station’s BSSID and the WiFi channel on which the network is operating (1-13 for 2.4GHz, 36-165 for 5GHz). This saves the imp from having to scan for this data at every subsequent reconnection. If the router later changes channel, or the stored BSSID is not available on the imp’s target network when the imp attempts to reconnect, the imp will re-scan, and record the new BSSID and channel for future use.

Only one pair of hints is stored at any one time — or there will be no hints if the imp has not yet connected to a WiFi network (or does not support WiFi). Hints are preserved across device starts and impOS™ updates, but not BlinkUps.

The imp’s currently stored hints can be retrieved at any time using The hints are returned as a table with the keys bssid (the router or access point’s BSSID as a string of 12 hexadecimal characters) and channel (the network’s WiFi channel as an integer). If there are no stored hints, returns a table containing these keys, but value of bssid will be an empty string ("") and the value of channel will be -1.

If you wish to specify an imp’s hints, call

Module-specific Information


The impC001 does not currently implement

Example Code

The following example checks the host imp’s hints using to test whether it previously connected to a network in the 5GHz band. For this application, the 2.4GHz band (with its greater range) is preferred, so we set this manually and re-connect. The connection callback function, reconnect(), checks for a successful connection and schedules a further re-connection attempt if the server could not be reached.

Note A fuller implementation might do more to check that the stored BSSID is valid for 2.4GHz operation, or use imp.setwificonfiguration() to specify a specific 2.4GHz network, if known.