wificlient – WiFi connection manager

Note

A global instance of the NetworkManager is instantiated in this module. It is strongly recommended to use this instance instead of creating a new one.

Import the global instance like this:

from wificlient import nmcli

Classes

class wificlient.NetworkManager
property ssid

Returns the SSID of the wireless network that this board is currently connected to (if the infrastructure mode is used), or the one that this board created (if the access point mode is used).

property connected

Returns the connection status (please note that in the access point mode the connected property will always be True)

property ip

Returns the IP of the board (as a string), or None.

ifconfig()

Returns a tuple of (ip, netmask, gateway, dns) or None

defaults()

Configures the default connection: an access point, ip 10.10.0.1. The SSID is individual for each board (derived from the MAC address).

connect()
Async

Tries to connect to the SSID or create an access point according to the board settings.

watcher()
Async

This is a task, that monitors the connection, tries to restore it of it is lost and reboots the board if the reconnection retries have been exhausted.