WifiManager()
Main class to sablish and manage WiFi connection with Bittle, using the REST API hosted in included WiFi dongle.
Attributes
Methods
Example
import time
from pyBittle import wifiManager
# Create WifiManager instance
wifiManager = wifiManager.WifiManager()
# Set Bittle REST API ip address
rest_api_ip = '192.168.1.115'
wifiManager.ip = rest_api_ip
if wifiManager.has_connection(): # http://192.168.1.115/actionpage is accessible
response = wifiManager.send_msg('khi') # Send GREETING command
print(f"khi message sent, received response: {response}, expected: 200")
time.sleep(6) # Wait for GREETING action to finish
response = wifiManager.send_msg("d") # Send SHUTDOWN command
print(f"d message sent, received response: {response}, expected: 200")
else:
print("Can't access to Bittle REST API address!")Last updated