Open Thibaut21 opened 3 years ago
Hello @Thibaut21
Version 3.1 was released this week.
Can you try updating the package and see if it fixes your issues?
Hello @skydiver
I have update my package with npm and i use the 3.1.0 version of ewelink-api.
But the result of toggle function is always instable. I encouter the same probleme ... with the same code :
(node:9411) UnhandledPromiseRejectionWarning: FetchError: invalid json response body at https://eu-api.coolkit.cc:8080/api/user/device/status reason: Unexpected token < in JSON at position 0 at /home/debian/python-scripts/nodejs-scripts/node_modules/node-fetch/lib/index.js:272:32 at process._tickCallback (internal/process/next_tick.js:68:7) (node:9411) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) (node:9411) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. (node:9411) UnhandledPromiseRejectionWarning: FetchError: invalid json response body at https://eu-api.coolkit.cc:8080/api/user/device/status reason: Unexpected token < in JSON at position 0 at /home/debian/python-scripts/nodejs-scripts/node_modules/node-fetch/lib/index.js:272:32 at process._tickCallback (internal/process/next_tick.js:68:7) (node:9411) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
I think it's a connection error no ?
Hey @Thibaut21
Version 3.1.1 was jus released
It catches this kind of errors
Looks like ewelink servers throws many errors and you need to retry your requests 🙁
Hey @skydiver
Thank you very much for your help !!
I was retry my python code for evoid this type of error ... but ewelink servers generate severals errors "504" etc ... it's a very bad API.
I told you if i encounter others bugs.
Hello everyone,
I want to toggle a 4CHPRO device with à debian server on the web. For this i use ewelink-api with nodeJS on 3.0.0 version.
I use this code : `const ewelink = require('ewelink-api');
function Power_On_4() { (async () => { const connection = new ewelink({ email: 'email', password: 'PSW', region: 'eu', });
const status = await connection.toggleDevice('1000b195d7', 4); console.log(status); })(); }
function Power_Off_4() { (async () => { const connection = new ewelink({ email: 'email, password: 'PSW', region: 'eu', });
const status = await connection.toggleDevice('1000b195d7', 4); console.log(status); })(); }
Power_On_4(); setTimeout(Power_Off_4, 120000); `
But they are already this same error that appear :
(node:32659) UnhandledPromiseRejectionWarning: FetchError: invalid json response body at https://eu-api.coolkit.cc:8080/api/user/device/status reason: Unexpected token < in JSON at position 0 at /home/debian/python-scripts/nodejs-scripts/node_modules/node-fetch/lib/index.js:272:32 at process._tickCallback (internal/process/next_tick.js:68:7) (node:32659) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) (node:32659) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
It's very instable. This code works on day and not an other one.
Please can you help me to find à solution ?