mirror of
https://github.com/mjg59/python-broadlink.git
synced 2024-11-21 22:51:41 +01:00
Add --joinwifi option to configure the device with Wifi details (#296)
This commit is contained in:
parent
e151a14a7b
commit
af95fa2446
@ -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
|
||||
```
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user