|
1 | 1 | # Class Instantiation |
2 | 2 |
|
3 | | -> Default region of this library is `us`. If your are in a different one, **you must** specify region parameter or error 400/401 will be returned. |
| 3 | +* Default region of this library is `us`. If your are in a different one, **you must** specify region parameter or error 400/401 will be returned. |
4 | 4 |
|
5 | | -**_Using email and password_** |
| 5 | +* If you don't know your region, use [getRegion](available-methods/getregion) method |
| 6 | + |
| 7 | +* To get your access token and api key, use [getCredentials](available-methods/getcredentials) method |
| 8 | + |
| 9 | +## Using email and password |
6 | 10 | ``` |
7 | 11 | const connection = new ewelink({ |
8 | 12 | email: '<your ewelink email>', |
|
11 | 15 | }); |
12 | 16 | ``` |
13 | 17 |
|
14 | | -**_Using phone number and password_** |
| 18 | +## Using phone number and password |
15 | 19 | ``` |
16 | 20 | const connection = new ewelink({ |
17 | 21 | phoneNumber: '<your phone number>', |
|
20 | 24 | }); |
21 | 25 | ``` |
22 | 26 |
|
23 | | -**_Using access token and api key_** |
| 27 | +## Using access token and api key |
24 | 28 | ``` |
25 | 29 | const connection = new ewelink({ |
26 | 30 | at: '<valid access token>', |
|
29 | 33 | }); |
30 | 34 | ``` |
31 | 35 |
|
32 | | -**_Using devices and arp table cache files_** |
33 | | -Check [ZeroConf](zeroconf.md) docs for detailed information. |
| 36 | +## Custom APP_ID and APP_SECRET |
| 37 | +This library uses an APP ID and APP Secret provided by Sonoff team. |
| 38 | +If you want to specify another pair of settings, just pass in the class constructor: |
| 39 | +``` |
| 40 | + const connection = new ewelink({ |
| 41 | + email: '<your ewelink email>', |
| 42 | + password: '<your ewelink password>', |
| 43 | + APP_ID: 'CUSTOM APP ID', |
| 44 | + APP_SECRET: 'CUSTOM APP SECRET', |
| 45 | + }); |
| 46 | +``` |
34 | 47 |
|
35 | | -> * If you don't know your region, use [getRegion](available-methods/getregion) method |
36 | | -> * To get your access token and api key, use [getCredentials](available-methods/getcredentials) method |
| 48 | +## Using devices and arp table cache files |
| 49 | +Check [ZeroConf](zeroconf.md) docs for detailed information. |
0 commit comments