Modbus connection stop

Hello,

I d like to know if there is a solution in order to stop/start a modbus connection with an inject button/function ? I tried with some stop/kill command but if the polling is stopped, the data are always read from the PLC..

When i clik the button the PLC polling is stopped but always a read in the response... How to really Stop/restart the connection ?

Code in the function:

msg.payload={};
msg.payload.name ="PLC LABO DEFAUTS";
msg.stop=true;
return msg;

And "kill" instead of "stop" do nothing

That will depend on if that functionality has been programmed within the contrib-node you are using.

Have you read the ReadMe / wiki (if there is one) on the nodes page on flows.nodered.org or on the nodes github page?

yes this is where i found these Stop/kill examples ...

But this don t help me to do what i want

1 Like

Has anyone else experienced the Modbus just stall? Ie it says it’s active - no errors - but no data comes thru.

1 Like

I experienced the same problems. Did you find a solution for it? Is there some possibility for jump starting the connection again, other then restarting node-red?

So far no progress. The Modbus keeps stalling. Also the Modbus data is not correct. Worse still half my panels have stopped generating. It’s a mess and Solaredge are very unresponsive.

Regards,

Ian

My experience is a bit different. Also communicate with 2 solaredge inverters SE2200h and with good succes. Had lot of service from Solaredge with setting up modbus tcp communications. The connections can run for days with good results. Only sometimes 1 of the connections stops providing data. Then I have to restart node-red again.

Maybe I can help somehow? Did you configure connections with max. 1 sec time interval. If faster the connections will stall for shure. Max. block size is 125 registers! Do you use modbus TCP, or have you installed RS485 cards, so modbus RTU?

Gr.
Henk Kasbergen


Solved this problem in my case by using a Delay Node to limit the rate.

Multiple connections into one Delay(Rate Limit option) Node set to one message every 4 seconds. Will try reducing in due course.

I found out something is happening in the solaredge inverters (I have 2 of them) at exactly 22:45 at night (MET). This causes the communication stalling sometimes in one inverter, sometimes both. So I decided to not communicate with the iverters anymore during the nighttime. Maybe this will work for you too IanMidd? Here is my flow that is working for me.

[{"id":"18bf1cef.46cd6b","type":"tab","label":"Solaredge","disabled":false,"info":""},{"id":"705e3afe.585974","type":"link out","z":"18bf1cef.46cd6b","name":"Solaredge_Power","links":["27453446.3ce13c","9745062d.722af"],"x":735,"y":920,"wires":[]},{"id":"b5af2103.364198","type":"http request","z":"18bf1cef.46cd6b","name":"Solaredge: Details","method":"use","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":650,"y":1260,"wires":[["47071059.3c1fc","cea5da52.18d678","c82ee6e0.da93b8"]]},{"id":"eb06d23f.174b9","type":"inject","z":"18bf1cef.46cd6b","name":"24 H","props":[{"p":"payload"}],"repeat":"86400","crontab":"","once":true,"onceDelay":"5","topic":"","payload":"","payloadType":"date","x":200,"y":1260,"wires":[["d4eee939.33962"]]},{"id":"d4eee939.33962","type":"function","z":"18bf1cef.46cd6b","name":"URL: Details","func":"var solweb = global.get('solaredge.website');\nvar siteID = global.get('solaredge.siteID');\nvar api_key = global.get('solaredge.api_key');\nvar item = \"details\";\n\nvar url_txt = solweb + siteID + \"/\" + item + \".json?api_key=\" + api_key;\n\nmsg = {method: \"GET\", url: url_txt }\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":410,"y":1260,"wires":[["b5af2103.364198"]]},{"id":"47071059.3c1fc","type":"ui_text","z":"18bf1cef.46cd6b","group":"a58040a0.442b88","order":1,"width":0,"height":0,"name":"Installation date","label":"Inst. datum","format":"{{msg.payload.details.installationDate}}","layout":"row-spread","x":1080,"y":1220,"wires":[]},{"id":"cea5da52.18d678","type":"ui_text","z":"18bf1cef.46cd6b","group":"a58040a0.442b88","order":2,"width":0,"height":0,"name":"Peak power","label":"Max. vermogen [Wp] ","format":"{{msg.payload.details.peakPower * 1000}}","layout":"row-spread","x":1290,"y":1260,"wires":[]},{"id":"7e8f8564.d86ef4","type":"comment","z":"18bf1cef.46cd6b","name":"Various data via API requests","info":"","x":240,"y":1020,"wires":[]},{"id":"2472a95a.f1fe06","type":"ui_text","z":"18bf1cef.46cd6b","group":"a58040a0.442b88","order":3,"width":0,"height":0,"name":"Solar panels","label":"Zonnepanelen","format":"{{msg.payload}}","layout":"row-spread","x":1110,"y":1280,"wires":[]},{"id":"c82ee6e0.da93b8","type":"function","z":"18bf1cef.46cd6b","name":"Solar panels","func":"var brand = msg.payload.details.primaryModule.manufacturerName;\nvar model = msg.payload.details.primaryModule.modelName;\nvar P_max = msg.payload.details.primaryModule.maximumPower;\n\nmsg = {payload: brand + \" / \" + model + \" / \" + P_max + \" Wp\"}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":910,"y":1280,"wires":[["2472a95a.f1fe06"]]},{"id":"31411359.b80aec","type":"ui_gauge","z":"18bf1cef.46cd6b","name":"Power","group":"639d127.7bbe86c","order":1,"width":4,"height":3,"gtype":"gage","title":"Totaal","label":"watt","format":"{{value}}","min":0,"max":"5000","colors":["#00b33c","#00b33c","#00b33c"],"seg1":"","seg2":"","x":1090,"y":940,"wires":[]},{"id":"c08ff08d.7bdc98","type":"http request","z":"18bf1cef.46cd6b","name":"Solaredge: Overview","method":"use","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":660,"y":1120,"wires":[["d9bdff3d.5aca98"]]},{"id":"4e484f5.66f06b","type":"inject","z":"18bf1cef.46cd6b","name":"15 min","props":[{"p":"payload"}],"repeat":"290","crontab":"","once":true,"onceDelay":"5","topic":"","payload":"","payloadType":"date","x":210,"y":1120,"wires":[["8d6a3049.ea3ec8"]]},{"id":"8d6a3049.ea3ec8","type":"function","z":"18bf1cef.46cd6b","name":"URL: Overview","func":"var solweb = global.get('solaredge.website');\nvar siteID = global.get('solaredge.siteID');\nvar api_key = global.get('solaredge.api_key');\nvar item = \"overview\";\n\nvar url_txt = solweb + siteID + \"/\" + item + \".json?api_key=\" + api_key;\n\nmsg = {method: \"GET\", url: url_txt }\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":420,"y":1120,"wires":[["c08ff08d.7bdc98"]]},{"id":"5942f03b.574a1","type":"ui_text","z":"18bf1cef.46cd6b","group":"dafd9a25.e764f","order":1,"width":8,"height":1,"name":"Last update time","label":"Laatste update","format":"{{msg.payload}}","layout":"row-spread","x":1290,"y":1060,"wires":[]},{"id":"f57afb15.fc63d8","type":"ui_text","z":"18bf1cef.46cd6b","group":"dafd9a25.e764f","order":5,"width":8,"height":1,"name":"Lifetime","label":"Totale opbrenst [kWh]","format":"{{msg.payload}}","layout":"row-spread","x":1460,"y":1080,"wires":[]},{"id":"769cc001.9b146","type":"ui_text","z":"18bf1cef.46cd6b","group":"dafd9a25.e764f","order":4,"width":8,"height":1,"name":"Last year","label":"Dit jaar [kWh]","format":"{{msg.payload}}","layout":"row-spread","x":1600,"y":1100,"wires":[]},{"id":"e802e51b.56ef","type":"ui_text","z":"18bf1cef.46cd6b","group":"dafd9a25.e764f","order":3,"width":8,"height":1,"name":"Last month","label":"Deze maand [kWh]","format":"{{msg.payload}}","layout":"row-spread","x":1470,"y":1140,"wires":[]},{"id":"70dc5b5f.b1e83c","type":"ui_text","z":"18bf1cef.46cd6b","group":"dafd9a25.e764f","order":2,"width":8,"height":1,"name":"Today","label":"Vandaag [kWh]","format":"{{msg.payload}}","layout":"row-spread","x":1330,"y":1160,"wires":[]},{"id":"d9bdff3d.5aca98","type":"function","z":"18bf1cef.46cd6b","name":"Opbrengsten kWh","func":"var Lastupdate = msg.payload.overview.lastUpdateTime;\nvar LifeTime = msg.payload.overview.lifeTimeData.energy;\nvar LastYear = msg.payload.overview.lastYearData.energy;\nvar LastMonth = msg.payload.overview.lastMonthData.energy;\nvar Today = msg.payload.overview.lastDayData.energy;\nglobal.set('solaredge.kWh.today', Today / 1000);\nglobal.set('solaredge.kWh.lastmonth', LastMonth / 1000);\nglobal.set('solaredge.kWh.lastyear', LastYear / 1000);\nglobal.set('solaredge.kWh.total', Math.floor(LifeTime / 1000));\n\nmsg1 = {payload: Lastupdate}\nmsg2 = {payload: Math.floor(LifeTime / 1000) }\nmsg3 = {payload: Math.floor(LastYear / 1000) }\nmsg4 = {payload: Math.floor(LastMonth / 1000) }\nmsg5 = {payload: (Today / 1000).toFixed(2) }\n\nreturn [msg1, msg2, msg3, msg4, msg5];","outputs":5,"noerr":0,"initialize":"","finalize":"","libs":[],"x":930,"y":1120,"wires":[["5942f03b.574a1"],["f57afb15.fc63d8"],["769cc001.9b146"],["e802e51b.56ef"],["70dc5b5f.b1e83c","4d6a0874.add628"]]},{"id":"33a98f7.bdf417","type":"function","z":"18bf1cef.46cd6b","name":"URL: Inventory","func":"var solweb = global.get('solaredge.website');\nvar siteID = global.get('solaredge.siteID');\nvar api_key = global.get('solaredge.api_key');\nvar item = \"inventory\";\n\nvar url_txt = solweb + siteID + \"/\" + item + \".json?api_key=\" + api_key;\n\nmsg = {method: \"GET\", url: url_txt }\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":420,"y":1340,"wires":[["fc48317a.8f8bb8"]]},{"id":"d7ec44b7.f8137","type":"inject","z":"18bf1cef.46cd6b","name":"24 H","props":[{"p":"payload"}],"repeat":"86400","crontab":"","once":true,"onceDelay":"5","topic":"","payload":"","payloadType":"date","x":200,"y":1340,"wires":[["33a98f7.bdf417"]]},{"id":"fc48317a.8f8bb8","type":"http request","z":"18bf1cef.46cd6b","name":"Solaredge: Inventory","method":"use","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":660,"y":1340,"wires":[["3955398a.9d33ce"]]},{"id":"3955398a.9d33ce","type":"function","z":"18bf1cef.46cd6b","name":"Inverters","func":"// Inverter muurkant is object 0.\n// Inverter buitenkant is object 1.\n\nvar inv1 = \"Muurkant\";\nvar inv2 = \"Buitenkant\";\nvar model1 = msg.payload.Inventory.inverters[0].model;\nvar model2 = msg.payload.Inventory.inverters[1].model;\nvar sn_1 = msg.payload.Inventory.inverters[0].SN;\nvar sn_2 = msg.payload.Inventory.inverters[1].SN;\nvar cpu1 = msg.payload.Inventory.inverters[0].cpuVersion;\nvar cpu2 = msg.payload.Inventory.inverters[1].cpuVersion;\nvar opt1 = msg.payload.Inventory.inverters[0].connectedOptimizers;\nvar opt2 = msg.payload.Inventory.inverters[1].connectedOptimizers;\n\n\n// Hier wordt data samengesteld voor message naar een tabel\n//tabel = [  {Drive: d1, Size: s1, Used: u1, Free: f1, Mount: m1},\n//           {Drive: d2, Size: s2, Used: u2, Free: f2, Mount: m2}  ];\n\n\ntabel = [ {Inverter: inv1, Model: model1, Snr: sn_1, CPU: cpu1, Optimizers: opt1}, \n          {Inverter: inv2, Model: model2, Snr: sn_2, CPU: cpu2, Optimizers: opt2} ]; \n\n\nmsg = {payload: tabel}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":900,"y":1340,"wires":[["fcf94f2d.a528b"]]},{"id":"fcf94f2d.a528b","type":"ui_template","z":"18bf1cef.46cd6b","group":"a58040a0.442b88","name":"Two dimension array table","order":4,"width":8,"height":4,"format":"<table id=\"table\" border=\"1\">\n <tr>\n <th>Inverter</th> \n <th>{{msg.payload[0].Inverter}}</th>\n <th>{{msg.payload[1].Inverter}}</th>\n </tr>\n <tbody>\n <tr>\n <th>Model</th> \n <td>{{msg.payload[0].Model}}</td>\n <td>{{msg.payload[1].Model}}</td>\n </tr>\n <tr>\n <th>Serienr</th> \n <td>{{msg.payload[0].Snr}}</td>\n <td>{{msg.payload[1].Snr}}</td>\n </tr>\n <tr>\n <th>CPU</th> \n <td>{{msg.payload[0].CPU}}</td>\n <td>{{msg.payload[1].CPU}}</td>\n </tr>\n <tr>\n <th>Optimizers</th> \n <td>{{msg.payload[0].Optimizers}}</td>\n <td>{{msg.payload[1].Optimizers}}</td>\n </tr>\n </tbody>\n</table>\n\n","storeOutMessages":false,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":1160,"y":1340,"wires":[[]]},{"id":"dcf2ac92.86d65","type":"function","z":"18bf1cef.46cd6b","name":"Inverter actual values","func":"var result, sf;\n\nglobal.set('solaredge.PV2.discription', \"Buitenkant\");\n\nsf = Math.pow(10, 65536 - msg.payload[75]);  // Scalefactor\nresult = msg.payload[71] / sf;\nglobal.set('solaredge.PV2.current', result);\nmsg1 = {topic: \"Current [Amp]\", payload: result}\n\nsf = Math.pow(10, 65536 - msg.payload[82]);  // Scalefactor\nresult = msg.payload[76] / sf;\nglobal.set('solaredge.PV2.voltageAC', result);\nmsg2 = {topic: \"Voltage [Vac]\", payload: result}\n\nsf = Math.pow(10, 65536 - msg.payload[84]);  // Scalefactor\nresult = msg.payload[83] / sf;\nglobal.set('solaredge.PV2.power', result);\nmsg3 = {topic: \"Power [Watt]\", payload: result}\n\nsf = Math.pow(10, 65536 - msg.payload[86]);  // Scalefactor\nresult = msg.payload[85] / sf;\nglobal.set('solaredge.PV2.frequency', result);\nmsg4 = {topic: \"Frequentie [Herz]\", payload: result}\n\nsf = Math.pow(10, 65536 - msg.payload[99]);  // Scalefactor\nresult = msg.payload[98] / sf;\nglobal.set('solaredge.PV2.voltageDC', result);\nmsg5 = {topic: \"Voltage [Vdc]\", payload: result}\n\n// Status\nvar StatusCode = msg.payload[107];\nvar StatusText;\nswitch(StatusCode)\n{\n    case 1:\n        StatusText = \"Off\";\n        break;\n    case 2:\n        StatusText = \"Night mode\";\n        break;\n    case 3:\n        StatusText = \"Waking up\";\n        break;  \n    case 4:\n        StatusText = \"Producing power\";\n        break;  \n    case 5:\n        StatusText = \"Standby\";\n        break;  \n    case 6:\n        StatusText = \"Shutting down\";\n        break;  \n    case 7:\n        StatusText = \"Fault\";\n        break;  \n    case 8:\n        StatusText = \"Standby/Maintenance\";\n        break;  \n    default:\n        StatusText = \"Undefined\";\n}\nglobal.set('solaredge.PV2.status', StatusText);\nmsg6 = {topic: \"PV2 Status -Buitenkant-\", payload: StatusText}\n\nsf = Math.pow(10, 65536 - msg.payload[106]);  // Scalefactor\nresult = msg.payload[103] / sf;\nglobal.set('solaredge.PV2.temperature', result);\nmsg7 = {topic: \"Temperatuur [°C]\", payload: result}\n\nresult = msg.payload[108];\nresult = (result <<16) & 0xffff; // unsigned hex format\nglobal.set('solaredge.PV1.errorcode', result);\nmsg8 = {topic: \"Foutmelding [hex]\", payload: result}\n\nreturn [msg1, msg2, msg3, msg4, msg5, msg6, msg7, msg8];","outputs":8,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":660,"wires":[["89cb51aa.646f98"],["79e192f2.28f13c"],["71dff02f.dde42"],["969ab968.5b6938"],["25be7b5.2fecd04"],["6010e664.4414e8"],["fd26a92d.665a3"],["43cd6b17.9b1464"]]},{"id":"87fce2cd.61076","type":"ui_gauge","z":"18bf1cef.46cd6b","name":"PV2 Power","group":"639d127.7bbe86c","order":3,"width":2,"height":2,"gtype":"gage","title":"PV2","label":"watt","format":"{{value}}","min":0,"max":"5000","colors":["#00b33c","#00b33c","#00b33c"],"seg1":"","seg2":"","x":1110,"y":620,"wires":[]},{"id":"71dff02f.dde42","type":"function","z":"18bf1cef.46cd6b","name":"Afronden","func":"msg.payload = Math.floor(msg.payload);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":940,"y":640,"wires":[["87fce2cd.61076"]]},{"id":"532fb3d3.a2c844","type":"ui_gauge","z":"18bf1cef.46cd6b","name":"PV2 Grid voltage","group":"b9f0a5fb.ed14b","order":1,"width":2,"height":2,"gtype":"gage","title":"","label":"Vac","format":"{{value}}","min":"200","max":"300","colors":["#00b33c","#00b33c","#00b33c"],"seg1":"","seg2":"","x":1130,"y":580,"wires":[]},{"id":"79e192f2.28f13c","type":"function","z":"18bf1cef.46cd6b","name":"Afronden","func":"msg.payload = Math.floor(msg.payload);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":940,"y":600,"wires":[["532fb3d3.a2c844"]]},{"id":"969ab968.5b6938","type":"ui_gauge","z":"18bf1cef.46cd6b","name":"PV2 Frequency","group":"b9f0a5fb.ed14b","order":2,"width":2,"height":2,"gtype":"gage","title":"","label":"herz","format":"{{value | number: 1}}","min":"40","max":"60","colors":["#00b33c","#00b33c","#00b33c"],"seg1":"","seg2":"","x":1120,"y":660,"wires":[]},{"id":"89cb51aa.646f98","type":"ui_gauge","z":"18bf1cef.46cd6b","name":"PV2 Grid current","group":"b9f0a5fb.ed14b","order":3,"width":2,"height":2,"gtype":"gage","title":"","label":"amp","format":"{{value | number: 1}}","min":0,"max":"10","colors":["#00b33c","#00b33c","#00b33c"],"seg1":"","seg2":"","x":1130,"y":540,"wires":[]},{"id":"25be7b5.2fecd04","type":"function","z":"18bf1cef.46cd6b","name":"Afronden","func":"msg.payload = Math.floor(msg.payload);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":940,"y":700,"wires":[["e1e1f8cd.fda25"]]},{"id":"e1e1f8cd.fda25","type":"ui_gauge","z":"18bf1cef.46cd6b","name":"PV2 Voltage DC","group":"b9f0a5fb.ed14b","order":4,"width":2,"height":2,"gtype":"gage","title":"","label":"Vdc","format":"{{value}}","min":"250","max":"450","colors":["#00b33c","#00b33c","#00b33c"],"seg1":"","seg2":"","x":1120,"y":700,"wires":[]},{"id":"6010e664.4414e8","type":"ui_text","z":"18bf1cef.46cd6b","group":"639d127.7bbe86c","order":6,"width":8,"height":1,"name":"PV2 Status","label":"{{msg.topic}}","format":"{{msg.payload}}","layout":"row-spread","x":1110,"y":740,"wires":[]},{"id":"25467021.0d43f8","type":"function","z":"18bf1cef.46cd6b","name":"Inverter actual values","func":"var result, sf;\n\nglobal.set('solaredge.PV1.discription', \"Muurkant\");\n\nsf = Math.pow(10, 65536 - msg.payload[75]);  // Scalefactor\nresult = msg.payload[71] / sf;\nglobal.set('solaredge.PV1.current', result);\nmsg1 = {topic: \"Current [Amp]\", payload: result}\n\nsf = Math.pow(10, 65536 - msg.payload[82]);  // Scalefactor\nresult = msg.payload[76] / sf;\nglobal.set('solaredge.PV1.voltageAC', result);\nmsg2 = {topic: \"Voltage [Vac]\", payload: result}\n\nsf = Math.pow(10, 65536 - msg.payload[84]);  // Scalefactor\nresult = msg.payload[83] / sf;\nglobal.set('solaredge.PV1.power', result);\nmsg3 = {topic: \"Power [Watt]\", payload: result}\n\nsf = Math.pow(10, 65536 - msg.payload[86]);  // Scalefactor\nresult = msg.payload[85] / sf;\nglobal.set('solaredge.PV1.frequency', result);\nmsg4 = {topic: \"Frequentie [Herz]\", payload: result}\n\nsf = Math.pow(10, 65536 - msg.payload[99]);  // Scalefactor\nresult = msg.payload[98] / sf;\nglobal.set('solaredge.PV1.voltageDC', result);\nmsg5 = {topic: \"Voltage [Vdc]\", payload: result}\n\n// Status\nvar StatusCode = msg.payload[107];\nvar StatusText;\nswitch(StatusCode)\n{\n    case 1:\n        StatusText = \"Off\";\n        break;\n    case 2:\n        StatusText = \"Night mode\";\n        break;\n    case 3:\n        StatusText = \"Waking up\";\n        break;  \n    case 4:\n        StatusText = \"Producing power\";\n        break;  \n    case 5:\n        StatusText = \"Standby\";\n        break;  \n    case 6:\n        StatusText = \"Shutting down\";\n        break;  \n    case 7:\n        StatusText = \"Fault\";\n        break;  \n    case 8:\n        StatusText = \"Standby/Maintenance\";\n        break;  \n    default:\n        StatusText = \"Undefined\";\n}\nglobal.set('solaredge.PV1.status', StatusText);\nmsg6 = {topic: \"PV1 Status -Muurkant-\", payload: StatusText}\n\nsf = Math.pow(10, 65536 - msg.payload[106]);  // Scalefactor\nresult = msg.payload[103] / sf;\nglobal.set('solaredge.PV1.temperature', result);\nmsg7 = {topic: \"Temperatuur [°C]\", payload: result}\n\nresult = msg.payload[108];\nresult = (result <<16) & 0xffff; // unsigned hex format\nglobal.set('solaredge.PV1.errorcode', result);\nmsg8 = {topic: \"Foutmelding [hex]\", payload: result}\n\nreturn [msg1, msg2, msg3, msg4, msg5, msg6, msg7, msg8];","outputs":8,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":300,"wires":[["97e14caf.0fd7d"],["e4f869ec.9da4"],["e73955be.0ca1"],["65bd2ff3.a3205"],["2a98f57d.ec0a82"],["22c69b75.baf77c"],["9f9403cf.d0005"],["fdaa063e.42ee38"]]},{"id":"5fd50adb.0f7974","type":"ui_gauge","z":"18bf1cef.46cd6b","name":"PV1 Power","group":"639d127.7bbe86c","order":2,"width":2,"height":2,"gtype":"gage","title":"PV1","label":"watt","format":"{{value}}","min":0,"max":"5000","colors":["#00b33c","#00b33c","#00b33c"],"seg1":"","seg2":"","x":1110,"y":240,"wires":[]},{"id":"e73955be.0ca1","type":"function","z":"18bf1cef.46cd6b","name":"Afronden","func":"msg.payload = Math.floor(msg.payload);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":940,"y":260,"wires":[["5fd50adb.0f7974"]]},{"id":"eae09c93.1533d","type":"ui_gauge","z":"18bf1cef.46cd6b","name":"PV1 Grid voltage","group":"7c93f331.26dc54","order":1,"width":2,"height":2,"gtype":"gage","title":"","label":"Vac","format":"{{value}}","min":"200","max":"300","colors":["#00b33c","#00b33c","#00b33c"],"seg1":"","seg2":"","x":1130,"y":200,"wires":[]},{"id":"e4f869ec.9da4","type":"function","z":"18bf1cef.46cd6b","name":"Afronden","func":"msg.payload = Math.floor(msg.payload);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":940,"y":220,"wires":[["eae09c93.1533d"]]},{"id":"65bd2ff3.a3205","type":"ui_gauge","z":"18bf1cef.46cd6b","name":"PV1 Frequency","group":"7c93f331.26dc54","order":2,"width":2,"height":2,"gtype":"gage","title":"","label":"herz","format":"{{value | number: 1}}","min":"40","max":"60","colors":["#00b33c","#00b33c","#00b33c"],"seg1":"","seg2":"","x":1120,"y":280,"wires":[]},{"id":"97e14caf.0fd7d","type":"ui_gauge","z":"18bf1cef.46cd6b","name":"PV1 Grid current","group":"7c93f331.26dc54","order":3,"width":2,"height":2,"gtype":"gage","title":"","label":"amp","format":"{{value | number: 1}}","min":0,"max":"10","colors":["#00b33c","#00b33c","#00b33c"],"seg1":"","seg2":"","x":1130,"y":160,"wires":[]},{"id":"2a98f57d.ec0a82","type":"function","z":"18bf1cef.46cd6b","name":"Afronden","func":"msg.payload = Math.floor(msg.payload);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":940,"y":320,"wires":[["9da082f.16aa4"]]},{"id":"9da082f.16aa4","type":"ui_gauge","z":"18bf1cef.46cd6b","name":"PV1 Voltage DC","group":"7c93f331.26dc54","order":4,"width":2,"height":2,"gtype":"gage","title":"","label":"Vdc","format":"{{value}}","min":"250","max":"450","colors":["#00b33c","#00b33c","#00b33c"],"seg1":"","seg2":"","x":1120,"y":320,"wires":[]},{"id":"22c69b75.baf77c","type":"ui_text","z":"18bf1cef.46cd6b","group":"639d127.7bbe86c","order":5,"width":8,"height":1,"name":"PV1 Status","label":"{{msg.topic}}","format":"{{msg.payload}}","layout":"row-spread","x":1110,"y":360,"wires":[]},{"id":"57a3765f.79c7e","type":"inject","z":"18bf1cef.46cd6b","name":"15 min","props":[{"p":"payload"}],"repeat":"1","crontab":"","once":true,"onceDelay":"5","topic":"","payload":"","payloadType":"date","x":320,"y":940,"wires":[["837b1a01.71de7"]]},{"id":"837b1a01.71de7","type":"function","z":"18bf1cef.46cd6b","name":"Calculations","func":"var P_PV1 = global.get('solaredge.PV1.power');\nvar P_PV2 = global.get('solaredge.PV2.power');\nvar PowerTotal = P_PV1 + P_PV2;\n\nglobal.set('solaredge.powertotal', PowerTotal);\n\nmsg.payload = PowerTotal;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":510,"y":940,"wires":[["705e3afe.585974","5042e37a.bc6aa4"]]},{"id":"5042e37a.bc6aa4","type":"function","z":"18bf1cef.46cd6b","name":"Afronden","func":"msg.payload = Math.floor(msg.payload);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":940,"y":940,"wires":[["31411359.b80aec"]]},{"id":"926e8460.eb6a38","type":"comment","z":"18bf1cef.46cd6b","name":"Various data via MODBUS TCP requests","info":"","x":220,"y":60,"wires":[]},{"id":"4d6a0874.add628","type":"link out","z":"18bf1cef.46cd6b","name":"Solaredge kWh today","links":["561ec62.4556bb8"],"x":1415,"y":1200,"wires":[]},{"id":"f17e88ab.06d48","type":"comment","z":"18bf1cef.46cd6b","name":"PV1 communication guard","info":"","x":770,"y":460,"wires":[]},{"id":"f85ab943.0c92c8","type":"function","z":"18bf1cef.46cd6b","name":"PV1 communication","func":"global.set('solaredge.PV1.timestamp', Date.now());\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":460,"wires":[[]]},{"id":"5ded4bc5.102c5c","type":"function","z":"18bf1cef.46cd6b","name":"PV2 communication","func":"global.set('solaredge.PV2.timestamp', Date.now());\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":500,"wires":[[]]},{"id":"47d5c92f.e5657","type":"comment","z":"18bf1cef.46cd6b","name":"PV2  communication guard","info":"","x":770,"y":500,"wires":[]},{"id":"f559533c.9b829","type":"modbus-getter","z":"18bf1cef.46cd6b","name":"Solaredge PV1 -Muurkant-","showStatusActivities":false,"showErrors":false,"logIOActivities":false,"unitid":"","dataType":"HoldingRegister","adr":"40000","quantity":"110","server":"448bf7cd.d361a8","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":false,"x":240,"y":320,"wires":[["25467021.0d43f8","f85ab943.0c92c8"],[]]},{"id":"45731e0d.1d40e","type":"modbus-getter","z":"18bf1cef.46cd6b","name":"Solaredge PV2 -Buitenkant-","showStatusActivities":false,"showErrors":false,"logIOActivities":false,"unitid":"","dataType":"HoldingRegister","adr":"40000","quantity":"110","server":"5b40ea69.b4c48c","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":false,"x":240,"y":640,"wires":[["dcf2ac92.86d65","5ded4bc5.102c5c"],[]]},{"id":"17995f6d.ecac39","type":"inject","z":"18bf1cef.46cd6b","name":"1 sec","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":420,"wires":[["9e6eccd7.67a878"]]},{"id":"9f9403cf.d0005","type":"ui_text","z":"18bf1cef.46cd6b","group":"7c93f331.26dc54","order":5,"width":8,"height":1,"name":"PV1 temperture","label":"{{msg.topic}}","format":"{{msg.payload | number: 1}}","layout":"row-spread","x":1120,"y":400,"wires":[]},{"id":"fd26a92d.665a3","type":"ui_text","z":"18bf1cef.46cd6b","group":"b9f0a5fb.ed14b","order":5,"width":8,"height":1,"name":"PV2 temperture","label":"{{msg.topic}}","format":"{{msg.payload | number: 1}}","layout":"row-spread","x":1120,"y":780,"wires":[]},{"id":"fdaa063e.42ee38","type":"ui_text","z":"18bf1cef.46cd6b","group":"7c93f331.26dc54","order":6,"width":8,"height":1,"name":"PV1 errorcode","label":"{{msg.topic}}","format":"{{msg.payload}}","layout":"row-spread","x":1120,"y":440,"wires":[]},{"id":"43cd6b17.9b1464","type":"ui_text","z":"18bf1cef.46cd6b","group":"b9f0a5fb.ed14b","order":6,"width":8,"height":1,"name":"PV2 errorcode","label":"{{msg.topic}}","format":"{{msg.payload}}","layout":"row-spread","x":1120,"y":820,"wires":[]},{"id":"fb82da05.a1b16","type":"inject","z":"18bf1cef.46cd6b","name":"1 sec","props":[{"p":"payload"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":210,"y":180,"wires":[["d7372862.350f18"]]},{"id":"d7372862.350f18","type":"function","z":"18bf1cef.46cd6b","name":"Determine night time period is active","func":"var d = new Date();\nvar nHour = d.getHours();    // Hour of date\nvar nMin = d.getHours();    // Hour of date\nvar nSec = d.getHours();    // Hour of date\nvar t;\nvar part =[];\nvar nActive = false;\n\n// Actual time now\nvar nTime = nHour*10000 + nMin*100 + nSec;\n\n// Start time night period\nt = global.get('solaredge.nighttime.start') || \"00:00:00\";\npart = t.split(\":\");\nnHour = parseInt(part[0]);\nnMin = parseInt(part[1]);\nnSec = parseInt(part[2]);\nvar nTime_start = nHour*10000 + nMin*100 + nSec;\n\n// End time night period\nt = global.get('solaredge.nighttime.end') || \"00:00:00\";\npart = t.split(\":\");\nnHour = parseInt(part[0]);\nnMin = parseInt(part[1]);\nnSec = parseInt(part[2]);\nvar nTime_end = nHour*10000 + nMin*100 + nSec;\n\n//node.warn(nTime);\n//node.warn(nTime_start);\n//node.warn(nTime_end);\n\nif ((nTime > nTime_start) && (nTime < nTime_end)) {\n    nActive = false;\n}\nelse{\n    nActive = true;\n}\n\nglobal.set('solaredge.nighttime.active', nActive);\n\nreturn msg;","outputs":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":510,"y":180,"wires":[]},{"id":"1584fc77.c9baac","type":"function","z":"18bf1cef.46cd6b","name":"Determine night time period","func":"// Here is calculated what the night time period is,\n// during this period the communication to solaredge is stopped.\n// This period starts 1 hour after sunset and ends 1 hour before\n// sunrise.\nvar part = [];\nvar hour;\n\nvar sunrise = global.get('weather.sunrise') || \"00:00:00\";\npart = sunrise.split(\":\");\nhour = (parseInt(part[0]) - 1).toString();\nhour = hour.padStart(2,0);\nvar ntime_start = hour + \":\" + part[1] + \":\" + part[2];  \nglobal.set('solaredge.nighttime.start', ntime_start)\n\nvar sunset = global.get('weather.sunset') || \"00:00:00\";\npart = sunset.split(\":\");\nhour = (parseInt(part[0]) + 1).toString();\nhour = hour.padStart(2,0);\nvar ntime_end = hour + \":\" + part[1] + \":\" + part[2];  \nglobal.set('solaredge.nighttime.end', ntime_end)\n\n\nreturn msg;","outputs":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":140,"wires":[]},{"id":"9ccc645f.39415","type":"inject","z":"18bf1cef.46cd6b","name":"Start up","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"","payloadType":"date","x":220,"y":140,"wires":[["1584fc77.c9baac"]]},{"id":"9e6eccd7.67a878","type":"function","z":"18bf1cef.46cd6b","name":"Block night time period","func":"var nighttime = global.get('solaredge.nighttime.active');\n\nif (nighttime ==true) return null;\nelse return msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":180,"y":480,"wires":[["45731e0d.1d40e","f559533c.9b829"]]},{"id":"a58040a0.442b88","type":"ui_group","name":"Diversen (Solaredge server)","tab":"8d93ea2f.5718e8","order":5,"disp":true,"width":"8","collapse":false},{"id":"639d127.7bbe86c","type":"ui_group","name":"Actuele waarden","tab":"8d93ea2f.5718e8","order":1,"disp":true,"width":8,"collapse":false},{"id":"dafd9a25.e764f","type":"ui_group","name":"Energie opbrengst","tab":"8d93ea2f.5718e8","order":2,"disp":true,"width":8,"collapse":false},{"id":"b9f0a5fb.ed14b","type":"ui_group","name":"Omvormer PV2 -Buitenkant-","tab":"8d93ea2f.5718e8","order":4,"disp":true,"width":8,"collapse":false},{"id":"7c93f331.26dc54","type":"ui_group","name":"Omvormer PV1 -Muurkant- ","tab":"8d93ea2f.5718e8","order":3,"disp":true,"width":8,"collapse":false},{"id":"448bf7cd.d361a8","type":"modbus-client","name":"Solaredge PV1 -Muurkant-","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"192.168.0.31","tcpPort":"1502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":1,"commandDelay":1,"clientTimeout":1000,"reconnectOnTimeout":true,"reconnectTimeout":2000,"parallelUnitIdsAllowed":true},{"id":"5b40ea69.b4c48c","type":"modbus-client","name":"Solaredge PV2 -Buitenkant-","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"192.168.0.32","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"1","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true},{"id":"8d93ea2f.5718e8","type":"ui_tab","name":"Solaredge","icon":"dashboard","order":7,"disabled":false,"hidden":false}]

That’s interesting. I’ll compare. If necessary avoid that time as you say.

Regards,

Ian

Ok. I have tried various timing intervals, I have tried excluding certain times of the day, I have tried resetQueue. So far the only thing that will reset the Modbus when it stops is to re Deploy the flow/s.

I'm guessing that whoever is the author of the Modbus routines ill eventually find the cause and fix it. In the meantime the only thing I can think of in the absence of a Stop/Start oprion for the Modbus Queue is to issue an Op Command to reboot the host unit. Unfortunately this will wipe the stats to zero thus rendering the graph useless.

I suppose I could store the data to a file and then rebuild it in the event of the restart but would it not be simpler to just fix the Modbus interface.

Is this restricted to SolarEdge? It was hard enough working out how to handle the dat given the errors in their documentation and to arrive at the point where the flow actually works correctly but stalls after a few hours is intensely frustrating to say the least. Surely therre is an inverter out there which provides a proper data bus.

@ Ianmidd I am sorry, I haven't been around for sometime.
I also communicate with other modbus servers. I have a Growatt that is connect via a modbus RTU to TCP converter. The digital meter P1 port I service with a seriel to modbus tcp converter. All of these functions very well. And I communicatie with a Siemens PLC (not modbus!), when this communication goes down, then it will restart itself again after sometime. If the others suffer from communication failure, which happens very rarely, then the communication will not restart. I have to do a restart of node-red. I think it is a failure in the modbus-node. Before I had many failures on solaredge, but that's more or less over now with the solution I told you.

gr.
Henk

I’ve given up. The whole system is completely unreliable.

Regards,

Ian

Hi. I've had similar problems in my setup that 2 nights every week the connection to the modbus sever stalled. I found out that I had set my router to restart exactly this time twice a week.
The solution was to change the timeout settings. I haven't finetuned the settings but 60 sec. timeout and 60 sec. reconnect works in my case. I still restart my router as before.

@gbackman2002 , thanks. But nowadays I have very little trouble with communications on modbus. Only once in a while, the solution is restart node red. I made a button for this in the application.

afbeelding

afbeelding

or also reboot the complete system, but not really neccesairy.