Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node red won't start up after install node from Home Assistant Hassio #9

Closed
tsien-bier opened this issue Dec 11, 2018 · 23 comments
Closed

Comments

@tsien-bier
Copy link

tsien-bier commented Dec 11, 2018

After installing node_red-contrib-nefit-easy from the node-red configuration nodes - install tab node-red wont't come up again. The web-interfaces is unavailable. When i check the log i see te following;

11 Dec 20:52:32 - [info] Installing module: node-red-contrib-nefit-easy2, version: 1.3.0
11 Dec 20:52:54 - [info] Installed module: node-red-contrib-nefit-easy2
11 Dec 20:52:56 - [info] Added node types:
11 Dec 20:52:56 - [info] - node-red-contrib-nefit-easy2:nefit-easy
11 Dec 20:52:56 - [info] - node-red-contrib-nefit-easy2:nefit-easy-config
11 Dec 20:52:56 - [red] Uncaught Exception:
11 Dec 20:52:56 - TypeError: tls.convertNPNProtocols is not a function
at new TLSSocket (_tls_wrap.js:269:9)
at Server. (_tls_wrap.js:852:18)
at emitOne (events.js:116:13)
at Server.emit (events.js:211:7)
at TCP.onconnection (net.js:1570:8)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hassio-addon-node-red@ start: node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hassio-addon-node-red@ start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-12-11T19_52_56_108Z-debug.log

hassio-addon-node-red@ start /opt
node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"
11 Dec 20:53:02 - [info]

What is wrong here? I used the component before. Then there was no problem en could use the installed components en connect to my Nefit Easy.

@tsien-bier tsien-bier changed the title Node red won't start up after install node from home Assistant Hassio Node red won't start up after install node from Home Assistant Hassio Dec 11, 2018
@RaimondB
Copy link
Owner

RaimondB commented Dec 11, 2018

To be able to find the cause, some questions.
Since which version of nefit-easy2 does this problem occur?
Does the problem go away when you uninstall nefit-easy2?
(to make sure it is not somthing else that changed in the same period)

I could imagine it being related to the nodejs version you are running.
See for instance this change: https:/nodejs/node/pull/19403/files

@tsien-bier
Copy link
Author

  1. I don't know since which version of nefit-easy2 this problem occurs. I used it before with no problems about 2 months ago.
  2. I can't uninstall from the nod-red web-interface because node-red isn't running so i have to restore from a back-up. Node red is running ok then.
  3. I tried installing an other node and this is working well. The extra nodes appear in the left node-red interface pane and are working.

@RaimondB
Copy link
Owner

