Modbustcp-read Function Script

I checked and tried everything again. I can't get it to work. :frowning:

@Cupra, if you dont mind, there is a lot of traffic in this thread and I cant make out where you are at, so can we start from the beginning.

  1. Have you ever been able to read anything from the modbus device. Anything at all. If so, show me what you did (show the flow) and show me the output (debug message expanded - screenshot)

  2. (after you answer No 1) :slight_smile:

flows (3) (1).json (11 KB)

This flow runs ok on my raspberry pi.
But it should run on my CCU, but I don't have a sequencer there, due to the system, only node-red-contrib-modbus v5.13.3 can be installed.

ok, I'll try again.

  1. Using node-red-contrib-modbus on the CCU, have you ever been able to read anything from the modbus device. Anything at all. If so, show me what you did (show the flow) and show me the output (debug message expanded - screenshot)

PS, if you don't click the "Reply" attached to my post, I don't get a notification & have no idea if you have replied and worse - I cant tell if you are replying to me or someone else!

The screenshot of the debug is in this thread post 32

I have no idea what that screenshot is showing.

If you answer my questions fully I will help you solve this.

The screenshot shows the debug message. The Modbus flex grid connects to the device, but hasn't output anything yet.

if i can get python on the ccu i could load the sequencer and try with that.

Ok, last time, then I give up. Please answer each question (dont second guess my intent or offer me previous screenshots). If you want to solve this, we MUST start from the beginning so I know where we are at.

Also, lets just forget you have a PI - assume every question is about this other device running Node-RED that you are trying to use to get values from ModBus.

1. This is your goal is right?

The connection to the device works. I need 3 registers that I read with modbustcp-read and then want to split into 3 channels with function.

I need help creating the script

Register1 : 100 (Chlor)
Register2 : 115 (PH)
Register3 : 130 (Redox)

2. Can you read anything from the device

Using node-red-contrib-modbus OR using modbustcp-read on the CCU, have you ever been able to read anything from the modbus device? Yes or No

3. If YES, then show me...

If you CAN get any data (even 1 register) using the CCU show me what you did (show the flow from the CCU) and show me the output (debug message expanded - screenshot)

Current flow

[{"id":"34cf62b3.c5426e","type":"ccu-sysvar","z":"e4f0ea06.4e5b38","name":"Redox Wert","ccuConfig":"f91a7c3b4fc2798e","topic":"ReGaHSS/${redox_wert}","change":true,"cache":true,"x":1030,"y":280,"wires":[[]]},{"id":"f91a7c3b4fc2798e","type":"ccu-connection","name":"HmIP CCU3","host":"192.168.178.108","regaEnabled":true,"bcrfEnabled":false,"iprfEnabled":false,"virtEnabled":false,"bcwiEnabled":false,"cuxdEnabled":false,"regaPoll":false,"regaInterval":"30","rpcPingTimeout":"60","rpcInitAddress":"","rpcServerHost":"192.168.178.108","rpcBinPort":"2055","rpcXmlPort":"2056","tls":false,"inSecure":false,"authentication":false,"username":"","password":"","queueTimeout":"5000","queuePause":"250","contextStore":""}]

no debug output!

  1. right
  2. no (only use trigger and modbus-flex-gitter)

You have posted 1 node. a "ccu-sysvar" node.
image

I dont know what type of node that is and I dont know what it has to do with reading ModBus values from your "pool meter".


OK, lets carry on.

Q1. Do you know the IP of the "pool meter"?

Q2. Can you PING the "pool meter" IP address from the Redmatic (Homematic CCU3)? (does the "pool meter" respond?)


TIP (install node-red-node-ping on the CCU if you cannot access a terminal to try the PING)

sorry, this is the current flow

