skydiver / ewelink-api

eWeLink API for JavaScript
https://www.npmjs.com/package/ewelink-api
MIT License
264 stars 108 forks source link

GetDevicePowerUsage return an error #138

Open pdelprat opened 3 years ago

pdelprat commented 3 years ago

Hello, Thanks for this library, I use a POW firmware version 2.6.1 and I can't get power usage, Always return { error: 'No power usage data found' }, Work fines on iPhone application, Thanks, Pascal

baugp commented 2 years ago

I followed https://github.com/skydiver/ewelink-api/issues/133 and got it to work most of the time. I found a bug in DevicePowerUsageRaw.get() that it cannot handle multiple websocket responses which occur sometimes. Below are changes that I made to fix it. With this, it works 100% of the time for me.