Closed OE5PON closed 2 years ago
Complete error Message pls
Hi Newan,
a successful response from the ecoflow device send "message":"Success", with values from ecoflow device. {"code":"0","message":"Success","data":{"soc":59,"remainTime":677,"wattsOutSum":63,"wattsInSum":141}}
or on any error e.g. follow "message" with no values. {"code":"6054","message":"secretKey no match"}
Your latest version 0.0.3 receives a "message" with value "Success" and goes to the error branch. You make a log entry "Error:Success" and set "info connection" to false, instead of going to the other branch and setting info connection to TRUE.
Please check the value of "message" is not equal to "Success" and go to the "then branch". Value "message":"Success" should go to the "else branch".
Sorry, I'm not that familiar with javascript, otherwise I would have corrected the code right away.
Thank you for this adapter and I hope to release it soon!
Best Regard, Andreas
I commented out this three line, then it works!
getEcoflowData() { this.log.debug("Ask Data from ecoflow cloud API"); try { this.log.debug("call: https://api.ecoflow.com/iot-service/open/api/device/queryDeviceQuota?sn=" + this.sn); (0, import_axios.default)("https://api.ecoflow.com/iot-service/open/api/device/queryDeviceQuota?sn=" + this.sn, { headers: { "Content-Type": "application/json", "appKey": this.apikey, "secretKey": this.secretkey }, timeout: this.timeout }).then(async (response) => { this.log.debug("Get-Data from ecoflow:" + JSON.stringify(response.data)); if ("message" in response.data) { // this.log.error(response.data.message); // this.setState("info.connection", false, true); // } else { await this.setStateAsync("status.soc", { val: response.data.data.soc, ack: true }); await this.setStateAsync("status.remainTime", { val: response.data.data.remainTime, ack: true }); await this.setNewRemainTime(response.data.data.remainTime); await this.setStateAsync("status.wattsOutSum", { val: response.data.data.wattsOutSum, ack: true }); await this.setStateAsync("status.wattsInSum", { val: response.data.data.wattsInSum, ack: true }); this.setState("info.connection", true, true); } }).catch((error) => { this.log.error(error.message); this.setState("info.connection", false, true); }); } catch (error) { this.setState("info.connection", false, true);