Home Wi-Fi join API (connectWifi SET + scan/status) with docs
This commit is contained in:
1 parent
3c7e74fd0e
commit
eda78dd7d1
4 files changed
+86
-4
No files matched your search
@@ -104,3 +104,30 @@ class TestWattageOp(unittest.TestCase):
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
|
||||
class TestWifiOps(unittest.TestCase):
|
||||
def test_join_home_wifi_shape(self):
|
||||
from franklinwh_agate_client.protocol import direct_connect_request
|
||||
from franklinwh_agate_client.protocol import CommunicationCmd
|
||||
from franklinwh_agate_client.protocol import CommunicationOperate
|
||||
env = direct_connect_request(
|
||||
CommunicationCmd.CONNECT_WIFI, "SN",
|
||||
data={"ssid": "Home", "password": "pw",
|
||||
"wifi_SSID": "Home", "wifi_Pw": "pw"},
|
||||
operate=CommunicationOperate.SET)
|
||||
d = env.to_dict()
|
||||
self.assertEqual(d["cmdType"], 1111) # socket id of connectWifi
|
||||
self.assertEqual(d["type"], 1) # SET
|
||||
self.assertEqual(d["dataArea"]["opt"], 1)
|
||||
self.assertEqual(d["dataArea"]["ssid"], "Home")
|
||||
|
||||
def test_scan_and_status_shape(self):
|
||||
from franklinwh_agate_client.protocol import direct_connect_request
|
||||
from franklinwh_agate_client.protocol import CommunicationCmd
|
||||
scan = direct_connect_request(CommunicationCmd.SCAN_WIFI_LIST, "SN")
|
||||
self.assertEqual(scan.cmd_type, 1109)
|
||||
self.assertEqual(scan.to_dict()["dataArea"], {"opt": 0})
|
||||
status = direct_connect_request(
|
||||
CommunicationCmd.CONNECTION_STATUS, "SN")
|
||||
self.assertEqual(status.cmd_type, 1113)
|
||||
Reference in new issue
Block a user