Hi everybody
i'm reading out about 60 Modbus registers an sending them with mqtt
Is there a smarter way to do that ?
as you can see, the only thing that changes is the modbus adress of the register to read
many thanks
Hi everybody
i'm reading out about 60 Modbus registers an sending them with mqtt
Is there a smarter way to do that ?
as you can see, the only thing that changes is the modbus adress of the register to read
Difficult to know unless you tell us which modbus node you are using, there are many. Presumably you installed node-red-contrib-something. We need to know which.
Have you looked at the Info tab for the node to see if you can pass the address in the message? If so then likely that is the way to go
Also, can you not use a single MQTT nodes? I would have thought you could just use one.
I don’t know about the Modbus part by I do something similar with KNX RF where I use one MQTT out node which I also dynamically set the topic on dependent on the KNX item the message belongs to.
Hi
yes, it's the
Type | modbus-read |
---|---|
Module | node-red-contrib-modbus |
The adress is fix in this module
Did you look at the other nodes that have been installed by node-red-contrib-modbus
msg.hint = {node: "Modus Flex Getter"}
ok thx for the hint.
So i've got to place a funktion node in front of the Flex Getter:
what's on the input side of the function node, that triggers the read ?
Anything you like. If you want to trigger it at a defined interval then use an inject node set to repeat at the appropriate interval. Then probably either a Change node or a Function node to set the addresses you want. I haven't used that node I am just going from what I see in the Info tab.
found the answer
If the inject nodes are all triggering at the same interval you can use just one and feed it into all the function nodes. Also you could probably combine the function nodes into one and make it send multiple messages (see the docs on how to send multiple messages for how to do that). You might find it simpler to keep the function nodes separate however.