How to resend modbus tcp if read is diffrend from send message

Hi can some one help me with my code?
i have problems sending to my plc. some times i get a message overload on my plc.
what am i doing wrong?
how do i add a resend message if read is diffrend from send message.

this is wat i tryed.

[{"id":"6c560d76158350dd","type":"modbus-write","z":"1be78c195e5bd566","name":"Ventilatie stand 3","showStatusActivities":false,"showErrors":true,"showWarnings":true,"unitid":"1","dataType":"HoldingRegister","adr":"9","quantity":"1","server":"ad0c41710a0ba6e7","emptyMsgOnFail":false,"keepMsgProperties":false,"delayOnStart":false,"startDelayTime":"","x":1590,"y":1520,"wires":[[],["e8c0052f0aa953e9"]]},{"id":"63f61bdb35f3f396","type":"change","z":"1be78c195e5bd566","name":"HA to Modbus","rules":[{"t":"change","p":"payload","pt":"msg","from":"true","fromt":"bool","to":"1","tot":"num"},{"t":"change","p":"payload","pt":"msg","from":"false","fromt":"bool","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1340,"y":1520,"wires":[["6c560d76158350dd"]]},{"id":"850d80871b8f44c6","type":"ha-binary-sensor","z":"1be78c195e5bd566","name":"Ventilatie stand 3","entityConfig":"fdbfe1e176ea0223","version":0,"state":"payload[0]","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":1800,"y":1600,"wires":[[]]},{"id":"e8c0052f0aa953e9","type":"debug","z":"1be78c195e5bd566","name":"Ventilatie stand 3","active":false,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1840,"y":1520,"wires":[]},{"id":"d807a1c248f7920a","type":"modbus-read","z":"1be78c195e5bd566","name":"ventilatie stand 3","topic":"Verwarming","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"showWarnings":true,"unitid":"1","dataType":"Coil","adr":"8227","quantity":"1","rate":"1","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"ad0c41710a0ba6e7","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":1340,"y":1600,"wires":[["e746ad9cfd40ff30","67ac84237ddf1d80","f337672cd583e0e3"],[]]},{"id":"e746ad9cfd40ff30","type":"change","z":"1be78c195e5bd566","name":"modbus to HA","rules":[{"t":"change","p":"payload[0]","pt":"msg","from":"true","fromt":"bool","to":"1","tot":"num"},{"t":"change","p":"payload[0]","pt":"msg","from":"false","fromt":"bool","to":"0","tot":"num"},{"t":"delete","p":"payload[1]","pt":"msg"},{"t":"delete","p":"payload.data[2]","pt":"msg"},{"t":"delete","p":"payload.data[3]","pt":"msg"},{"t":"delete","p":"payload.data[4]","pt":"msg"},{"t":"delete","p":"payload.data[5]","pt":"msg"},{"t":"delete","p":"payload.data[6]","pt":"msg"},{"t":"delete","p":"payload.data[7]","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1580,"y":1600,"wires":[["850d80871b8f44c6"]]},{"id":"1544a02e80ecbf02","type":"poll-state","z":"1be78c195e5bd566","name":"Themperatuur warmwater","server":"77dd40a13d434cc2","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"10","updateIntervalType":"num","updateIntervalUnits":"seconds","outputinitially":false,"outputonchanged":false,"entity_id":"sensor.9_radiatoren_retour","state_type":"num","halt_if":"","halt_if_type":"num","halt_if_compare":"is","outputs":1,"x":120,"y":1520,"wires":[["e337330c81caecf2"]]},{"id":"1aa2ac6dd24aaf60","type":"debug","z":"1be78c195e5bd566","name":"stand 3","active":false,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":860,"y":1580,"wires":[]},{"id":"e337330c81caecf2","type":"simple thermostat","z":"1be78c195e5bd566","name":"","target":"20","ifAbove":"true","ifBelow":"false","equal":"true","default":"false","x":400,"y":1520,"wires":[["0f1341181804a052","d94d6076a4b1de65","a1bdc5672c95092b"]]},{"id":"d68f4076921195fd","type":"delay","z":"1be78c195e5bd566","name":"","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":870,"y":1520,"wires":[["d33840e0e15a32da","6f34cdabad20c9a8"]]},{"id":"f2bad3f0f68137e9","type":"function","z":"1be78c195e5bd566","name":"function 6","func":"if (msg.payload.sent != msg.payload.read[0]) {\n    msg.resend = true;\n} else {\n    msg.resend = false;\n}\nreturn msg;\n\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1260,"y":1710,"wires":[["d33840e0e15a32da","881291efd0114b2b"]]},{"id":"fc08859b5144ed8a","type":"debug","z":"1be78c195e5bd566","name":"Ventilatie stand 3 - 2","active":false,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload[0]","targetType":"msg","statusVal":"payload","statusType":"auto","x":1490,"y":1800,"wires":[]},{"id":"2b514d413683d797","type":"debug","z":"1be78c195e5bd566","name":"Ventilatie stand 3 - 3","active":false,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload.sent","targetType":"msg","statusVal":"payload","statusType":"auto","x":1170,"y":1810,"wires":[]},{"id":"881291efd0114b2b","type":"debug","z":"1be78c195e5bd566","name":"Ventilatie stand 3 - 1","active":false,"tosidebar":true,"console":true,"tostatus":true,"complete":"resend","targetType":"msg","statusVal":"payload","statusType":"auto","x":1580,"y":1710,"wires":[]},{"id":"d33840e0e15a32da","type":"msg-resend","z":"1be78c195e5bd566","interval":"1","intervalUnit":"secs","maximum":"60","bytopic":true,"clone":true,"firstDelayed":true,"addCounters":false,"waitForResend":true,"highRate":true,"outputCountField":"","outputMaxField":"","name":"","x":1110,"y":1520,"wires":[["63f61bdb35f3f396"]]},{"id":"67ac84237ddf1d80","type":"debug","z":"1be78c195e5bd566","name":"Ventilatie stand 3 - 0","active":false,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload[0]","targetType":"msg","statusVal":"payload","statusType":"auto","x":1580,"y":1660,"wires":[]},{"id":"6f34cdabad20c9a8","type":"change","z":"1be78c195e5bd566","name":"payload.sent","rules":[{"t":"move","p":"payload","pt":"msg","to":"payload.sent","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":980,"y":1740,"wires":[["2b514d413683d797","f2bad3f0f68137e9"]]},{"id":"f337672cd583e0e3","type":"change","z":"1be78c195e5bd566","name":"payload.read","rules":[{"t":"delete","p":"payload[1]","pt":"msg"},{"t":"delete","p":"payload.data[2]","pt":"msg"},{"t":"delete","p":"payload.data[3]","pt":"msg"},{"t":"delete","p":"payload.data[4]","pt":"msg"},{"t":"delete","p":"payload.data[5]","pt":"msg"},{"t":"delete","p":"payload.data[6]","pt":"msg"},{"t":"delete","p":"payload.data[7]","pt":"msg"},{"t":"move","p":"payload[0]","pt":"msg","to":"payload.read","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1070,"y":1640,"wires":[["f2bad3f0f68137e9","fc08859b5144ed8a"]]},{"id":"d94d6076a4b1de65","type":"junction","z":"1be78c195e5bd566","x":660,"y":1520,"wires":[["1aa2ac6dd24aaf60","d68f4076921195fd"]]},{"id":"ad0c41710a0ba6e7","type":"modbus-client","name":"Click plc","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":true,"queueLogEnabled":false,"failureLogEnabled":true,"tcpHost":"192.168.178.9","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"0x3A","unit_id":"1","commandDelay":"100","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true},{"id":"fdbfe1e176ea0223","type":"ha-entity-config","server":"77dd40a13d434cc2","deviceConfig":"f88dd2532e5d37c8","name":"Ventilatie stand 3","version":"6","entityType":"binary_sensor","haConfig":[{"property":"name","value":"Ventilatie stand 3"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":""}],"resend":false,"debugEnabled":false},{"id":"77dd40a13d434cc2","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":": ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"default","statusTimeFormat":"h:m","enableGlobalContextStore":false},{"id":"f88dd2532e5d37c8","type":"ha-device-config","name":"Verwarming","hwVersion":"","manufacturer":"Node-RED","model":"","swVersion":""}]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.