nikkow / node-red-contrib-tahoma

Node-RED module to control a Somfy Tahoma box (Roller shutters...). Used for home automation flows.
Apache License 2.0
19 stars 11 forks source link

Crash node-red after save credential #12

Closed marcswiss closed 4 years ago

marcswiss commented 5 years ago

Hello

As soon i save the tahoma login data, whole node-red is crashing... i tried to upgrade node-red to latest version, but issus still exists..

Any idea?

31 May 23:35:45 - [red] Uncaught Exception: 31 May 23:35:45 - TypeError: Cannot read property 'username' of null at Timeout._onTimeout (/home/pi/.node-red/node_modules/node-red-contrib-tahoma/core/tahomalink.js:40:36) nodered.service: Main process exited, code=exited, status=1/FAILURE nodered.service: Unit entered failed state. nodered.service: Failed with result 'exit-code'.

tpazderka commented 5 years ago

Got this one as well. Solved this by deploying the flow. Unfortunately, you have to be sort of quick and manage to hit the sweet spot between the node-red start, and the timeout of reading the device list.

phobeus81 commented 5 years ago

I can confirm this issue. Once the Tahoma box is setup, the docker container with the node is crashing. This puzzled me for a while, but like tpazderka said, if you be fast and deploy it, all the devices are detected correctly and I am able to read from them. This is the exception from the crashed container:

$ cat /usr/src/node-red/.npm/_logs/2019-07-12T18_32_55_920Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'start',
1 verbose cli   '--',
1 verbose cli   '--userDir',
1 verbose cli   '/data' ]
2 info using npm@6.4.1
3 info using node@v8.16.0
4 verbose config Skipping project config: /usr/src/node-red/.npmrc. (matches userconfig)
5 verbose run-script [ 'prestart', 'start', 'poststart' ]
6 info lifecycle node-red-docker@1.0.0~prestart: node-red-docker@1.0.0
7 info lifecycle node-red-docker@1.0.0~start: node-red-docker@1.0.0
8 verbose lifecycle node-red-docker@1.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle node-red-docker@1.0.0~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/usr/src/node-red/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
10 verbose lifecycle node-red-docker@1.0.0~start: CWD: /usr/src/node-red
11 silly lifecycle node-red-docker@1.0.0~start: Args: [ '-c',
11 silly lifecycle   'node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data"' ]
12 silly lifecycle node-red-docker@1.0.0~start: Returned: code: 1  signal: null
13 info lifecycle node-red-docker@1.0.0~start: Failed to exec start script
14 verbose stack Error: node-red-docker@1.0.0 start: `node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data"`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
14 verbose stack     at emitTwo (events.js:126:13)
14 verbose stack     at EventEmitter.emit (events.js:214:7)
14 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
14 verbose stack     at emitTwo (events.js:126:13)
14 verbose stack     at ChildProcess.emit (events.js:214:7)
14 verbose stack     at maybeClose (internal/child_process.js:915:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
15 verbose pkgid node-red-docker@1.0.0
16 verbose cwd /usr/src/node-red
17 verbose Linux 5.1.16-300.fc30.x86_64
18 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" "--" "--userDir" "/data"
19 verbose node v8.16.0
20 verbose npm  v6.4.1
21 error code ELIFECYCLE
22 error errno 1
23 error node-red-docker@1.0.0 start: `node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data"`
23 error Exit status 1
24 error Failed at the node-red-docker@1.0.0 start script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]
Programmierfreund commented 4 years ago

I have the same issue. I have tried it on several platforms (Docker Container, Raspberry or own installation based on Debian). Unfortunately either node-red crashes or the device list remains empty. Does anyone has an idea to solve the problem?

nikkow commented 4 years ago

This issue is most likely related to the changes that occurred on the (unofficial) Somfy API used in the v1 of this project.

I just released the v2, using the new API, officially available for third-party software like this one.

The issue you encountered should be fixed by upgrading the plugin to v2 (either through the command npm i node-red-contrib-tahoma@2.0.0 in your .node-red install folder, or using the plugin palette)

However, please note that you will have to reconfigure the link between this module and your Tahoma box. Please read the read-me file and let me know if anything remains unclear.