windkh / node-red-contrib-shelly

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

Node Red crashes after an Error #98

Closed niwre2019 closed 2 years ago

niwre2019 commented 2 years ago

I keep having the problem that due to an error with the plugin Node Red crashes completely. Is there any way to catch this error so that this does not happen? I have attached the relevant part from the log. I am using the current version 10.5.0.

Oct 28 15:43:20 homebridge Node-RED[13852]: 28 Oct 15:43:20 - [red] Uncaught Exception: Oct 28 15:43:20 homebridge Node-RED[13852]: 28 Oct 15:43:20 - [error] Error: timeout of 5000ms exceeded Oct 28 15:43:20 homebridge Node-RED[13852]: at createError (/home/pi/.node-red/node_modules/node-red-contrib-shelly/node_modules/axios/lib/core/createError.js:16:15) Oct 28 15:43:20 homebridge Node-RED[13852]: at RedirectableRequest.handleRequestTimeout (/home/pi/.node-red/node_modules/node-red-contrib-shelly/node_modules/axios/lib/adapters/http.js:369:16) Oct 28 15:43:20 homebridge Node-RED[13852]: at RedirectableRequest.emit (node:events:513:28) Oct 28 15:43:20 homebridge Node-RED[13852]: at RedirectableRequest.emit (node:domain:489:12) Oct 28 15:43:20 homebridge Node-RED[13852]: at Timeout.<anonymous> (/home/pi/.node-red/node_modules/follow-redirects/index.js:164:12) Oct 28 15:43:20 homebridge Node-RED[13852]: at listOnTimeout (node:internal/timers:559:17) Oct 28 15:43:20 homebridge Node-RED[13852]: at processTimers (node:internal/timers:502:7) Oct 28 15:43:20 homebridge systemd[1]: nodered.service: Main process exited, code=exited, status=1/FAILURE Oct 28 15:43:20 homebridge systemd[1]: nodered.service: Failed with result 'exit-code'.

windkh commented 2 years ago

Thanks for reporting. When does that happen? Reproducable? What shelly do you use?

windkh commented 2 years ago

Can you send me your flow?

niwre2019 commented 2 years ago

Unfortunately, I cannot reproduce it. Before this crash everything ran for at least 2 weeks without problems. It is a Shelly 3EM that does not have the best wifi connection, it is installed in the basement in my PV system.

[{"id":"8f9bff25fd1d54bb","type":"function","z":"ec953230.764868","name":"Gesamtverbrauch","func":"var power1 = msg.payload.emeters[0].power;\nvar power2 = msg.payload.emeters[1].power;\nvar power3 = msg.payload.emeters[2].power;\nmsg.payload = (power1 + power2 + power3);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":290,"y":1880,"wires":[["f37e438e756e6833"]]},{"id":"f37e438e756e6833","type":"change","z":"ec953230.764868","name":"Gesamt","rules":[{"t":"set","p":"topic","pt":"msg","to":"Gesamt","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":1880,"wires":[["5b8320b7071fc38a","b0efe8fa48a828ab"]]},{"id":"5b8320b7071fc38a","type":"ui_gauge","z":"ec953230.764868","name":"Tacho Shelly-PV","group":"43673e1ab7c2f8bd","order":8,"width":0,"height":0,"gtype":"gage","title":"Photovoltaik aktuell","label":"Wh","format":"{{value | number:0}}","min":0,"max":"6000","colors":["#ff4015","#fefb41","#669d34"],"seg1":"1000","seg2":"3000","className":"","x":620,"y":1860,"wires":[]},{"id":"ba3111cbfb7c3248","type":"ui_chart","z":"ec953230.764868","name":"","group":"43673e1ab7c2f8bd","order":9,"width":"0","height":"0","label":"Photovoltaik kW/h","chartType":"line","legend":"true","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"6000","removeOlder":"1","removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#3a87fe","#e22400","#feb43f","#2ca02c","#98df8a","#a96800","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":750,"y":1900,"wires":[[]]},{"id":"b0efe8fa48a828ab","type":"delay","z":"ec953230.764868","name":"30 Sek","pauseType":"queue","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"30","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":590,"y":1900,"wires":[["ba3111cbfb7c3248"]]},{"id":"5fa1571788567810","type":"shelly-gen1","z":"ec953230.764868","hostname":"192.168.123.66","description":"Shelly-PV","mode":"polling","server":"","outputmode":"event","uploadretryinterval":5000,"pollinginterval":"5000","pollstatus":true,"getstatusoncommand":false,"devicetype":"Measure","outputs":2,"credentials":{"username":"","password":""},"x":120,"y":1880,"wires":[["8f9bff25fd1d54bb"],[]]},{"id":"43673e1ab7c2f8bd","type":"ui_group","name":"Tacho","tab":"70d805a73f1d49c3","order":1,"disp":false,"width":"6","collapse":false,"className":""},{"id":"70d805a73f1d49c3","type":"ui_tab","name":"PV-Anlage","icon":"dashboard","order":3,"disabled":false,"hidden":false}]

windkh commented 2 years ago

I added some try catch statements in the code. Please test 10.6.0

niwre2019 commented 2 years ago

Thanks for the quick help, I will test the new version.

windkh commented 2 years ago

hm if that does not help. you could try to add a catch node to the flow... I con only guess what could have been the problem from the information you provided.

niwre2019 commented 2 years ago

Maybe the error is fixed with the update, otherwise I will still try that with the CATCH Node. As we all know, hope dies last.