Similar using of DataToServer and MQTT Modbus Gateway

Hi everybody,
I try to make a little Dashboard to my units! Here I use modbus client and DataToServer to send my data to my mosquitto broker! This works proper!
So now I would like to have the possibilty to works with switches at my dashboard. Here I use the MQTT Modbus Gateway. This is generally working but not always!
It looks like as there are two different modbus clients on the RUT241 and they can not working parallel! So if the DataToServer send Data I can not use the MQTT Modbus Gateway to send data. (There do not comes a response from the RUT241)
How can I solve this issue?

Hello,

What switches are you referring to?

Is there any specific time it stops working?

Hard to understand, but do you have 2 modbus clients on your RUT241?

Generally speaking, what kind of data are you trying to send? What data is being read?

Regards,
M.

Hi, I know it is hard to understand and also to explain! But I try it again!
The RUT241 is connected with modbus tcp to a plc! To get the data the rut is collecting I use the feature Data_to_Server and send them to my mqtt broker! The broker is working on my server and here I use nodered to get the data in nodered dashboard.
At this dashboard I use a switch object to write data back to my plc. Here I use the mqtt modbus gatway. When the switch is acitvated nodered send a message using the broker to the rut 241 and then to the plc! Example: switch is on I sent a mqtt message to plc and here a coil goes high!
So I regonized I can´t use the data_to_server or the mqtt modbus gateway at the same time. So when the data_to_server sending data I couldn´t use the switches at the dashboard! There didn´t comes the message coil goes high or low, however!
So I thinking this are different clients to do this! Maybe it is a time issues but I need to push the switch often to change the behavior and I could use the mqtt modbus gateway after a data sending!
I hope this is more clear for you!
Regards/
markus

Hello,

It is, in fact, clear what you’re trying to achieve. Could you possibly provide the MQTT Gateway & the Data-to-server configuration images? Please do blur out any usernames/passwords/IP addresses and such.

From what I’ve gathered, you’re first collecting data from the PLC, which is then being forwarded to your MQTT broker. Afterwards, on your server, you have a ‘switch’ that, when activated, sends some data back to the RUT241, which then forwards the data to your PLC.

The problem here is that both of these services run on the same daemon, which, in essence, means that they cannot be used together. These technically fall under the same service. Best practice would be to use just one of them, instead of trying to use both. In most cases, most clients opt for data-to-server.

Regards,
M.

Additionally, could you provide a diagram of your desired configuration? I specifically want to see the sequence of how data must be forwarded (through what).

Finally, I’d like to also mention that there’s this topic: Configuring RUT241 via subscribed mqtt topic

Which sounds a bit similar to the issue you’re having. Could you please view the discussion there to see if there’s any valuable information for your situation?

Regards,
M.

Hi, thanks for your help! In attach some pictures which show my settings.





I read the topic you are gave me the link but not sure thats the same what to do!
At one side I like to collect data for the dashboard to show them online and at the other side I like to change settings online like to start/stopp a motor!
Is it maybe a solution to use modbus server and make the plc to modbus client?

But in this case how can I get access to the custom register block?

Hello!

If that’s possible, then I believe this would be a very simple solution to the issue you’re having.

In regards to custom register blocks, we have this Wiki example: Modbus custom register block RutOS - Teltonika Networks Wiki

Do let me know if this works for you!

Regards,
M.

Hi, I get it working with modbus slave and mqtt modbus gateway. In this case I have pull the data periodically from the router! For this application it is ok so!

To get the possibility to send active data from the router to my mqtt broker I like to use the mqtt publisher at the router! So you have any description how to send a message like topic/alarm? How can I control the mqtt publisher at the rut241?

Regards

Hello,

Full guide for setting up MQTT can be found here: Monitoring via MQTT - Teltonika Networks Wiki

Regards,
M.

Hi, I´m sorry but at the Wiki isn´t descriped how I can publish a message from the router to my broker!
I like to send as example an alarm message when a DI come high!

Regards

Hi there,

Subscribing and publishing is explained in this particular section of the Wiki I’ve provided: Monitoring via MQTT - Teltonika Networks Wiki

Could you tell me in more detail what exactly is missing from the Wiki, or whether there’s something in particular that you don’t understand?

Regards,
M.

Hi there,
I understand the mqtt publisher as a tool which can be used to send a message from the rut241 to my broker! Is this correct?
If yes then i like to know how and where I can manipulate the message which is send to the broker and I can do this!
Or is this publisher only for answer in comming commands?

Hello,

The MQTT package (for publishing, or for the device to act as a broker) can be installed via Package Manager, which is found under System → Package Manager in the WebUI.

The package can also be downloaded & uploaded manually: https://firmware.teltonika-networks.com/7.16.2/RUT2M/Packages/mqtt.tar.gz

^ Do note that this download link is for the 7.16.2 firmware, if you have an older one, kindly look for the package download here: RUT241 Package Downloads - Teltonika Networks Wiki

Once the package is installed onto your device, under Services you should have the MQTT section, from which you can then set up the MQTT Publishing as stated in my previous responses & in the Wiki: Monitoring via MQTT - Teltonika Networks Wiki

Have a nice day,
M.

Hi, I´m realy sorry but I think you are missunderstand my questions!
I have already installed all the necessary packeges for using mqtt! So what I like to know is how can I send a message to my broker without a request from my broker befor?
Example: the digital input at the rut241 goes from low to high. At this moment I like to send a mqtt message to my broker! With other words I like to push a message.
This should working without any request from the broker or other clients!
Is this mqtt publisher an activ or passive client?

Regards/
Markus

No worries at all Markus, thank you for the continued explanations about your desired setup.

I think what you’re looking for is the Input/Output service, which will allow you to send data to your MQTT broker: RUT241 Input/Output - Teltonika Networks Wiki

Regards,
M.