RaimondB commented Dec 11, 2018

  1. To get the "last working version for you", when you restore the backup and go to the palette manager. When you go to the installed tab, and filter on "daylight" it should show the installed version.

  2. You can also try uninstalling the npm way, by going to the directory where node-red's modules are located (it is probably mentioned in the Hassio config) and then go into the .node-red directory.
    (often it is located under the home directory of the user that is running the program, on linux based systems ~/.node-red

Then run
npm uninstall node-red-contrib-nefit-easy2
The problem should then go away and you could try a reinstall from the palette.
You can also install previously published versions by running (in the same directory)

npm install [email protected]

@tsien-bier
Copy link
Author

Already thank for your help. I'm a complete new on this platform and have to learn a lot. My programming and configuration skills are not up-to date.

  1. I have nothing installed with comes up with the filter daylight. B.t.w. the working version of node-red-contrib-easy was in a previous installed version of hassio. (about 2 months ago)
  2. Can't run npm because hassio is a docker appliance of Home Assistant. Only specific HA commands will work on the command line. Installation is by a graphical system in Home Assistant addon store. This has a lot of advantages for people like me. Disadvantage is that tweaking and debugging is difficult.

@RaimondB
Copy link
Owner

Oops, sorry I was refering to the wrong node, please try to filter on nefit or easy. It will probably be version 1.2.0 (I expect)

@tsien-bier
Copy link
Author

Tested the same with a ubuntu 18.4 server in Oracle Virtualbox. This is working well. No errors. I think the error has somthing to do with the way Node-Red is supplied in Hassio. As i explained before is node-red installed as add-on in Hassio. See: https://community.home-assistant.io/t/community-hass-io-add-on-node-red/55023. I am going to post the error there and hope for a solution.

@RaimondB
Copy link
Owner

OK, in the mean time I will also try to get a Hassio setup so that I can maybe detect what's going on to see if it has a relation with a library in the nefit module.

@tsien-bier
Copy link
Author

tsien-bier commented Dec 20, 2018

Posted the error here.

@RaimondB
Copy link
Owner

I thought it might be realted to running nwer versions of NodeJS. I have tested it also with Node 10 and confirmed that this works as expected. So the Node JS version does not seem to be the issue

@tsien-bier
Copy link
Author

Frenk (Creator of Hassio add-on node-red) answerd:

Seems like it is missing some libraries that the node needs?
Not sure. I cannot support all nodes out there, that would be impossible.
I'm sorry to say, but in this case, you are on your own.
Maybe somebody in the community is able to help?

The problem isn't solved now. Node Red refuses to run when loading the Nefit-Node.

@RaimondB
Copy link
Owner

There is a seemingly related issue mentioned on the base library for nefit that I am using:
robertklep/homebridge-nefit-easy#12

Maybe they can clarify how they managed to solve the problem.

@RaimondB
Copy link
Owner

The function mentioned seems to be removed in NodeJS 10 and deprecated since NodeJS 9.
nodejs/node#14602

@tsien-bier What version of NodeJS is running in your setup?

@tsien-bier
Copy link
Author

The log says:

28 Dec 17:17:45 - [info] Node-RED version: v0.19.5
28 Dec 17:17:45 - [info] Node.js  version: v8.14.0
28 Dec 17:17:45 - [info] Linux 4.14.78-v7 arm LE
28 Dec 17:17:46 - [info] Loading palette nodes
28 Dec 17:17:51 - [info] Settings file  : /etc/node-red/config.js
28 Dec 17:17:51 - [info] Context store  : 'default' [module=memory]
28 Dec 17:17:51 - [info] User directory : /config/node-red/
28 Dec 17:17:51 - [warn] Projects disabled : editorTheme.projects.enabled=false
28 Dec 17:17:51 - [info] Flows file     : /config/node-red/flows.json
28 Dec 17:17:51 - [info] Server now running at https://127.0.0.1:1880/
28 Dec 17:17:51 - [info] Starting flows
28 Dec 17:17:51 - [info] Started flows
28 Dec 17:17:51 - [info] [server:Home Assistant] WebSocket Connected to http://hassio/homeassistant

So it has to be: v8.14.0

@RaimondB
Copy link
Owner

I tried Node 8.14 and this works, so the node version is not the issue. As stated in the other issue at the base nefit libraries, it must be related to one of the other plugins being outdated. You could try a clean setup of hassio/node-red with just the nefit-easy node. This should work.
Then start adding the other nodes/plugins one by one. As soon as things break down, you have found the culprit ;-)

@RaimondB
Copy link
Owner

RaimondB commented Dec 30, 2018

@tsien-bier I have tested a clean hassio + node-red setup, with just the nefit-easy2 module and everything works as expected.
See below the versions from the log.
This means the problem must be probably related to one of the other node-red modules you have installed via the palette. Do you know which these are?

Another plausible cause could be the use of ssl; do you have ssl:"true" in your node-red addon config?

Btw, I tested this with 1.4.0 of the nefit-easy2 module, I recently added some features and upgraded to a newer version of the nefit-commands library for this. It should not have impact, but you never know. So it might be good if you also retest using 1.4.0

-----------------------------------------------------------
 Hass.io Add-on: Node-RED v1.2.2
 Flow-based programming for the Internet of Things
 From: Community Hass.io Add-ons
 By: Franck Nijhof <[email protected]>
