ottoszika / node-red-contrib-ewelink

NodeRED nodes for eWeLink smart devices
https://ottoszika.github.io/node-red-contrib-ewelink
MIT License
48 stars 28 forks source link

One get credentials #116

Closed ckhmer1 closed 3 years ago

ckhmer1 commented 3 years ago

Hi, with this patch, all nodes use just one getCredentials() call, to avoid too much connection to the server. This should fix issue 99.

I hope You want to merge it.

Thanks Claudio

coveralls commented 3 years ago

Pull Request Test Coverage Report for Build 96


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/credentials/credentials.js 7 8 87.5%
src/utils/ewelink-connect.js 5 7 71.43%
<!-- Total: 12 15 80.0% -->
Files with Coverage Reduction New Missed Lines %
src/utils/ewelink-connect.js 2 78.0%
<!-- Total: 2 -->
Totals Coverage Status
Change from base Build 84: -7.0%
Covered Lines: 106
Relevant Lines: 113

💛 - Coveralls
lslomczynski commented 3 years ago

Hi, with this patch, all nodes use just one getCredentials() call, to avoid too much connection to the server. This should fix issue 99.

I hope You want to merge it.

Thanks Claudio

Hello @ckhmer1,

Since this commit was not merged into ottoszika:master I've downloaded Your files manually and replaced the "original" ones in proper directories. After restarting node-red service I was getting an error causing all flows to stop:

Flows stopped due to missing node types.
    ewelink-event-listener
    ewelink-devices
    ewelink-power-state-write
    ewelink-power-state-read

At the same time palette said: SyntaxError: Identifier 'deviceId' has already been declared (line:1)

I'm a Node.js n00b but I made it work by commenting out line 54 of your src/utils/ewelink-connect.js file: was and crashed: const deviceId = config.deviceId ? config.deviceId.trim() : ''; should be: // const deviceId = config.deviceId ? config.deviceId.trim() : ''; or deleted.

I guessed you missed that one while creating a pull request, hence a double-declaration :-)

Anyway: your solution works perfect - all ewelink nodes logged-in after restart without a connection error! Thank you!

ckhmer1 commented 3 years ago

Hi, thanks.

ckhmer1 commented 3 years ago

Hi, I'm wondering why my patch is not yet merged. Are there some problems?

Thanks Claudio