Slow login. Using ewelink-api is much slower than using ewelink app on mobile.
See original GitHub issueNot so much of an issue but an observation and a request to update the documentation.
What I have found is that when I use ewelink-api to access the devices via the cloud it takes a long time to open and fetch information about the devices, eg:
connection = new ewelink({
email: config.ewelink.email,
password: config.ewelink.password
});
. . .
devices = await connection.getDevices();
console.log(devices);
Running this takes nearly 6 seconds (and longer sometimes):
$ time bin/fetchDevices.js
real 0m5.816s
user 0m1.349s
sys 0m0.084s
Occasionally it failed to connect and I noticed that the host it was trying to connect to was the US server, ie:
https://us-api.coolkit.cc:8080
This made me think, what if this is the default login is the us server so I changed the Class Instantiation to include my region:
connection = new ewelink({
email: config.ewelink.email,
password: config.ewelink.password,
region: "eu"
});
sure enough:
$ time bin/fetchDevices.js
real 0m1.930s
user 0m1.331s
sys 0m0.088s
Could you update the documentation to require the region be included in the Class Instantiation API as it affects performance.
This is also why I think the alternative connection is failing as they are sometimes connecting to the wrong server for where a user is registered. ie add the region as a required parameter when using the ‘access token’ or ‘api key’.
Only had a switch and socket a few days but so far I’ve had more success with your library than all the others I’ve tried, I just want a simple library not a whole automation system.
I noticed you’ve commented on LAN mode which is what I’m really after, I’ll start moving that way soon as I’d rather not be using the cloud to store what’s happening in my house and I want it to work when the internet is down.
pinging US server:
$ ping -c 10 us-api.coolkit.cc
PING us-api.coolkit.cc (13.57.86.90) 56(84) bytes of data.
64 bytes from ec2-13-57-86-90.us-west-1.compute.amazonaws.com (13.57.86.90): icmp_seq=1 ttl=35 time=163 ms
. . .
--- us-api.coolkit.cc ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9009ms
rtt min/avg/max/mdev = 162.212/165.930/177.053/4.508 ms
pinging EU server:
$ ping -c 10 eu-api.coolkit.cc
PING eu-api.coolkit.cc (52.57.118.192) 56(84) bytes of data.
64 bytes from ec2-52-57-118-192.eu-central-1.compute.amazonaws.com (52.57.118.192): icmp_seq=1 ttl=41 time=41.5 ms
. . .
--- eu-api.coolkit.cc ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9013ms
rtt min/avg/max/mdev = 39.034/42.012/43.908/1.710 ms
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (10 by maintainers)
I’ve split my application into services that run constantly and thus only connect once, or reconnect on error.
www - operator interface to control panel to show/change state of devices & edit switching table events - captures events from the devices (via the cloud at the moment, looking to implement over LAN) lanSwitcher - process to change device state scheduler - changes device state according to the switching table which has state of devices over complete day in 5 min slots
I use REST (ie web services) to send messages between services.
Might package up one day and upload to github when I get the time.
interface to control panel to show/change state of devices![Screenshot at 2020-06-09 14-57-14](https://user-images.githubusercontent.com/57546078/84156643-ac732b80-aa61-11ea-8b31-b72da0828e4a.png)
edit switching table![Screenshot at 2020-06-09 14-56-22](https://user-images.githubusercontent.com/57546078/84156697-bdbc3800-aa61-11ea-8770-9480f2389100.png)
service logs![Screenshot at 2020-06-09 14-57-51](https://user-images.githubusercontent.com/57546078/84156708-c14fbf00-aa61-11ea-8672-4ac34ba4975b.png)
Do you log in each time or have you got an application running which only logs in once?