[{"id":"e4f0ea06.4e5b38","type":"tab","label":"Depolox Pool E 700P","disabled":false,"info":""},{"id":"5f8d0e10.8d204","type":"inject","z":"e4f0ea06.4e5b38","name":"Chlor Wert","props":[{"p":"fc","v":"3","vt":"num"},{"p":"address","v":"100","vt":"num"},{"p":"quantity","v":"2","vt":"num"},{"p":"Topic","v":"chlor_wert","vt":"str"}],"repeat":"30","crontab":"","once":true,"onceDelay":"0.5","topic":"","x":190,"y":160,"wires":[["ee1fc629.99b7c8"]]},{"id":"c875c0e6.487cc","type":"inject","z":"e4f0ea06.4e5b38","name":"PH Wert","props":[{"p":"fc","v":"3","vt":"num"},{"p":"address","v":"115","vt":"num"},{"p":"quantity","v":"2","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"30","crontab":"","once":true,"onceDelay":"0.5","topic":"ph_wert","payloadType":"str","x":200,"y":220,"wires":[[]]},{"id":"a3e39dd9.d7162","type":"modbus-flex-getter","z":"e4f0ea06.4e5b38","name":"Depolox Pool E 700P","showStatusActivities":true,"showErrors":true,"logIOActivities":false,"server":"3b446b30.590ab4","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":true,"x":500,"y":360,"wires":[[],["7d907b02.8feda4","d9f3de12.3a2ee"]]},{"id":"c859d8e1.9963d8","type":"ccu-sysvar","z":"e4f0ea06.4e5b38","name":"PH Wert","ccuConfig":"f91a7c3b4fc2798e","topic":"ReGaHSS/${ph_wert}","change":true,"cache":true,"x":1020,"y":220,"wires":[[]]},{"id":"34cf62b3.c5426e","type":"ccu-sysvar","z":"e4f0ea06.4e5b38","name":"Redox Wert","ccuConfig":"f91a7c3b4fc2798e","topic":"ReGaHSS/${redox_wert}","change":true,"cache":true,"x":1030,"y":280,"wires":[[]]},{"id":"7d907b02.8feda4","type":"function","z":"e4f0ea06.4e5b38","name":"Wert Splitter","func":"var temp = Buffer.from(msg.payload.buffer);\nmsg.payload = temp.readFloatBE();\n\nif(msg.topic == \"chlor_wert\"){\n    return([msg,null,null,null,null,null,null,null]);\n}\nif(msg.topic == \"ph_wert\"){\n    return([null,msg,null,null,null,null,null,null]);\n}\nif(msg.topic == \"redox_wert\"){\n    return([null,null,msg,null,null,null,null,null]);\n}\nif (msg.topic.name == \"temp\") {\n    return ([null,null,null,msg,null,null,null,null]);\n}\nif (msg.topic.name == \"cl_soll\") {\n    return ([null,null,null,null,msg,null,null,null]);\n} \nif (msg.topic.name == \"ph_soll\") {\n    return ([null,null,null,null,null,msg,null,null]);\n}\nif (msg.topic.name == \"cl_dos\") {\n    return ([null,null,null,null,null,null,msg,null]);\n}\nif (msg.topic.name == \"ph_dos\") {\n    return ([null,null,null,null,null,null,null,msg]);\n}","outputs":8,"noerr":0,"initialize":"","finalize":"","x":730,"y":360,"wires":[["30b92cd9.2e88d4","c045f3ba.6deb1"],[],[],[],[],[],[],[]]},{"id":"874f459c.99a1e8","type":"ccu-sysvar","z":"e4f0ea06.4e5b38","name":"Temperatur","ccuConfig":"f91a7c3b4fc2798e","topic":"ReGaHSS/${temp}","change":true,"cache":true,"x":1030,"y":340,"wires":[[]]},{"id":"85315900.5704f8","type":"ccu-sysvar","z":"e4f0ea06.4e5b38","name":"Chlor Sollwert","ccuConfig":"f91a7c3b4fc2798e","topic":"ReGaHSS/${cl_soll}","change":true,"cache":true,"x":1040,"y":400,"wires":[[]]},{"id":"dd5e0bbe.62d178","type":"ccu-sysvar","z":"e4f0ea06.4e5b38","name":"PH Sollwert","ccuConfig":"f91a7c3b4fc2798e","topic":"ReGaHSS/${ph_soll}","change":true,"cache":true,"x":1030,"y":460,"wires":[[]]},{"id":"1b88a288.b432dd","type":"ccu-sysvar","z":"e4f0ea06.4e5b38","name":"Chlor Dosierleistung","ccuConfig":"f91a7c3b4fc2798e","topic":"ReGaHSS/${cl_dos}","change":true,"cache":true,"x":1060,"y":520,"wires":[[]]},{"id":"471e0104.4a78a","type":"ccu-sysvar","z":"e4f0ea06.4e5b38","name":"PH Dosierleistung","ccuConfig":"f91a7c3b4fc2798e","topic":"ReGaHSS/${ph_dos}","change":true,"cache":true,"x":1050,"y":580,"wires":[[]]},{"id":"30b92cd9.2e88d4","type":"ccu-sysvar","z":"e4f0ea06.4e5b38","name":"Chlor Wert","ccuConfig":"f91a7c3b4fc2798e","topic":"ReGaHSS/${chlor_wert}","change":true,"cache":true,"x":1030,"y":160,"wires":[[]]},{"id":"c30afcbc.20a0e","type":"inject","z":"e4f0ea06.4e5b38","name":"Redox Wert","props":[{"p":"fc","v":"3","vt":"num"},{"p":"address","v":"130","vt":"num"},{"p":"quantity","v":"2","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"30","crontab":"","once":true,"onceDelay":"0.5","topic":"redox_wert","x":190,"y":280,"wires":[[]]},{"id":"d221c075.ee4e4","type":"inject","z":"e4f0ea06.4e5b38","name":"Temperatur","props":[{"p":"fc","v":"3","vt":"num"},{"p":"address","v":"175","vt":"num"},{"p":"quantity","v":"2","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"30","crontab":"","once":true,"onceDelay":"0.5","topic":"temp","x":190,"y":340,"wires":[[]]},{"id":"3e0e3a5f.0c0e26","type":"inject","z":"e4f0ea06.4e5b38","name":"Chlor Sollwert","props":[{"p":"fc","v":"3","vt":"num"},{"p":"address","v":"111","vt":"num"},{"p":"quantity","v":"2","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"30","crontab":"","once":true,"onceDelay":"0.5","topic":"cl_soll","x":180,"y":400,"wires":[[]]},{"id":"30d531ba.c4a5de","type":"inject","z":"e4f0ea06.4e5b38","name":"PH Sollwert","props":[{"p":"fc","v":"3","vt":"num"},{"p":"address","v":"126","vt":"num"},{"p":"quantity","v":"2","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"30","crontab":"","once":true,"onceDelay":"0.5","topic":"ph_soll","x":190,"y":460,"wires":[[]]},{"id":"4a6ff88a.1f7818","type":"inject","z":"e4f0ea06.4e5b38","name":"Chlor Dosierleistung","props":[{"p":"fc","v":"3","vt":"num"},{"p":"address","v":"113","vt":"num"},{"p":"quantity","v":"2","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"30","crontab":"","once":true,"onceDelay":"0.5","topic":"cl_dos","payloadType":"str","x":160,"y":520,"wires":[[]]},{"id":"8ecb7048.d8b5f","type":"inject","z":"e4f0ea06.4e5b38","name":"PH Dosierleistung","props":[{"p":"fc","v":"3","vt":"num"},{"p":"address","v":"128","vt":"num"},{"p":"quantity","v":"2","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"30","crontab":"","once":true,"onceDelay":"0.5","topic":"ph_dos","x":170,"y":580,"wires":[[]]},{"id":"d9f3de12.3a2ee","type":"debug","z":"e4f0ea06.4e5b38","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":720,"y":260,"wires":[]},{"id":"c045f3ba.6deb1","type":"debug","z":"e4f0ea06.4e5b38","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1020,"y":100,"wires":[]},{"id":"ee1fc629.99b7c8","type":"ping","z":"e4f0ea06.4e5b38","protocol":"IPv4","mode":"triggered","name":"","host":"192.168.178.113","timer":"20","inputs":1,"x":420,"y":160,"wires":[["a3e39dd9.d7162"]]},{"id":"3b446b30.590ab4","type":"modbus-client","name":"Depolox Pool E 700P","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":true,"tcpHost":"192.168.178.113","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":"f91a7c3b4fc2798e","type":"ccu-connection","name":"HmIP CCU3","host":"192.168.178.108","regaEnabled":true,"bcrfEnabled":false,"iprfEnabled":false,"virtEnabled":false,"bcwiEnabled":false,"cuxdEnabled":false,"regaPoll":false,"regaInterval":"30","rpcPingTimeout":"60","rpcInitAddress":"","rpcServerHost":"192.168.178.108","rpcBinPort":"2055","rpcXmlPort":"2056","tls":false,"inSecure":false,"authentication":false,"username":"","password":"","queueTimeout":"5000","queuePause":"250","contextStore":""}]

debug shows now:
26.11.2022, 17:54:41node: Depolox Pool E 700Pmsg : error

"TypeError: Cannot create property 'fc' on number '7.366'"

IP of the Pool meter is 192.168.178.113

We are getting closer.

Please answer Q2

Here is a flow for you to try...

image

[{"id":"07c79b1713819a7e","type":"ping","z":"e4f0ea06.4e5b38","protocol":"IPv4","mode":"triggered","name":"","host":"192.168.178.113","timer":"20","inputs":1,"x":590,"y":680,"wires":[["7d5345156c43eaba"]]},{"id":"9adf770eb518bb8d","type":"inject","z":"e4f0ea06.4e5b38","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":410,"y":680,"wires":[["07c79b1713819a7e"]]},{"id":"7d5345156c43eaba","type":"debug","z":"e4f0ea06.4e5b38","name":"Ping Result","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"msg","x":790,"y":680,"wires":[]}]

nothing, no ping, no debug
no respond from the pool meter

that that is what you need to solve first.

There is a chance it doesnt respond to PING so perhaps you should try the same test from your PI.

Did you say your PI was able to get values from the Pool Meter?


Some questions that would help me help you...

  • What is the IP, Mask and Gateway of the CCU?
  • What is the IP, Mask and Gateway of the PI?
  • What is the IP, Mask and Gateway of the Pool Meter?

ah now i have a ping from the pool meter :slight_smile:

26.11.2022, 18:12:52node: Ping Result192.168.178.113 : msg : Object

object

_msgid: "ea14bb40.f3ad08"

payload: 12.095

topic: "192.168.178.113"

ok, good.

Before I continue, please answer...

yes, and transfer the values to the ccu

ok, can you try this flow & show me what you get in the 2 debug outputs
image

[{"id":"b9bd7ab065719cfb","type":"modbus-getter","z":"e4f0ea06.4e5b38","name":"Get registers 100~176","showStatusActivities":false,"showErrors":false,"logIOActivities":false,"unitid":"","dataType":"HoldingRegister","adr":"100","quantity":"77","server":"3b446b30.590ab4","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":false,"x":710,"y":820,"wires":[["43e39cf1d34899ae"],["b87165cf5e6c1e4e"]]},{"id":"73de244cf086e495","type":"inject","z":"e4f0ea06.4e5b38","name":"Click Me","props":[],"repeat":"","crontab":"","once":false,"onceDelay":"0.5","topic":"","x":500,"y":820,"wires":[["b9bd7ab065719cfb"]]},{"id":"43e39cf1d34899ae","type":"debug","z":"e4f0ea06.4e5b38","name":"Top output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":950,"y":800,"wires":[]},{"id":"b87165cf5e6c1e4e","type":"debug","z":"e4f0ea06.4e5b38","name":"Bottom Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":960,"y":860,"wires":[]},{"id":"3b446b30.590ab4","type":"modbus-client","name":"Depolox Pool E 700P","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":true,"failureLogEnabled":false,"tcpHost":"192.168.178.113","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"","unit_id":"1","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true}]

Also, "Copy Value" and paste into a codeblock...
image

no debug output.

I have to be gone for 2 hours, I'll get back to you then