about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--cli/README.md5
-rwxr-xr-xcli/broadlink_cli4
2 files changed, 9 insertions, 0 deletions
diff --git a/cli/README.md b/cli/README.md
index 5d7b3be19302..7e229e3eb557 100644
--- a/cli/README.md
+++ b/cli/README.md
@@ -78,3 +78,8 @@ Get Energy Consumption (For a SmartPlug) :
 ```
 broadlink_cli --device @BEDROOM.device --energy
 ```
+
+Once joined to the Broadlink provisioning Wi-Fi, configure it with your Wi-Fi details:
+```
+broadlink_cli --joinwifi MySSID MyWifiPassword
+```
diff --git a/cli/broadlink_cli b/cli/broadlink_cli
index 2de44aa4357a..5045c5c1082f 100755
--- a/cli/broadlink_cli
+++ b/cli/broadlink_cli
@@ -85,6 +85,7 @@ parser.add_argument("--learnfile", help="save learned command to a specified fil
 parser.add_argument("--durations", action="store_true",
                     help="use durations in micro seconds instead of the Broadlink format")
 parser.add_argument("--convert", action="store_true", help="convert input data to durations")
+parser.add_argument("--joinwifi", nargs=2, help="Args are SSID PASSPHRASE to configure Broadlink device with");
 parser.add_argument("data", nargs='*', help="Data to send or convert")
 args = parser.parse_args()
 
@@ -102,6 +103,9 @@ if args.host or args.device:
     dev = broadlink.gendevice(type, (host, 80), mac)
     dev.auth()
 
+if args.joinwifi:
+    broadlink.setup(args.joinwifi[0], args.joinwifi[1], 4)
+
 if args.convert:
     data = bytearray.fromhex(''.join(args.data))
     durations = to_microseconds(data)