As for progress, there’s been none as far as I know in terms of fixing the component’s timing or allowing configurable delays between commands.
The only progress I’m aware of is a work-in-progress pull request from 12 days ago to allow multiple hubs:
Personally, I don’t have any hope that there will be a timely resolution for the issue (from the group of volunteer programmers we have) so I got a modbus RTU->TCP/IP converter a month or two ago, and the Modbus TCP/IP component seems to work fine. Or, as another user pointed out, you could try reading it in through NodeRed i suppose…
I have the ‘No response from Modbus Slave…’ issue too. (SDM230 and SDM120 power meters connected to USB on the Pi. SDM120 gives continuous errors. SDM230 is fine)
The node red modbus implementation works fine for me, I am reading 18 push buttons, four temperature sensors and six SDM120 power meters. The push buttons are read every 200 ms and the others a bit less frequent. I am then publishing these to MQTT sensors which home assistant picks up. It is very fast and I have no errors. I am also writing coils and registers from node red to my PLC. I can recommend this approach.
Hi,
Sorry for late reply, I have been kind of busy lately… But here is a copy of one of my flows for reading data from a SDM120 power meter. I am using modbus RTU over ethernet so you will have to change that to use serial if that is what you are using.
[{“id”:“3ff3c8de.aec258”,“type”:“inject”,“z”:“151c0cc5.f5da43”,“name”:“10 sec injector”,“topic”:“”,“payload”:“”,“payloadType”:“date”,“repeat”:“10”,“crontab”:“”,“once”:false,“onceDelay”:0.1,“x”:180,“y”:180,“wires”:[[“287acab3.2791a6”]]},{“id”:“287acab3.2791a6”,“type”:“function”,“z”:“151c0cc5.f5da43”,“name”:“Read 14 registers from slave 1”,“func”:“msg.payload = {\n ‘fc’: 4, \n ‘unitid’: 1, \n ‘address’: 0 ,\n ‘quantity’: 14 \n};\nreturn msg;”,“outputs”:1,“noerr”:0,“x”:170,“y”:220,“wires”:[[“12c70b26.040335”]]},{“id”:“12c70b26.040335”,“type”:“modbus-flex-getter”,“z”:“151c0cc5.f5da43”,“name”:“voltage”,“showStatusActivities”:false,“showErrors”:false,“logIOActivities”:false,“server”:“47e72f12.61fc5”,“useIOFile”:false,“ioFile”:“”,“useIOForPayload”:false,“x”:120,“y”:280,“wires”:[[“444e31ff.fe70a”],]},{“id”:“444e31ff.fe70a”,“type”:“function”,“z”:“151c0cc5.f5da43”,“name”:“splitter”,“func”:“var x = [0,0,0,0,0,0,0,0,0,0,0,0,0,0];\nvar msg_o = [0,0,0,0,0,0,0,0,0,0,0,0,0,0];\nfor(i=0;i<14; i++){\n msg_o[i] = {payload: msg.payload[i]}; \n}\nreturn msg_o;”,“outputs”:14,“noerr”:0,“x”:410,“y”:260,“wires”:[[“fcae43a4.eaa99”],[“fcae43a4.eaa99”],,,,,[“7c2709b6.f7f588”],[“7c2709b6.f7f588”],,,,,[“e36ec90b.af1458”],[“e36ec90b.af1458”]],“outputLabels”:[“coil 100 livingroom1”,“coil 101”,“coil 102”,“coil 103”,“”,“”,“”,“”,null,null,null,null,null,null]},{“id”:“fcae43a4.eaa99”,“type”:“join”,“z”:“151c0cc5.f5da43”,“name”:“”,“mode”:“custom”,“build”:“array”,“property”:“payload”,“propertyType”:“msg”,“key”:“topic”,“joiner”:“\n”,“joinerType”:“str”,“accumulate”:false,“timeout”:“”,“count”:“2”,“reduceRight”:false,“reduceExp”:“”,“reduceInit”:“”,“reduceInitType”:“”,“reduceFixup”:“”,“x”:570,“y”:180,“wires”:[[“5bb317c7.4ac088”]]},{“id”:“7c2709b6.f7f588”,“type”:“join”,“z”:“151c0cc5.f5da43”,“name”:“”,“mode”:“custom”,“build”:“array”,“property”:“payload”,“propertyType”:“msg”,“key”:“topic”,“joiner”:“\n”,“joinerType”:“str”,“accumulate”:false,“timeout”:“”,“count”:“2”,“reduceRight”:false,“reduceExp”:“”,“reduceInit”:“”,“reduceInitType”:“”,“reduceFixup”:“”,“x”:570,“y”:240,“wires”:[[“1a80b27b.0efefe”]]},{“id”:“e36ec90b.af1458”,“type”:“join”,“z”:“151c0cc5.f5da43”,“name”:“”,“mode”:“custom”,“build”:“array”,“property”:“payload”,“propertyType”:“msg”,“key”:“topic”,“joiner”:“\n”,“joinerType”:“str”,“accumulate”:false,“timeout”:“”,“count”:“2”,“reduceRight”:false,“reduceExp”:“”,“reduceInit”:“”,“reduceInitType”:“”,“reduceFixup”:“”,“x”:570,“y”:300,“wires”:[[“5cbb0f4b.4d56d”]]},{“id”:“5bb317c7.4ac088”,“type”:“function”,“z”:“151c0cc5.f5da43”,“name”:“convert to float”,“func”:“var rawData = new ArrayBuffer(4);\nvar intView = new Uint16Array(rawData);\nvar fltView = new Float32Array(rawData);\n\n\nintView[0] = msg.payload[1]; //low\nintView[1] = msg.payload[0]; //high\n\n\nmsg.payload = parseFloat(fltView[0]).toFixed(1);\nmsg.payload = Number(msg.payload);\n\nreturn msg;”,“outputs”:1,“noerr”:0,“x”:740,“y”:180,“wires”:[[“5e854b4.e15a6b4”]]},{“id”:“1a80b27b.0efefe”,“type”:“function”,“z”:“151c0cc5.f5da43”,“name”:“convert to float”,“func”:“var rawData = new ArrayBuffer(4);\nvar intView = new Uint16Array(rawData);\nvar fltView = new Float32Array(rawData);\n\n\nintView[0] = msg.payload[1]; //low\nintView[1] = msg.payload[0]; //high\n\n\nmsg.payload = parseFloat(fltView[0]).toFixed(1);\nmsg.payload = Number(msg.payload);\n\nreturn msg;”,“outputs”:1,“noerr”:0,“x”:740,“y”:240,“wires”:[[“4782900e.d6d67”]]},{“id”:“5cbb0f4b.4d56d”,“type”:“function”,“z”:“151c0cc5.f5da43”,“name”:“convert to float”,“func”:“var rawData = new ArrayBuffer(4);\nvar intView = new Uint16Array(rawData);\nvar fltView = new Float32Array(rawData);\n\n\nintView[0] = msg.payload[1]; //low\nintView[1] = msg.payload[0]; //high\n\n\nmsg.payload = parseFloat(fltView[0]).toFixed(1);\nmsg.payload = Number(msg.payload);\n\nreturn msg;”,“outputs”:1,“noerr”:0,“x”:740,“y”:300,“wires”:[[“25e56.c9a981aa4”]]},{“id”:“5e854b4.e15a6b4”,“type”:“mqtt out”,“z”:“151c0cc5.f5da43”,“name”:“bathroom floor heating Voltage”,“topic”:“home/bathroom/floor_heating/voltage”,“qos”:“”,“retain”:“”,“broker”:“122d308f.7370af”,“x”:1010,“y”:180,“wires”:},{“id”:“4782900e.d6d67”,“type”:“mqtt out”,“z”:“151c0cc5.f5da43”,“name”:“bathroom floor heating current”,“topic”:“home/bathroom/floor_heating/current”,“qos”:“”,“retain”:“”,“broker”:“122d308f.7370af”,“x”:1010,“y”:240,“wires”:},{“id”:“25e56.c9a981aa4”,“type”:“mqtt out”,“z”:“151c0cc5.f5da43”,“name”:“bathroom floor heating power”,“topic”:“home/bathroom/floor_heating/power”,“qos”:“”,“retain”:“”,“broker”:“122d308f.7370af”,“x”:1000,“y”:300,“wires”:},{“id”:“47e72f12.61fc5”,“type”:“modbus-client”,“z”:“”,“name”:“ADM5850”,“clienttype”:“tcp”,“bufferCommands”:true,“stateLogEnabled”:false,“tcpHost”:“192.168.42.185”,“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,“reconnectTimeout”:2000},{“id”:“122d308f.7370af”,“type”:“mqtt-broker”,“z”:“”,“name”:“Mosquitto”,“broker”:“192.168.42.187”,“port”:“1883”,“clientid”:“”,“usetls”:false,“compatmode”:true,“keepalive”:“60”,“cleansession”:true,“birthTopic”:“”,“birthQos”:“0”,“birthPayload”:“”,“closeTopic”:“”,“closeQos”:“0”,“closePayload”:“”,“willTopic”:“”,“willQos”:“0”,“willPayload”:“”}]
I don’t think this is the most elegant way to do things but it seems to work fine for me.
Did you add the node-red-contrib-modbus module? I. Don’t know anything else, I’m not very good with node red… Maybe there are some errors in a log somewhere?
Not sure if anyone has tried that to see if it helps.
I’m also getting the same issue with my modbus system, so I will try the above update and see if it helps.
Failing that, I do like the idea of sending messages between HA and node-red via mqtt and using node-red to send the modbus signals. I’ll probably give that a try as well.
Agreed. I just tried the update and it still randmonly failed. Think I might have to give up with that at the moment.
I have just tried node-red, and mqtt switch, and nodered-contribute-modbus and so far it seems to be working quite well.
I’ve got the following simple flow working. Pierre, you might want to try this and see if it work. I’m using a modbus switch, so I’m using FC5 (force coil). I’m not doing anything with the output and no checking is done, but it’s a good first step.
[{"id":"cf294862.7e8b68","type":"tab","label":"SDM","disabled":false,"info":""},{"id":"39fe0e66.c9799a","type":"comment","z":"cf294862.7e8b68","name":"SDM230 Energy Meter","info":"","x":160,"y":80,"wires":[]},{"id":"94d8cc20.dddda8","type":"modbus-read","z":"cf294862.7e8b68","name":"SDM 230 Voltage","topic":"","showStatusActivities":true,"logIOActivities":false,"showErrors":true,"unitid":"1","dataType":"InputRegister","adr":"0","quantity":"2","rate":"15","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"8a72579f.202908","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":160,"y":140,"wires":[["8e5f6d2b.cfc398"],[]]},{"id":"8e5f6d2b.cfc398","type":"function","z":"cf294862.7e8b68","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":380,"y":140,"wires":[["9f73b54.da6f348","755cac29.d21844"]]},{"id":"9f73b54.da6f348","type":"ui_text","z":"cf294862.7e8b68","group":"52e8e5ce.130db4","order":1,"width":0,"height":0,"name":"","label":"Voltage","format":"{{msg.payload}} V","layout":"row-spread","x":560,"y":140,"wires":[]},{"id":"2d92317c.0c8ff6","type":"modbus-read","z":"cf294862.7e8b68","name":"SDM 230 Current","topic":"","showStatusActivities":true,"logIOActivities":false,"showErrors":true,"unitid":"1","dataType":"InputRegister","adr":"6","quantity":"2","rate":"15","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"8a72579f.202908","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":160,"y":200,"wires":[["ffab16d2.30bce8"],[]]},{"id":"ffab16d2.30bce8","type":"function","z":"cf294862.7e8b68","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":380,"y":200,"wires":[["3dce87d7.a582d","755cac29.d21844"]]},{"id":"3dce87d7.a582d","type":"ui_text","z":"cf294862.7e8b68","group":"52e8e5ce.130db4","order":2,"width":0,"height":0,"name":"","label":"Current","format":"{{msg.payload}} A","layout":"row-spread","x":560,"y":200,"wires":[]},{"id":"dd502269.cf075","type":"modbus-read","z":"cf294862.7e8b68","name":"SDM 230 Power","topic":"","showStatusActivities":true,"logIOActivities":false,"showErrors":true,"unitid":"1","dataType":"InputRegister","adr":"12","quantity":"2","rate":"15","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"8a72579f.202908","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":160,"y":260,"wires":[["7c9ac9f6.45e8c"],[]]},{"id":"7c9ac9f6.45e8c","type":"function","z":"cf294862.7e8b68","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":370,"y":260,"wires":[["ecdf6f70.f8cf8","755cac29.d21844"]]},{"id":"ecdf6f70.f8cf8","type":"ui_text","z":"cf294862.7e8b68","group":"52e8e5ce.130db4","order":3,"width":0,"height":0,"name":"","label":"Power","format":"{{msg.payload}} W","layout":"row-spread","x":550,"y":260,"wires":[]},{"id":"2a33780f.6c1dc8","type":"modbus-read","z":"cf294862.7e8b68","name":"SDM 230 Energy Imp","topic":"","showStatusActivities":true,"logIOActivities":false,"showErrors":true,"unitid":"1","dataType":"InputRegister","adr":"72","quantity":"2","rate":"15","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"8a72579f.202908","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":180,"y":320,"wires":[["39e8800a.b2141"],[]]},{"id":"39e8800a.b2141","type":"function","z":"cf294862.7e8b68","name":"Import","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]) * 1.00361 + 36481.26).toFixed(2) ;\nmsg.topic = \"import\";\n\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.topic + \":\" + msg.payload}); \n\nreturn msg;","outputs":1,"noerr":0,"x":370,"y":320,"wires":[["6860a00d.4d03","755cac29.d21844"]]},{"id":"6860a00d.4d03","type":"ui_text","z":"cf294862.7e8b68","group":"52e8e5ce.130db4","order":4,"width":0,"height":0,"name":"","label":"Energy Import","format":"{{msg.payload}} kWh","layout":"row-spread","x":580,"y":320,"wires":[]},{"id":"7a47858b.2a485c","type":"modbus-read","z":"cf294862.7e8b68","name":"SDM 230 Energy Exp","topic":"","showStatusActivities":true,"logIOActivities":false,"showErrors":true,"unitid":"1","dataType":"InputRegister","adr":"74","quantity":"2","rate":"15","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"8a72579f.202908","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":180,"y":380,"wires":[["f8a5e4dd.65dd4"],[]]},{"id":"f8a5e4dd.65dd4","type":"function","z":"cf294862.7e8b68","name":"Export","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]) * 1.00229 + 10274.41).toFixed(2);\nmsg.topic = \"export\";\n\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.topic + \":\" + msg.payload}); \n\nreturn msg;","outputs":1,"noerr":0,"x":370,"y":380,"wires":[["386c164e.4bbc1a","755cac29.d21844"]]},{"id":"386c164e.4bbc1a","type":"ui_text","z":"cf294862.7e8b68","group":"52e8e5ce.130db4","order":5,"width":0,"height":0,"name":"","label":"Energy Export","format":"{{msg.payload}} kWh","layout":"row-spread","x":580,"y":380,"wires":[]},{"id":"9f8b2c57.5d5a3","type":"comment","z":"cf294862.7e8b68","name":"SDM120 Energy Meter","info":"","x":160,"y":460,"wires":[]},{"id":"a6cb9467.69a86","type":"modbus-read","z":"cf294862.7e8b68","name":"SDM 120 Voltage","topic":"","showStatusActivities":true,"logIOActivities":false,"showErrors":true,"unitid":"2","dataType":"InputRegister","adr":"0","quantity":"2","rate":"15","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"8a72579f.202908","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":160,"y":520,"wires":[["5a8f390e.8a6918"],[]]},{"id":"5a8f390e.8a6918","type":"function","z":"cf294862.7e8b68","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":380,"y":520,"wires":[["97ca0cdb.71eb2","7ee2add0.e052cc"]]},{"id":"97ca0cdb.71eb2","type":"ui_text","z":"cf294862.7e8b68","group":"519e323e.f5f804","order":1,"width":0,"height":0,"name":"","label":"Voltage","format":"{{msg.payload}} V","layout":"row-spread","x":560,"y":520,"wires":[]},{"id":"70f61194.d2be9","type":"modbus-read","z":"cf294862.7e8b68","name":"SDM 120 Current","topic":"","showStatusActivities":true,"logIOActivities":false,"showErrors":true,"unitid":"2","dataType":"InputRegister","adr":"6","quantity":"2","rate":"15","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"8a72579f.202908","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":160,"y":580,"wires":[["29bb0407.d78ee4"],[]]},{"id":"29bb0407.d78ee4","type":"function","z":"cf294862.7e8b68","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":380,"y":580,"wires":[["17f9b22e.8513be","7ee2add0.e052cc"]]},{"id":"17da4ae.2fe14b5","type":"modbus-read","z":"cf294862.7e8b68","name":"SDM 120 Power","topic":"","showStatusActivities":true,"logIOActivities":false,"showErrors":true,"unitid":"2","dataType":"InputRegister","adr":"12","quantity":"2","rate":"15","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"8a72579f.202908","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":160,"y":640,"wires":[["a63fa0d5.975f4"],[]]},{"id":"a63fa0d5.975f4","type":"function","z":"cf294862.7e8b68","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":370,"y":640,"wires":[["9862b54a.ce90d8","7ee2add0.e052cc"]]},{"id":"9862b54a.ce90d8","type":"ui_text","z":"cf294862.7e8b68","group":"519e323e.f5f804","order":3,"width":0,"height":0,"name":"","label":"Power","format":"{{msg.payload}} W","layout":"row-spread","x":550,"y":640,"wires":[]},{"id":"162178a0.2804af","type":"modbus-read","z":"cf294862.7e8b68","name":"SDM 120 Energy Sol","topic":"","showStatusActivities":true,"logIOActivities":false,"showErrors":true,"unitid":"2","dataType":"InputRegister","adr":"72","quantity":"2","rate":"15","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"8a72579f.202908","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":180,"y":700,"wires":[["82d22530.e1375","8ec5d960.4ca1d8"],[]]},{"id":"82d22530.e1375","type":"function","z":"cf294862.7e8b68","name":"Solar","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] * 1.00099 + 21326.51).toFixed(2);\nmsg.topic = \"solar\";\n\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.topic + \":\" + msg.payload}); \n\nreturn msg;","outputs":1,"noerr":0,"x":370,"y":700,"wires":[["f5ea2005.21f028","7ee2add0.e052cc"]]},{"id":"f5ea2005.21f028","type":"ui_text","z":"cf294862.7e8b68","group":"519e323e.f5f804","order":4,"width":0,"height":0,"name":"","label":"Energy Solar","format":"{{msg.payload}} kWh","layout":"row-spread","x":570,"y":700,"wires":[]},{"id":"17f9b22e.8513be","type":"ui_text","z":"cf294862.7e8b68","group":"519e323e.f5f804","order":2,"width":0,"height":0,"name":"","label":"Current","format":"{{msg.payload}} A","layout":"row-spread","x":560,"y":580,"wires":[]},{"id":"b4d90c81.c15988","type":"modbus-queue-info","z":"cf294862.7e8b68","name":"SDM120_queue","topic":"","unitid":"2","queueReadIntervalTime":"5000","lowLowLevel":"1","lowLevel":75,"highLevel":150,"highHighLevel":300,"server":"5642d1a0.fe87f8","errorOnHighLevel":false,"x":520,"y":900,"wires":[["ffd37a29.367e28"]]},{"id":"76179178.c5d938","type":"inject","z":"cf294862.7e8b68","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":149.00000762939453,"y":901.0000247955322,"wires":[["606911.9f3c9ef"]]},{"id":"606911.9f3c9ef","type":"change","z":"cf294862.7e8b68","name":"Reset queue","rules":[{"t":"set","p":"resetQueue","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":318.00000762939453,"y":901.0000114440918,"wires":[["b4d90c81.c15988"]]},{"id":"cddb4c9d.baf348","type":"function","z":"cf294862.7e8b68","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":392.8571548461914,"y":1031.1428470611572,"wires":[["b4d90c81.c15988","ee028367.4ac758"]]},{"id":"44043ade.580f5c","type":"catch","z":"cf294862.7e8b68","name":"Catch queue errors","scope":["b4d90c81.c15988"],"x":154.8571548461914,"y":1031.1428470611572,"wires":[["cddb4c9d.baf348"]]},{"id":"c3715613.168cc8","type":"comment","z":"cf294862.7e8b68","name":"Error handling","info":"","x":120.8571548461914,"y":986.1428470611572,"wires":[]},{"id":"ee028367.4ac758","type":"function","z":"cf294862.7e8b68","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":692.8571548461914,"y":1030.1428470611572,"wires":[["390172ec.6edbce"]]},{"id":"390172ec.6edbce","type":"link out","z":"cf294862.7e8b68","name":"","links":["13e089a7.73cb46"],"x":878.8571548461914,"y":1030.1428470611572,"wires":[]},{"id":"5f3cd465.3b374c","type":"catch","z":"cf294862.7e8b68","name":"Modbus read errors","scope":["70f61194.d2be9","162178a0.2804af","17da4ae.2fe14b5","a6cb9467.69a86","9f8b2c57.5d5a3"],"x":154.8571548461914,"y":1074.1428470611572,"wires":[["ee788b69.b501d8"]]},{"id":"ee788b69.b501d8","type":"function","z":"cf294862.7e8b68","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":443.8571548461914,"y":1074.1428470611572,"wires":[["237b54e8.3c67bc"]]},{"id":"237b54e8.3c67bc","type":"link out","z":"cf294862.7e8b68","name":"","links":["13e089a7.73cb46"],"x":629.8571548461914,"y":1074.1428470611572,"wires":[]},{"id":"ffd37a29.367e28","type":"debug","z":"cf294862.7e8b68","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":720.8571548461914,"y":899.1428470611572,"wires":[]},{"id":"8ec5d960.4ca1d8","type":"function","z":"cf294862.7e8b68","name":"Health check","func":"var devicename = \"sdm120\"; // Device name used for context variable\nvar system_id = 4; // System id number for diagnostic update\nvar online_threshold = 10; // Seconds between updates under which the device is considered online\nvar offline_threshold = 30; // Seconds between updates above which the device is considered offline\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>24*60*60) {\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<online_threshold) {\n msg.payload = \"SDM120 is now online\";\n msg.system = system_id; // 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>offline_threshold) {\n msg.payload = \"SDM120 is not transmitting\";\n msg.system = system_id; // 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":390,"y":780,"wires":[["6cea0c6a.628304"]]},{"id":"ab080220.2b2ab8","type":"inject","z":"cf294862.7e8b68","name":"Check","topic":"timecheck","payload":"","payloadType":"date","repeat":"1","crontab":"","once":false,"x":140,"y":780,"wires":[["8ec5d960.4ca1d8"]]},{"id":"6cea0c6a.628304","type":"switch","z":"cf294862.7e8b68","name":"Update diag?","property":"warning","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","outputs":1,"x":585,"y":780,"wires":[["b3c5cd90.09b32"]]},{"id":"b3c5cd90.09b32","type":"link out","z":"cf294862.7e8b68","name":"","links":["13e089a7.73cb46"],"x":704.3015727996826,"y":779.571403503418,"wires":[]},{"id":"42364693.260b28","type":"modbus-queue-info","z":"cf294862.7e8b68","name":"SDM230_queue","topic":"","unitid":"1","queueReadIntervalTime":"5000","lowLowLevel":"1","lowLevel":75,"highLevel":150,"highHighLevel":300,"server":"5642d1a0.fe87f8","errorOnHighLevel":false,"x":520,"y":1160,"wires":[["dfb73b19.107e18"]]},{"id":"79d3e78d.d2d238","type":"inject","z":"cf294862.7e8b68","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":149.00000762939453,"y":1161.0000247955322,"wires":[["6e42ae1a.04f558"]]},{"id":"6e42ae1a.04f558","type":"change","z":"cf294862.7e8b68","name":"Reset queue","rules":[{"t":"set","p":"resetQueue","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":318.00000762939453,"y":1161.0000114440918,"wires":[["42364693.260b28"]]},{"id":"40512c9f.ca430c","type":"function","z":"cf294862.7e8b68","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":392.8571548461914,"y":1291.1428470611572,"wires":[["42364693.260b28","2fe0a353.be909c"]]},{"id":"cb6ecebf.2473","type":"catch","z":"cf294862.7e8b68","name":"Catch queue errors","scope":["42364693.260b28"],"x":154.8571548461914,"y":1291.1428470611572,"wires":[["40512c9f.ca430c"]]},{"id":"438810a9.d9bb28","type":"comment","z":"cf294862.7e8b68","name":"Error handling","info":"","x":120.8571548461914,"y":1246.1428470611572,"wires":[]},{"id":"2fe0a353.be909c","type":"function","z":"cf294862.7e8b68","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":692.8571548461914,"y":1290.1428470611572,"wires":[["3ff9ed9f.31f832"]]},{"id":"3ff9ed9f.31f832","type":"link out","z":"cf294862.7e8b68","name":"","links":["13e089a7.73cb46"],"x":878.8571548461914,"y":1290.1428470611572,"wires":[]},{"id":"e85a26d5.e99ea8","type":"catch","z":"cf294862.7e8b68","name":"Modbus read errors","scope":["2d92317c.0c8ff6","7a47858b.2a485c","2a33780f.6c1dc8","dd502269.cf075","94d8cc20.dddda8","39fe0e66.c9799a"],"x":154.8571548461914,"y":1334.1428470611572,"wires":[["f880d888.e379f8"]]},{"id":"f880d888.e379f8","type":"function","z":"cf294862.7e8b68","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":443.8571548461914,"y":1334.1428470611572,"wires":[["93665473.948328"]]},{"id":"93665473.948328","type":"link out","z":"cf294862.7e8b68","name":"","links":["13e089a7.73cb46"],"x":629.8571548461914,"y":1334.1428470611572,"wires":[]},{"id":"dfb73b19.107e18","type":"debug","z":"cf294862.7e8b68","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":720.8571548461914,"y":1159.1428470611572,"wires":[]},{"id":"7ee2add0.e052cc","type":"function","z":"cf294862.7e8b68","name":"Build object","func":"watch_topic = \"solar\";\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(\"solar\")!==undefined) {\n output.solar = context.get(\"solar\");\n}\nmsg.payload = output;\n\nif (msg.topic===watch_topic) {\n msg.topic = \"sdm120\";\n return msg;\n}","outputs":1,"noerr":0,"x":810,"y":600,"wires":[["d795a631.b276e8","e649422c.1df178"]]},{"id":"d795a631.b276e8","type":"debug","z":"cf294862.7e8b68","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":970,"y":600,"wires":[]},{"id":"e649422c.1df178","type":"mqtt out","z":"cf294862.7e8b68","name":"SDM120","topic":"sdm120","qos":"","retain":"","broker":"eb79ed91.8ce1a8","x":980,"y":540,"wires":[]},{"id":"755cac29.d21844","type":"function","z":"cf294862.7e8b68","name":"Build object","func":"watch_topic = \"export\";\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(\"import\")!==undefined) {\n output.import = context.get(\"import\");\n}\nif (context.get(\"export\")!==undefined) {\n output.export = context.get(\"export\");\n}\nmsg.payload = output;\n\nif (msg.topic===watch_topic) {\n msg.topic = \"sdm230\";\n return msg;\n}","outputs":1,"noerr":0,"x":810,"y":260,"wires":[["88577a71.23e0a8","ae174f35.284c3"]]},{"id":"88577a71.23e0a8","type":"debug","z":"cf294862.7e8b68","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":970,"y":260,"wires":[]},{"id":"ae174f35.284c3","type":"mqtt out","z":"cf294862.7e8b68","name":"SDM230","topic":"sdm230","qos":"","retain":"","broker":"eb79ed91.8ce1a8","x":980,"y":200,"wires":[]},{"id":"8a72579f.202908","type":"modbus-client","z":"","name":"Serial_9600_8_N_1","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":"","commandDelay":30,"clientTimeout":2000,"reconnectTimeout":5000},{"id":"52e8e5ce.130db4","type":"ui_group","z":"","name":"SDM 230 Energy Meter","tab":"543f66f3.88086","order":2,"disp":true,"width":"6","collapse":false},{"id":"519e323e.f5f804","type":"ui_group","z":"","name":"SDM 120 Energy Meter","tab":"543f66f3.88086","order":2,"disp":true,"width":"6","collapse":false},{"id":"5642d1a0.fe87f8","type":"modbus-client","z":"","name":"Serial_9600_8_N_1","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":"","commandDelay":"30","clientTimeout":"2000","reconnectTimeout":"5000"},{"id":"eb79ed91.8ce1a8","type":"mqtt-broker","z":"","name":"Mosquitto","broker":"192.168.1.200","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""},{"id":"543f66f3.88086","type":"ui_tab","z":"","name":"Modbus","icon":"memory","order":15}]
and this custom card:
and much insight from:
by Csongor Varga for my SDM120 (solar power) and SDM230 (grid import/export).
I’m using 3 modbus devices. Running the default modbus component, and 2 copies of the orginal modbus component as custom_components(Modbus over TCP/UDP).
I’m getting this issue very often(On all 3).
It seems like it occurs more often if using Modbus TCP rather than Modbus UDP.
At the end of this log you can see the error message:
No response from hub default, slave 1, register 1104
It feels like there should be some delay between the queries, it seems like it sends all queries at the same time, flooding the modbus unit.
I appreciate your help.
I am playing with that a couple of day and always:
“No response from hub huawei, slave 1, register 32081
17:47 components/modbus/sensor.py (ERROR)”
I put your logger code into configuration.yaml, but else?
Pls let me know some other instructions, how to solve it…