windkh / node-red-contrib-shelly

Shelly control nodes for node red.
MIT License
33 stars 21 forks source link

Node-Red doesn't start after exchanged Shelly node in flow #126

Closed danlun closed 11 months ago

danlun commented 11 months ago

I just removed a non working shelly 2.5 node in a Node-Red flow. I then added anew Shelly Plus 2PM as a node and included it in the same place as the old node was removed from. After this Node-Red has died on me when trying to use it. It says the module hasn’t started and when I try to start, it doesn’t so I don’t get into my flows any longer. I was able to restart the system and under configuration switch on Safe mode but as soon as that is switched off the Node red is snot starting. The log file I can get looks like this: Do I need to do anything in any YAML-file?


Add-on version: 14.5.0 You are running the latest version of this add-on. System: Home Assistant OS 10.5 (aarch64 / raspberrypi4-64) Home Assistant Core: 2023.9.2 Home Assistant Supervisor: 2023.09.2

s6-rc: info: service base-addon-banner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service base-addon-log-level: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service base-addon-log-level successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service init-nginx: starting s6-rc: info: service init-customizations: starting s6-rc: info: service init-customizations successfully started s6-rc: info: service init-nodered: starting s6-rc: info: service init-nginx successfully started up to date, audited 95 packages in 5s 19 vulnerabilities (4 moderate, 9 high, 6 critical) To address issues that do not require attention, run: npm audit fix To address all issues (including breaking changes), run: npm audit fix --force Run "npm audit" for details. s6-rc: info: service init-nodered successfully started s6-rc: info: service nodered: starting s6-rc: info: service nodered successfully started s6-rc: info: service nginx: starting s6-rc: info: service nginx successfully started s6-rc: info: service legacy-services: starting s6-rc: info: service legacy-services successfully started [16:16:41] INFO: Starting Node-RED...

start node $NODE_OPTIONS node_modules/node-red/red.js --settings /etc/node-red/config.js 24 Sep 16:16:46 - [info] Welcome to Node-RED

24 Sep 16:16:46 - [info] Node-RED version: v3.1.0 24 Sep 16:16:46 - [info] Node.js version: v18.17.1 24 Sep 16:16:46 - [info] Linux 6.1.21-v8 arm64 LE 24 Sep 16:16:48 - [info] Loading palette nodes 24 Sep 16:16:55 - [info] Dashboard version 3.6.0 started at /endpoint/ui 24 Sep 16:16:57 - [info] Settings file : /etc/node-red/config.js 24 Sep 16:16:57 - [info] Context store : 'default' [module=memory] 24 Sep 16:16:57 - [info] User directory : /config/node-red/ 24 Sep 16:16:57 - [warn] Projects disabled : editorTheme.projects.enabled=false 24 Sep 16:16:57 - [info] Flows file : /config/node-red/flows.json 24 Sep 16:16:57 - [info] Server now running at http://127.0.0.1:46836/ 24 Sep 16:16:57 - [info] Starting flows [16:16:57] INFO: Starting NGinx... 24 Sep 16:16:57 - [info] Started flows 24 Sep 16:16:57 - [red] Uncaught Exception: 24 Sep 16:16:57 - [error] TypeError: Cannot read properties of undefined (reading 'startsWith') at /config/node-red/node_modules/node-red-contrib-shelly/shelly/99-shelly.js:273:37 at Request._callback (/config/node-red/node_modules/node-red-contrib-shelly/shelly/99-shelly.js:30:17) at Request.self.callback (/config/node-red/node_modules/request/request.js:188:22) at Request.emit (node:events:514:28) at Request. (/config/node-red/node_modules/request/request.js:1171:10) at Request.emit (node:events:514:28) at IncomingMessage. (/config/node-red/node_modules/request/request.js:1091:12) at Object.onceWrapper (node:events:628:28) at IncomingMessage.emit (node:events:526:35) at endReadableNT (node:internal/streams/readable:1359:12) [16:16:57] INFO: Service Node-RED exited with code 1 (by signal 0) s6-rc: info: service legacy-services: stopping s6-rc: info: service legacy-services successfully stopped s6-rc: info: service nginx: stopping [16:16:58] INFO: Service NGINX exited with code 0 (by signal 0) s6-rc: info: service nginx successfully stopped s6-rc: info: service init-nginx: stopping s6-rc: info: service nodered: stopping s6-rc: info: service init-nginx successfully stopped s6-rc: info: service nodered successfully stopped s6-rc: info: service init-nodered: stopping s6-rc: info: service init-nodered successfully stopped s6-rc: info: service init-customizations: stopping s6-rc: info: service init-customizations successfully stopped s6-rc: info: service legacy-cont-init: stopping s6-rc: info: service legacy-cont-init successfully stopped s6-rc: info: service fix-attrs: stopping s6-rc: info: service base-addon-log-level: stopping s6-rc: info: service fix-attrs successfully stopped s6-rc: info: service base-addon-log-level successfully stopped s6-rc: info: service base-addon-banner: stopping s6-rc: info: service base-addon-banner successfully stopped s6-rc: info: service s6rc-oneshot-runner: stopping s6-rc: info: service s6rc-oneshot-runner successfully stopped

windkh commented 11 months ago

@danlun hm I can only see one line that makes use of startsWith and that is somewhere at 373 in the current version of 99-shelly.js. If you have access to the installation folder where 99-shelly.js is, then you could just delete the file and the html file next to it and then you should be able to restart node-red. Then you should upgrade the node-red-contrib-shelly nodes to the latest version

danlun commented 11 months ago

Thanks @windkh I will see, but I think I have access, suppose this is in the file system of the HA installation somewhere (sorry to be amateur)?

danlun commented 11 months ago

@windkh its done, the files renamed. But I thought, when the system restarts these files were coming back, but they don't. Node-Red for sure starts again but my Shelly Nodes has disappeared and the text "Flows stopped due to missing node types." is at the top. The nodes are exchanged with dotted boxes and "unknown: shell-roller-shutter". I assume where it goes wrong now is I don't know where/how to "upgrade the node-red-contrib-shelly nodes"?

windkh commented 11 months ago

@danlun just go to the pallete and reinstall node-red-contrib-shelly. Then you will get the latest version which should work for you. If not, let me know

danlun commented 11 months ago

Wohohoo. That little thing took me from version 1.3.1 to version 10.13.7….. Wonder it has been working so long. I have forgotten about the Palette, not a big user of Node-Red but it's really good when used. Thanks will try out the new nodes :-)