Skip to content

Commit 76674fe

Browse files
committed
Use token region
1 parent 22551f9 commit 76674fe

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class TuyaLinkWizard {
8686

8787
debug('Token: ', token);
8888

89-
this.device.registerSmartLink({region: this.region,
89+
this.device.registerSmartLink({region: token.region,
9090
token: token.token,
9191
secret: token.secret,
9292
ssid,

lib/link.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class TuyaLink {
3535
* @param {String} options.wifiPassword
3636
* password of WiFi
3737
* @example
38-
* device.registerSmartLink({region: 'us',
38+
* device.registerSmartLink({region: 'AZ',
3939
* token: '00000000',
4040
* secret: '0101',
4141
* ssid: 'Example SSID',
@@ -46,7 +46,7 @@ class TuyaLink {
4646
*/
4747
async registerSmartLink(options) {
4848
// Check arguments
49-
if (options.region.length !== 2 || !['us', 'cn', 'eu'].includes(options.region)) {
49+
if (options.region.length !== 2 || !['AZ', 'CN', 'EU'].includes(options.region)) {
5050
throw new Error('Invalid region');
5151
}
5252

@@ -143,7 +143,7 @@ class TuyaLink {
143143
* lengths.
144144
* @param {Object} options options
145145
* @param {String} options.region
146-
* two-letter region (us=Americas, cn=Asia, eu=Europe)
146+
* two-letter region (AZ=Americas, CN=Asia, EU=Europe)
147147
* @param {String} options.token token
148148
* @param {String} options.secret secret
149149
* @param {String} options.ssid SSID

0 commit comments

Comments
 (0)