MiSchroe/klf-200-api

Concurrent execution of scenes

Closed this issue · 1 comments

Hi

First of all, thank you for the library! I'm using it in a Node-RED flow and it works well. One issue is present though: The KLF-200 does not support execution of multiple concurrent scenes (or even logins). Currently, it doesn't seem that the library handles this case, at least I get the following error (after a timeout):

Error: socket hang up at createHangUpError (_http_client.js:331:15) at Socket.socketOnEnd (_http_client.js:423:23) at emitNone (events.js:111:20) at Socket.emit (events.js:208:7) at endReadableNT (_stream_readable.js:1064:12) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9)

If I retry quickly I get (probably the multiple login limitation):

Error: Forbidden at Request.callback (/root/node_modules/superagent/lib/node/index.js:696:15) at parser (/root/node_modules/superagent/lib/node/index.js:906:18) at IncomingMessage.<anonymous> (/root/node_modules/klf-200-api/src/connection.js:129:13) at emitNone (events.js:111:20) at IncomingMessage.emit (events.js:208:7) at endReadableNT (_stream_readable.js:1064:12) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9)

After another retry it usually works.

Currently, I'm providing basic retry capability within my Node-RED flow, but it would be great if the library would mitigate this limitation using some sort of queuing.

Concurrent execution of scenes won't be possible, but with the official API there is no need to define scenes to set a product to a specific state. Instead, the product can be controlled directly. Running commands on multiple products will be supported by the KLF iteslf.