@@ -33,6 +33,7 @@ program
33
33
. version ( version )
34
34
. arguments ( '[options]' )
35
35
. option ( '-g, --gateway <gateway>' , 'Set the gateway address' , '10.10.10.1' )
36
+ . option ( '--nowifi' , 'Do not configure WIFI' )
36
37
. option ( '--wifi-ssid <wifi-ssid>' , 'WIFI AP name' )
37
38
. option ( '--wifi-pass <wifi-pass>' , 'WIFI AP password' )
38
39
. option ( '--use-wifi-x' , 'Use newer protocol on WifiX namespace with encrypted password' )
@@ -52,31 +53,34 @@ if (!options.gateway) {
52
53
process . exit ( 1 )
53
54
}
54
55
55
- if ( ! options . wifiSsid ) {
56
- console . error ( 'WIFI ssid must be specified' )
57
- process . exit ( 1 )
58
- }
56
+ if ( ! options . nowifi ) {
57
+ if ( ! options . wifiSsid ) {
58
+ console . error ( 'WIFI ssid must be specified' )
59
+ process . exit ( 1 )
60
+ }
59
61
60
- if ( ! options . wifiPass ) {
61
- console . error ( 'WIFI password must be specified' )
62
- process . exit ( 1 )
63
- }
62
+ if ( ! options . wifiPass ) {
63
+ console . error ( 'WIFI password must be specified' )
64
+ process . exit ( 1 )
65
+ }
64
66
65
- if ( undefined !== options . wifiChannel && isNaN ( options . wifiChannel ) ) {
66
- console . error ( 'WIFI channel must be a number between 1-13' )
67
- process . exit ( 1 )
68
- }
67
+ if ( undefined !== options . wifiChannel && isNaN ( options . wifiChannel ) ) {
68
+ console . error ( 'WIFI channel must be a number between 1-13' )
69
+ process . exit ( 1 )
70
+ }
69
71
70
- if ( undefined !== options . wifiEncryption && isNaN ( options . wifiEncryption ) ) {
71
- console . error ( 'WIFI encryption must be a number' )
72
- process . exit ( 1 )
73
- }
72
+ if ( undefined !== options . wifiEncryption && isNaN ( options . wifiEncryption ) ) {
73
+ console . error ( 'WIFI encryption must be a number' )
74
+ process . exit ( 1 )
75
+ }
74
76
75
- if ( undefined !== options . wifiCipher && isNaN ( options . wifiCipher ) ) {
76
- console . error ( 'WIFI cipher must be a number' )
77
- process . exit ( 1 )
77
+ if ( undefined !== options . wifiCipher && isNaN ( options . wifiCipher ) ) {
78
+ console . error ( 'WIFI cipher must be a number' )
79
+ process . exit ( 1 )
80
+ }
78
81
}
79
82
83
+
80
84
( async ( ) => {
81
85
const gateway = options . gateway
82
86
const key = options . key
@@ -92,13 +96,20 @@ if (undefined !== options.wifiCipher && isNaN(options.wifiCipher)) {
92
96
93
97
await api . deviceInformation ( ) ;
94
98
95
- await api . configureWifiCredentials ( {
96
- ssid : options . wifiSsid ,
97
- password : options . wifiPass ,
98
- channel : options . wifiChannel ,
99
- encryption : options . wifiEncryption ,
100
- cipher : options . wifiCipher ,
101
- bssid : options . wifiBssid ,
102
- } , options . useWifiX )
103
- console . log ( `Device will reboot...` )
99
+ if ( ! options . nowifi ) {
100
+ await api . configureWifiCredentials ( {
101
+ ssid : options . wifiSsid ,
102
+ password : options . wifiPass ,
103
+ channel : options . wifiChannel ,
104
+ encryption : options . wifiEncryption ,
105
+ cipher : options . wifiCipher ,
106
+ bssid : options . wifiBssid ,
107
+ } , options . useWifiX )
108
+ console . log ( `Device will reboot...` )
109
+ }
110
+ else {
111
+ console . log ( `Device has been configured.` )
112
+ }
113
+
114
+
104
115
} ) ( )
0 commit comments