-----------------------------------------------------------
 amd64 / HassOS 2.4 / HA 0.84.6 / SU 141 / stable
-----------------------------------------------------------

@tsien-bier
Copy link
Author

I'm going to try the your suggestions. I didn't install any nodes via the palette, it is a clean install of hassio node-red install. So an other node can not be the issue.

@tsien-bier
Copy link
Author

tsien-bier commented Jan 2, 2019

Tested it again with a clean node-red addon installation. Again the nefit node causes my node-red service to crash. After clicking install I get the massage "Nodes add to Pallet (Two Nefit nodes). Some seconds after that massage the message "Lost connection to server. Reconnect ...... The log looks the same as the first message in this Issue.
I don't have any ideas to solve this problem. Maybe another Home Assistant installation should be better. I'm thinking about Hasbian. The disadvantage is that there are no add-ons but maybe also less errors.

@tsien-bier
Copy link
Author

tsien-bier commented Jan 3, 2019

Solved the issue now. I found a work-arround. In stead of adding the node fia the UI of node-red i placed the addon in the config file of hassio in the npm_packages section.:

{
  "log_level": "info",
  "credential_secret": "xxxx",
  "http_node": {
    "username": "xxx",
    "password": "xxxxx"
  },
  "http_static": {
    "username": "xxxx",
    "password": "xxxxx"
  },
  "port": 1880,
  "ssl": false,
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem",
  "require_ssl": false,
  "system_packages": [],
  "npm_packages": [
    "node-red-contrib-nefit-easy2"
  ],
  "init_commands": []
}

Now the nefit node is in the Node-red UI and i can configure the node.

But the node is not working as espected. I get no info from the Bosch Server.

I come back here with more information.

@RaimondB
Copy link
Owner

RaimondB commented Jan 3, 2019

I have just published a new version 1.4.1 in which the peerDependency is removed. It is only needed to develop on the node, not for running it so it is redundant.
However, this is just a warning and should not influence the operation.

Also, it seems that by default hassio adds a lot of packages already.

added 30 packages from 33 contributors, updated 4 packages and audited 2325 packages in 38.163s
found 2 vulnerabilities (1 low, 1 moderate)

Btw, when I run npm audit on the nefit2 module itself, I get this result:

                       === npm audit security report ===

found 0 vulnerabilities
 in 1930 scanned packages

So the vulnerabilities must be coming from one of the already installed packages by hassio nodered addon.

@tsien-bier
Copy link
Author

tsien-bier commented Jan 4, 2019

Hello Raimond,

I found the same warnings in my log. But anyway, the nefit node is added to hassio node-red.

Yesterday i already told that the node is not working as aspect-ed. The node connects to the Bosch service but but doesn't get information. I get in error in the debug pane. The same error i find back in de log:

4 Jan 08:15:51 - [info] [nefit-easy-config:38426061.dbbd4] Nefit Easy 457014155 connected to Bosch backend.
4 Jan 08:15:51 - [error] [nefit-easy-config:38426061.dbbd4] Nefit initialization : SyntaxError: Unexpected token  in JSON at position 0

I don't think i doe anything wrong
In the debug pane i see:

4-1-2019 08:24:57node: 38426061.dbbd4
msg : string[76]
"Nefit initialization : SyntaxError: Unexpected token  in JSON at position 0"

De status of the node is: Disconected.

@RaimondB
Copy link
Owner

RaimondB commented Jan 5, 2019

You probably have not configured the correct password?
The configuration you need is the same as for the mobile app.

@tsien-bier
Copy link
Author

Changed the password. The problem was that i used the API password that i used with IFTTT. This password appear not to be the same as the mobile app. Everything is now working.

I'm very happy i can now continue with my little hobby project at home.

Thanks for your help and i wish you a good Sunday.

@RaimondB
Copy link
Owner

RaimondB commented Jan 6, 2019

Great, good to hear :-)

@RaimondB RaimondB closed this as completed Jan 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants