Closed nygma2004 closed 7 years ago
Please give some information about your environment (nodejs, node-red, contrib-modbus versions)
node-red: 0.16.2 node-js: 6.10.1 node-red-contrib-modbus: 1.0.8
Looking at the palette, it seems I also have this: node-red-contrib-serial-modbus: 0.0.10
Sorry, I don't remember if this is a dependency or an older version. I had a different modbus serial component before, but when I upgraded node-red it stopped working. That's when I installed your node.
OK and 1.0.9 or 1.0.10 doesn't work for you?
try
DEBUG=node_red_contrib_modbus,node_red_contrib_modbus:client,modbus-serial node-red -v > issue23.log
and attach that log file here, please
I added the debug statements, and everything appears to be working now. But I had this issue consistently throughout the day, and now it is gone. I am planning on playing around with modbus, so I will keep and eye on this. I will remember to come back next week as well, and if I am having the problem any more, I will close the issue. Sorry for the inconvenience caused.
Does it work, if you switch the debug off again? Otherwise, it could be a time coupled problem.
OK, have not thought of that. Sorry, but I have to ask for more assistance at this point. How do I turn off debug?
OK, I am sure I have done something wrong. I was adding some error handling to the flow and made other changes and well, and I noticed the read going to wait state again. I also added a debug to the modbus queue (set the debug to complete message), but still nothing is showing up in the debug window.
Furthermore the debug is not showing much detail: issue23.txt
I think I have to ask you a bit more detailed instructions on how to enable / disable debugging. Do I have to restart node-red after? I would also update to the latest version of contrib-nodered to make it easier for you. I want to work with the latest version too.
a) How do I turn off debug? ---> just start node-red without the -v and DEBUG with the command line
node-red
b) it looks like node-red is started twice - are you on a device with a preinstalled Node-RED? Then you have to stop node-red before you call the command line
if you find out, how to stop your running node-red, then you can switch between much debug information and less
node-red -v > issue23justNodeRed.log
DEBUG=modbus-serial node-red -v > issue23justMBSerial.log
DEBUG=node_red_contrib_modbus:client,modbus-serial node-red -v > issue23justConnector.log
DEBUG=node_red_contrib_modbus,node_red_contrib_modbus:client,modbus-serial node-red -v > issue23allDebug.log
Hi Klaus,
I managed to re-create the issue. I have contrib-modbus updated to 1.0.10 now. If I re-deploy the flow it is working. It was running with the debug on for about 30 min. I changed the timing on one of the modbus reads from 5 to 3 seconds. And after deploy all modbus reads gone to waiting. I changed the bits to 7 which resulted timeouts and back to 8 bits and now everything is working again. You should see all this towards the end of the document.
sounds like a reading problem, please give me the flows - there are many inside - exec starts and there are async starts:
28 Apr 09:25:52 - [info] Starting modified flows 28 Apr 09:25:52 - [warn] [modbus-client:SDM120] Client -> reconnect in 5000 ms Serial@/dev/ttyUSB0:9600bit/s default Unit-Id: 30 28 Apr 09:25:52 - [info] [inject:Check] repeat = 1000 28 Apr 09:25:52 - [info] Started modified flows 28 Apr 09:25:53 - [info] [exec:1 wire] /opt/openhab/onewiretemp.sh 28-00000433cda6 1493364353635 28 Apr 09:26:03 - [info] [exec:1 wire] /opt/openhab/onewiretemp.sh 28-00000433cda6 1493364363658 28 Apr 09:26:13 - [info] [exec:1 wire] /opt/openhab/onewiretemp.sh 28-00000433cda6 1493364373680
Two starts without a close event will never close the port and then your serial device will be blocked because it is open.
It is directly reconnecting so the device doesn't work or got errno's - please activate Show Errors for the Modbus connection config - normally it should give you an error of Modbus
28 Apr 08:33:33 - [info] Starting flows 28 Apr 08:33:33 - [warn] [modbus-client:SDM120] Client -> reconnect in 5000 ms Serial@/dev/ttyUSB0:9600bit/s default Unit-Id: 30
This is my flow. Since yesterday, I have connected another device on the same modbus line. SDM energy meter is 30 the temperature sensor is 50. The nodes for the energy meter still works, but node for the temp is in waiting state. I did configure to server for them as the unit number is in the service configuration. Maybe this was a problem. Still the original issue persist.
[{"id":"ac104c.0bcfefb8","type":"exec","z":"2934a51a.93393a","command":"/opt/openhab/onewiretemp.sh 28-00000433cda6","addpay":true,"append":"","useSpawn":"","timer":"","name":"1 wire","x":265,"y":63.5,"wires":[["26c38162.eb20ce","6c0d2f2.9ceaed"],[],[]]},{"id":"26c38162.eb20ce","type":"debug","z":"2934a51a.93393a","name":"","active":false,"console":"false","complete":"payload","x":450,"y":48,"wires":[]},{"id":"f1b57fcf.8f31","type":"inject","z":"2934a51a.93393a","name":"","topic":"","payload":"","payloadType":"date","repeat":"10","crontab":"","once":false,"x":117,"y":66,"wires":[["ac104c.0bcfefb8"]]},{"id":"8b486fd4.cdc7","type":"debug","z":"2934a51a.93393a","name":"","active":true,"console":"false","complete":"false","x":644.1666717529297,"y":1937.5833740234375,"wires":[]},{"id":"bda32a0f.183418","type":"function","z":"2934a51a.93393a","name":"Read buffer","func":"var regs = msg.payload;\nvar humid = (((regs[0] & 0x00FF) << 8) | (regs[1] & 0xFF))/10;\nvar temp = (((regs[2] & 0x00FF) << 8) | (regs[3] & 0xFF))/10;\n\n// msg.payload = \"{ \\"temp\\": \"+temp+\", \\"humid\\": \"+humid+\"}\";\n\nvar rsws = { temp:0, humid:0 };\nrsws.temp = temp;\nrsws.humid = humid;\n\nmsg.payload = rsws;\n\n// Update the status with current timestamp\nvar now = new Date();\nvar yyyy = now.getFullYear();\nvar mm = now.getMonth() < 9 ? \"0\" + (now.getMonth() + 1) : (now.getMonth() + 1); // getMonth() is zero-based\nvar dd = now.getDate() < 10 ? \"0\" + now.getDate() : now.getDate();\nvar hh = now.getHours() < 10 ? \"0\" + now.getHours() : now.getHours();\nvar mmm = now.getMinutes() < 10 ? \"0\" + now.getMinutes() : now.getMinutes();\nvar ss = now.getSeconds() < 10 ? \"0\" + now.getSeconds() : now.getSeconds();\nnode.status({fill:\"blue\",shape:\"ring\",text:\"Last update: \"+dd + \".\" + mm + \".\" + yyyy + \" \" + hh + \":\" + mmm + \":\" + ss});\n\nreturn msg;","outputs":1,"noerr":0,"x":336.1666717529297,"y":1937.5833740234375,"wires":[["8b486fd4.cdc7","605870f1.4c06f","4b7f9241.5f9e3c"]]},{"id":"4b7f9241.5f9e3c","type":"ui_text","z":"2934a51a.93393a","group":"a82c54da.58e038","order":1,"width":0,"height":0,"name":"","label":"Temperature","format":"{{msg.payload.temp}} C","layout":"row-spread","x":634.1666717529297,"y":2004.5833740234375,"wires":[]},{"id":"605870f1.4c06f","type":"ui_text","z":"2934a51a.93393a","group":"a82c54da.58e038","order":2,"width":0,"height":0,"name":"","label":"Humidity","format":"{{msg.payload.humid}} %","layout":"row-spread","x":627.1666717529297,"y":2054.5833740234375,"wires":[]},{"id":"b3ae0448.822d08","type":"comment","z":"2934a51a.93393a","name":"SDM120 Energy Meter","info":"","x":141.5,"y":1142,"wires":[]},{"id":"53b4b356.bf124c","type":"modbus-read","z":"2934a51a.93393a","name":"SDM 120 Voltage","showStatusActivities":true,"showErrors":true,"unitid":"30","dataType":"InputRegister","adr":"0","quantity":"2","rate":"5","rateUnit":"s","server":"40f20c7f.13a934","x":113,"y":1235,"wires":[["e4d3fade.1132a8"],[]]},{"id":"e4d3fade.1132a8","type":"function","z":"2934a51a.93393a","name":"Voltage","func":"var rawData = new ArrayBuffer(4);\nvar intView = new Uint16Array(rawData);\nvar fltView = new Float32Array(rawData);\n\nintView[0] = msg.payload[1]; //low\nintView[1] = msg.payload[0]; //high\n\nmsg.payload = parseFloat(fltView[0].toFixed(1));\nmsg.topic = \"voltage\";\n\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.topic + \":\" + msg.payload}); \n\nreturn msg;","outputs":1,"noerr":0,"x":342,"y":1228,"wires":[["94b7c2b7.b61ae","267d6c75.311c84"]]},{"id":"29fc9cac.869404","type":"modbus-queue-info","z":"2934a51a.93393a","name":"SDM120_queue","unitid":"30","lowLowLevel":"1","lowLevel":75,"highLevel":150,"highHighLevel":300,"server":"40f20c7f.13a934","errorOnHighLevel":false,"x":484.6428527832031,"y":1602.107177734375,"wires":[["759e42e9.23762c"]]},{"id":"27ead677.91de0a","type":"inject","z":"2934a51a.93393a","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":113.64286041259766,"y":1603.1072025299072,"wires":[["1d0b599c.544786"]]},{"id":"1d0b599c.544786","type":"change","z":"2934a51a.93393a","name":"Reset queue","rules":[{"t":"set","p":"resetQueue","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":282.64286041259766,"y":1603.1071891784668,"wires":[["29fc9cac.869404"]]},{"id":"e3643b3e.be3a88","type":"function","z":"2934a51a.93393a","name":"Current","func":"var rawData = new ArrayBuffer(4);\nvar intView = new Uint16Array(rawData);\nvar fltView = new Float32Array(rawData);\n\nintView[0] = msg.payload[1]; //low\nintView[1] = msg.payload[0]; //high\n\nmsg.payload = parseFloat(fltView[0].toFixed(1));\nmsg.topic = \"current\";\n\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.topic + \":\" + msg.payload}); \n\nreturn msg;","outputs":1,"noerr":0,"x":341,"y":1286,"wires":[["fa18b5f3.ba6be8","267d6c75.311c84"]]},{"id":"4dbf9277.487e4c","type":"function","z":"2934a51a.93393a","name":"Power","func":"var rawData = new ArrayBuffer(4);\nvar intView = new Uint16Array(rawData);\nvar fltView = new Float32Array(rawData);\n\nintView[0] = msg.payload[1]; //low\nintView[1] = msg.payload[0]; //high\n\nmsg.payload = parseFloat(fltView[0].toFixed(1));\nmsg.topic = \"power\";\n\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.topic + \":\" + msg.payload}); \n\nreturn msg;","outputs":1,"noerr":0,"x":332,"y":1339,"wires":[["c3697655.758e28","267d6c75.311c84"]]},{"id":"593c6698.c25388","type":"function","z":"2934a51a.93393a","name":"Frequency","func":"var rawData = new ArrayBuffer(4);\nvar intView = new Uint16Array(rawData);\nvar fltView = new Float32Array(rawData);\n\nintView[0] = msg.payload[1]; //low\nintView[1] = msg.payload[0]; //high\n\nmsg.payload = parseFloat(fltView[0].toFixed(1));\nmsg.topic = \"frequency\";\n\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.topic + \":\" + msg.payload}); \n\nreturn msg;","outputs":1,"noerr":0,"x":352,"y":1395,"wires":[["c38e8fed.7fb6a","267d6c75.311c84"]]},{"id":"7df027a2.13a1f8","type":"function","z":"2934a51a.93393a","name":"Energy","func":"var rawData = new ArrayBuffer(4);\nvar intView = new Uint16Array(rawData);\nvar fltView = new Float32Array(rawData);\n\nintView[0] = msg.payload[1]; //low\nintView[1] = msg.payload[0]; //high\n\nmsg.payload = parseFloat(fltView[0].toFixed(2));\nmsg.topic = \"energy\";\n\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.topic + \":\" + msg.payload}); \n\nreturn msg;","outputs":1,"noerr":0,"x":342,"y":1455,"wires":[["d87b3ecd.2dab2","267d6c75.311c84"]]},{"id":"7d42a707.bcd618","type":"modbus-read","z":"2934a51a.93393a","name":"SDM 120 Current","showStatusActivities":true,"showErrors":true,"unitid":"30","dataType":"InputRegister","adr":"6","quantity":"2","rate":"5","rateUnit":"s","server":"40f20c7f.13a934","x":122,"y":1293,"wires":[["e3643b3e.be3a88"],[]]},{"id":"576a7fbe.d0861","type":"modbus-read","z":"2934a51a.93393a","name":"SDM 120 Power","showStatusActivities":true,"showErrors":true,"unitid":"30","dataType":"InputRegister","adr":"12","quantity":"2","rate":"5","rateUnit":"s","server":"40f20c7f.13a934","x":112,"y":1345,"wires":[["4dbf9277.487e4c"],[]]},{"id":"519b5a74.1a7314","type":"modbus-read","z":"2934a51a.93393a","name":"SDM 120 Frequency","showStatusActivities":true,"showErrors":true,"unitid":"30","dataType":"InputRegister","adr":"70","quantity":"2","rate":"5","rateUnit":"s","server":"40f20c7f.13a934","x":132,"y":1401,"wires":[["593c6698.c25388"],[]]},{"id":"b84798db.04be98","type":"modbus-read","z":"2934a51a.93393a","name":"SDM 120 Energy","showStatusActivities":true,"showErrors":true,"unitid":"30","dataType":"InputRegister","adr":"342","quantity":"2","rate":"5","rateUnit":"s","server":"40f20c7f.13a934","x":110,"y":1460,"wires":[["7df027a2.13a1f8","5fe7e9a5.d88c68"],[]]},{"id":"6e253bed.c1a2c4","type":"comment","z":"2934a51a.93393a","name":"RS-WS-N08-1","info":"","x":99.16667175292969,"y":1864.5833988189697,"wires":[]},{"id":"94b7c2b7.b61ae","type":"ui_text","z":"2934a51a.93393a","group":"2c2fdfeb.fe41e","order":0,"width":0,"height":0,"name":"","label":"Voltage","format":"{{msg.payload}} V","layout":"row-spread","x":528,"y":1230,"wires":[]},{"id":"fa18b5f3.ba6be8","type":"ui_text","z":"2934a51a.93393a","group":"2c2fdfeb.fe41e","order":0,"width":0,"height":0,"name":"","label":"Current","format":"{{msg.payload}} A","layout":"row-spread","x":529,"y":1285,"wires":[]},{"id":"c3697655.758e28","type":"ui_text","z":"2934a51a.93393a","group":"2c2fdfeb.fe41e","order":0,"width":0,"height":0,"name":"","label":"Power","format":"{{msg.payload}} W","layout":"row-spread","x":525,"y":1340,"wires":[]},{"id":"c38e8fed.7fb6a","type":"ui_text","z":"2934a51a.93393a","group":"2c2fdfeb.fe41e","order":0,"width":0,"height":0,"name":"","label":"Frequency","format":"{{msg.payload}} Hz","layout":"row-spread","x":545,"y":1396,"wires":[]},{"id":"d87b3ecd.2dab2","type":"ui_text","z":"2934a51a.93393a","group":"2c2fdfeb.fe41e","order":0,"width":0,"height":0,"name":"","label":"Total Energy","format":"{{msg.payload}} kWh","layout":"row-spread","x":547,"y":1456,"wires":[]},{"id":"267d6c75.311c84","type":"function","z":"2934a51a.93393a","name":"Build object","func":"watch_topic = \"energy\";\nvar output = {};\n\ncontext.set(msg.topic,msg.payload);\n\nif (context.get(\"voltage\")!==undefined) {\n output.voltage = context.get(\"voltage\");\n}\nif (context.get(\"current\")!==undefined) {\n output.current = context.get(\"current\");\n}\nif (context.get(\"power\")!==undefined) {\n output.power = context.get(\"power\");\n}\nif (context.get(\"frequency\")!==undefined) {\n output.frequency = context.get(\"frequency\");\n}\nif (context.get(\"energy\")!==undefined) {\n output.energy = context.get(\"energy\");\n}\nmsg.payload = output;\n\nif (msg.topic===watch_topic) {\n msg.topic = \"sdm120\";\n return msg;\n}","outputs":1,"noerr":0,"x":719,"y":1309,"wires":[["6d3190d1.e5037","30d370ab.48c66"]]},{"id":"6d3190d1.e5037","type":"debug","z":"2934a51a.93393a","name":"","active":false,"console":"false","complete":"true","x":882,"y":1313,"wires":[]},{"id":"6c0d2f2.9ceaed","type":"ui_text","z":"2934a51a.93393a","group":"874f0def.0e498","order":0,"width":0,"height":0,"name":"","label":"Temperature","format":"{{msg.payload}} °C","layout":"row-spread","x":489,"y":103,"wires":[]},{"id":"78d7ebbc.cea674","type":"function","z":"2934a51a.93393a","name":"Diagnostic input message structure","func":"// setting a global flag that the solar system is down\n\nmsg.payload = \"High voltage warning: \" + msg.payload.voltage +\" V\";\nmsg.system = 1; // System id, use 1 for Dummy\n//msg.state = 1; // specify if the message is to change system status\nmsg.severity = 1; // 0: information, 1: warning, 2: error\nmsg.email = false; // if separate email should be sent\n//msg.emailtext = \"Clean up step of the SAIA log backup has failed\";\nreturn msg;","outputs":1,"noerr":0,"x":1433,"y":1201,"wires":[["d9ab022c.d40aa"]]},{"id":"d9ab022c.d40aa","type":"link out","z":"2934a51a.93393a","name":"","links":["13e089a7.73cb46"],"x":1640,"y":1223,"wires":[]},{"id":"44460146.8cda4","type":"switch","z":"2934a51a.93393a","name":"Voltage check","property":"payload.voltage_check","propertyType":"msg","rules":[{"t":"eq","v":"high","vt":"str"},{"t":"eq","v":"low","vt":"str"}],"checkall":"true","outputs":2,"x":1141,"y":1225,"wires":[["78d7ebbc.cea674"],["a194e5c6.7a7eb8"]]},{"id":"a194e5c6.7a7eb8","type":"function","z":"2934a51a.93393a","name":"Diagnostic input message structure","func":"// setting a global flag that the solar system is down\n\nmsg.payload = \"Low voltage warning: \" + msg.payload.voltage +\" V\";\nmsg.system = 1; // System id, use 1 for Dummy\n//msg.state = 1; // specify if the message is to change system status\nmsg.severity = 1; // 0: information, 1: warning, 2: error\nmsg.email = false; // if separate email should be sent\n//msg.emailtext = \"Clean up step of the SAIA log backup has failed\";\nreturn msg;","outputs":1,"noerr":0,"x":1433,"y":1246,"wires":[["d9ab022c.d40aa"]]},{"id":"30d370ab.48c66","type":"function","z":"2934a51a.93393a","name":"Voltage check","func":"var high = 250.0;\nvar low = 220.0;\n\nif (msg.payload.voltage > high) {\n msg.payload.voltage_check = \"high\";\n}\nif (msg.payload.voltage < low) {\n msg.payload.voltage_check = \"low\";\n}\nreturn msg;","outputs":1,"noerr":0,"x":928,"y":1226,"wires":[["44460146.8cda4"]]},{"id":"d01ace0b.7d3d4","type":"function","z":"2934a51a.93393a","name":"reset on HighHigh","func":"if(\"high high level reached\" === msg.state) {\n msg.resetQueue = true;\n return msg;\n}\n","outputs":1,"noerr":0,"x":357.50000762939453,"y":1733.2500247955322,"wires":[["29fc9cac.869404","dc784194.a11f6"]]},{"id":"ec676e18.9bbae","type":"catch","z":"2934a51a.93393a","name":"Catch queue errors","scope":["29fc9cac.869404"],"x":119.50000762939453,"y":1733.2500247955322,"wires":[["d01ace0b.7d3d4"]]},{"id":"284bdf25.d13a9","type":"comment","z":"2934a51a.93393a","name":"Error handling","info":"","x":85.50000762939453,"y":1688.2500247955322,"wires":[]},{"id":"dc784194.a11f6","type":"function","z":"2934a51a.93393a","name":"Diagnostic input message structure","func":"// setting a global flag that the solar system is down\n\nmsg.payload = \"SDM120 modbus queue reached high level, resetting. (\" + msg.state + \")\";\nmsg.system = 4; // System id, use 1 for Dummy\n//msg.state = 1; // specify if the message is to change system status\nmsg.severity = 1; // 0: information, 1: warning, 2: error\nmsg.email = false; // if separate email should be sent\n//msg.emailtext = \"Clean up step of the SAIA log backup has failed\";\nreturn msg;","outputs":1,"noerr":0,"x":657.5000076293945,"y":1732.2500247955322,"wires":[["5c63f003.554"]]},{"id":"5c63f003.554","type":"link out","z":"2934a51a.93393a","name":"","links":["13e089a7.73cb46"],"x":843.5000076293945,"y":1732.2500247955322,"wires":[]},{"id":"e1c40b2e.6b7978","type":"catch","z":"2934a51a.93393a","name":"Modbus read errors","scope":["7d42a707.bcd618","b84798db.04be98","519b5a74.1a7314","576a7fbe.d0861","53b4b356.bf124c","b3ae0448.822d08"],"x":119.50000762939453,"y":1776.2500247955322,"wires":[["c8d0574c.839038"]]},{"id":"c8d0574c.839038","type":"function","z":"2934a51a.93393a","name":"Diagnostic input message structure","func":"// setting a global flag that the solar system is down\n\nmsg.payload = \"SDM120 modbus error: \" + msg.error.message;\nmsg.system = 4; // System id, use 1 for Dummy\n//msg.state = 1; // specify if the message is to change system status\nmsg.severity = 1; // 0: information, 1: warning, 2: error\nmsg.email = false; // if separate email should be sent\n//msg.emailtext = \"Clean up step of the SAIA log backup has failed\";\nreturn msg;","outputs":1,"noerr":0,"x":408.50000762939453,"y":1776.2500247955322,"wires":[["89cc7882.52fb68"]]},{"id":"89cc7882.52fb68","type":"link out","z":"2934a51a.93393a","name":"","links":["13e089a7.73cb46"],"x":594.5000076293945,"y":1776.2500247955322,"wires":[]},{"id":"759e42e9.23762c","type":"debug","z":"2934a51a.93393a","name":"","active":true,"console":"false","complete":"true","x":665.5000076293945,"y":1601.2500247955322,"wires":[]},{"id":"5fe7e9a5.d88c68","type":"function","z":"2934a51a.93393a","name":"Health check","func":"var devicename = \"sdm120\";\n\nvar temp = context.get(devicename+\"_update\");\nvar current = new Date();\nmsg.payload = \"No data\";\nmsg.warning = false;\nif (msg.topic!==\"timecheck\") {\n // Do not update the context if it is triggered by the check inject node\n context.set(devicename+\"_update\",current);\n}\nif (temp===undefined) {\n // this will be the case when node-red is booting up or redeployed\n context.set(devicename+\"_update\",current);\n}\n\nif (temp!==undefined) {\n current = current - temp;\n current = Math.floor(current/1000);\n var minute = Math.floor(current/60);\n var hour = Math.floor(minute/60);\n var day = Math.floor(hour/24);\n if (current>246060) {\n msg.payload = \"Last update \" + day + \" days, \" + hour%24 + \" hours, \" + minute%60 + \" minutes, \" + current%60 + \" seconds ago\";\n } else if (current>60*60) {\n msg.payload = \"Last update \" + hour%24 + \" hours, \" + minute%60 + \" minutes, \" + current%60 + \" seconds ago\";\n } else if (current>60) {\n msg.payload = \"Last update \" + minute%60 + \" minutes, \" + current%60 + \" seconds ago\";\n } else {\n msg.payload = \"Last update \" + current%60 + \" seconds ago\";\n }\n\n if (context.get(devicename+\"_state\")!==1) {\n if (current<10) {\n msg.payload = \"SDM120 is now online\";\n msg.system = 4; // System id, use 1 for Dummy\n msg.state = 1; // specify if the message is to change system status\n msg.severity = 0; // 0: information, 1: warning, 2: error\n //msg.email = true; // if separate email should be sent\n //msg.emailtext = \"\"; this a long text which goes into the email \n msg.warning = true;\n context.set(devicename+\"_state\",1);\n }\n } else {\n if (current>30) {\n msg.payload = \"SDM120 is not transmitting\";\n msg.system = 4; // System id, use 1 for Dummy\n msg.state = 99; // specify if the message is to change system status\n msg.severity = 2; // 0: information, 1: warning, 2: error\n //msg.email = true; // if separate email should be sent\n //msg.emailtext = \"\"; this a long text which goes into the email \n msg.warning = true;\n context.set(devicename+\"_state\",99);\n }\n }\n \n \n}\n\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.payload});\n\nreturn msg;","outputs":1,"noerr":0,"x":366,"y":1520,"wires":[["e8795434.be1748"]]},{"id":"4646391.9ea9cc8","type":"inject","z":"2934a51a.93393a","name":"Check","topic":"timecheck","payload":"","payloadType":"date","repeat":"1","crontab":"","once":false,"x":150,"y":1532,"wires":[["5fe7e9a5.d88c68"]]},{"id":"e8795434.be1748","type":"switch","z":"2934a51a.93393a","name":"Update diag?","property":"warning","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","outputs":1,"x":561,"y":1520,"wires":[["ee08c280.18881"]]},{"id":"ee08c280.18881","type":"link out","z":"2934a51a.93393a","name":"","links":["13e089a7.73cb46"],"x":680.3015727996826,"y":1519.571403503418,"wires":[]},{"id":"97727655.d2d868","type":"modbus-read","z":"2934a51a.93393a","name":"RS-WS-N08","showStatusActivities":true,"showErrors":true,"unitid":"50","dataType":"HoldingRegister","adr":"0","quantity":"4","rate":"5","rateUnit":"s","server":"8fccd169.60d6d","x":122,"y":1939,"wires":[["bda32a0f.183418"],[]]},{"id":"a82c54da.58e038","type":"ui_group","z":"","name":"RS-WS-N08-1","tab":"72b1a4dc.4f488c","order":5,"disp":true,"width":"6"},{"id":"40f20c7f.13a934","type":"modbus-client","z":"","name":"SDM120","clienttype":"serial","bufferCommands":true,"stateLogEnabled":false,"tcpHost":"127.0.0.1","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB0","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"30","commandDelay":"1","clientTimeout":"2000","reconnectTimeout":"5000"},{"id":"2c2fdfeb.fe41e","type":"ui_group","z":"","name":"SDM120 Energy Meter","tab":"72b1a4dc.4f488c","order":2,"disp":true,"width":"6"},{"id":"874f0def.0e498","type":"ui_group","z":"","name":"DS18B20 Temp Sensor","tab":"156af96f.f8fd27","disp":true,"width":"6"},{"id":"8fccd169.60d6d","type":"modbus-client","z":"","name":"RS-NS-N08","clienttype":"serial","bufferCommands":true,"stateLogEnabled":false,"tcpHost":"127.0.0.1","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB0","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"50","commandDelay":"1","clientTimeout":"1000","reconnectTimeout":"2000"},{"id":"72b1a4dc.4f488c","type":"ui_tab","z":"","name":"Modbus","icon":"memory","order":15},{"id":"156af96f.f8fd27","type":"ui_tab","z":"","name":"Home","icon":"home","order":1}]
node-red shows that it is not a valid flow
But in the text it looks like you try to use the /dev/ttyUSB0 twice, which is not possible in serial - you have just one open in serial - just set the Unit-Id in the config to a default and use it on all nodes. The Unit-Id can be set by the reading to 30 or 50 or what you need and it will override the setting in the config node. Serial connections are one to one connections.
Please, reopen if it doesn't fix your problem.
use up to date v1.0.11
I did what you said. The Unit id on the server is default and there is now only one server for the entire modbus serial line. The SDM120 modbus reads are working OK, but the new temperature sensor node is only reading data like very minute instead of the 5 seconds it is set to. I don't see any error raised, even though I have a catch on the modbus node. When I connect only the temperature sensor on the line, the values are being read every 5 seconds as usual. Do you have any clues?
Whenever I deploy my solution which deploys my Modbus Read nodes as well, the nodes go to waiting status and nothing happens. The have multiple modbus reads for the same modbus slave, but I also noticed the same if there is only 1. I have the nodes queued. Resetting the queue does not help.
What I noticed that if I change the server settings, for example change the data bits from 8 to 7 and deploy the nodes start communicating again. Of course I need to set 7 back to 8 otherwise I am not getting any data.
So it seems I need to change the server settings to make the nodes start communicating again.