# Similar using of DataToServer and MQTT Modbus Gateway

**URL:** <https://community.teltonika.lt/t/similar-using-of-datatoserver-and-mqtt-modbus-gateway/14687>\
**Category:** Networking Solutions\
**Created:** [July 16, 2025, 7:01pm UTC](https://community.teltonika.lt/t/similar-using-of-datatoserver-and-mqtt-modbus-gateway/14687 "2025-07-16T19:01:01Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Markus](https://community.teltonika.lt/letter_avatar_proxy/v4/letter/m/b782af/32.png) [@Markus](https://community.teltonika.lt/u/Markus)\
**Post date:** [July 16, 2025, 7:01pm UTC](https://community.teltonika.lt/t/similar-using-of-datatoserver-and-mqtt-modbus-gateway/14687/1 "2025-07-16T19:01:01Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Matas](https://community.teltonika.lt/user_avatar/community.teltonika.lt/matas/32/17132_2.png) [@Matas](https://community.teltonika.lt/u/Matas)\
**Post date:** [July 17, 2025, 6:03am UTC](https://community.teltonika.lt/t/similar-using-of-datatoserver-and-mqtt-modbus-gateway/14687/3 "2025-07-17T06:03:37Z")

</div>

Hello,

> [@Markus](#):
>
> So now I would like to have the possibilty to works with switches at my dashboard.

What switches are you referring to?

> [@Markus](#):
>
> This is generally working but not always!

Is there any specific time it stops working?

> [@Markus](#):
>
> It looks like as there are two different modbus clients on the RUT241 and they can not working parallel!

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.

---

<div class="post-metadata">

**Author:** ![Markus](https://community.teltonika.lt/letter_avatar_proxy/v4/letter/m/b782af/32.png) [@Markus](https://community.teltonika.lt/u/Markus)\
**Post date:** [July 17, 2025, 8:23am UTC](https://community.teltonika.lt/t/similar-using-of-datatoserver-and-mqtt-modbus-gateway/14687/4 "2025-07-17T08:23:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Matas](https://community.teltonika.lt/user_avatar/community.teltonika.lt/matas/32/17132_2.png) [@Matas](https://community.teltonika.lt/u/Matas)\
**Post date:** [July 17, 2025, 8:59am UTC](https://community.teltonika.lt/t/similar-using-of-datatoserver-and-mqtt-modbus-gateway/14687/5 "2025-07-17T08:59:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Matas](https://community.teltonika.lt/user_avatar/community.teltonika.lt/matas/32/17132_2.png) [@Matas](https://community.teltonika.lt/u/Matas)\
**Post date:** [July 17, 2025, 9:02am UTC](https://community.teltonika.lt/t/similar-using-of-datatoserver-and-mqtt-modbus-gateway/14687/6 "2025-07-17T09:02:25Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![Matas](https://community.teltonika.lt/user_avatar/community.teltonika.lt/matas/32/17132_2.png) [@Matas](https://community.teltonika.lt/u/Matas)\
**Post date:** [July 17, 2025, 9:04am UTC](https://community.teltonika.lt/t/similar-using-of-datatoserver-and-mqtt-modbus-gateway/14687/7 "2025-07-17T09:04:02Z")

</div>

Finally, I’d like to also mention that there’s this topic: [Configuring RUT241 via subscribed mqtt topic](https://community.teltonika.lt/t/configuring-rut241-via-subscribed-mqtt-topic/12528)

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.

---

<div class="post-metadata">

**Author:** ![Markus](https://community.teltonika.lt/letter_avatar_proxy/v4/letter/m/b782af/32.png) [@Markus](https://community.teltonika.lt/u/Markus)\
**Post date:** [July 17, 2025, 12:16pm UTC](https://community.teltonika.lt/t/similar-using-of-datatoserver-and-mqtt-modbus-gateway/14687/8 "2025-07-17T12:16:11Z")

</div>

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

 ![DataToServer_Setting1](https://community.teltonika.lt/uploads/default/original/3X/6/f/6f38db6fefafa8597c997edfe6c04897de6df877.png)  
 ![DataToServer_Setting2](https://community.teltonika.lt/uploads/default/original/3X/b/6/b6587efb26ff88f3829ea5c0e14eb3752b3e7f44.png)  
 ![Modbus_Client_1](https://community.teltonika.lt/uploads/default/original/3X/2/d/2dd4d8d02cb9b13b0553d4c778786c20a963c224.png)  
 ![Modbus_Client_2](https://community.teltonika.lt/uploads/default/original/3X/6/0/60a49eaf02bfb1aea71d7b3d1195b2a6129ea372.png)  
 ![MQTT-Modbus-Gateway](https://community.teltonika.lt/uploads/default/original/3X/f/4/f4718d39ad498d33468e33e30ea847e151fd8aa4.png)

---

<div class="post-metadata">

**Author:** ![Markus](https://community.teltonika.lt/letter_avatar_proxy/v4/letter/m/b782af/32.png) [@Markus](https://community.teltonika.lt/u/Markus)\
**Post date:** [July 17, 2025, 12:19pm UTC](https://community.teltonika.lt/t/similar-using-of-datatoserver-and-mqtt-modbus-gateway/14687/9 "2025-07-17T12:19:59Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Markus](https://community.teltonika.lt/letter_avatar_proxy/v4/letter/m/b782af/32.png) [@Markus](https://community.teltonika.lt/u/Markus)\
**Post date:** [July 17, 2025, 1:08pm UTC](https://community.teltonika.lt/t/similar-using-of-datatoserver-and-mqtt-modbus-gateway/14687/10 "2025-07-17T13:08:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Matas](https://community.teltonika.lt/user_avatar/community.teltonika.lt/matas/32/17132_2.png) [@Matas](https://community.teltonika.lt/u/Matas)\
**Post date:** [July 18, 2025, 6:44am UTC](https://community.teltonika.lt/t/similar-using-of-datatoserver-and-mqtt-modbus-gateway/14687/11 "2025-07-18T06:44:12Z")

</div>

Hello!

> [@Markus](#):
>
> Is it maybe a solution to use modbus server and make the plc to modbus client?

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

> [@Markus](#):
>
> But in this case how can I get access to the custom register block?

In regards to custom register blocks, we have this Wiki example: [Modbus custom register block RutOS - Teltonika Networks Wiki](https://wiki.teltonika-networks.com/view/Modbus_custom_register_block_RutOS)

Do let me know if this works for you!

Regards,  
M.

---

<div class="post-metadata">

**Author:** ![Markus](https://community.teltonika.lt/letter_avatar_proxy/v4/letter/m/b782af/32.png) [@Markus](https://community.teltonika.lt/u/Markus)\
**Post date:** [July 23, 2025, 7:27am UTC](https://community.teltonika.lt/t/similar-using-of-datatoserver-and-mqtt-modbus-gateway/14687/12 "2025-07-23T07:27:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Matas](https://community.teltonika.lt/user_avatar/community.teltonika.lt/matas/32/17132_2.png) [@Matas](https://community.teltonika.lt/u/Matas)\
**Post date:** [July 23, 2025, 9:17am UTC](https://community.teltonika.lt/t/similar-using-of-datatoserver-and-mqtt-modbus-gateway/14687/13 "2025-07-23T09:17:23Z")

</div>

Hello,

Full guide for setting up MQTT can be found here: [Monitoring via MQTT - Teltonika Networks Wiki](https://wiki.teltonika-networks.com/view/Monitoring_via_MQTT)

Regards,  
M.

---

<div class="post-metadata">

**Author:** ![Markus](https://community.teltonika.lt/letter_avatar_proxy/v4/letter/m/b782af/32.png) [@Markus](https://community.teltonika.lt/u/Markus)\
**Post date:** [July 23, 2025, 9:46am UTC](https://community.teltonika.lt/t/similar-using-of-datatoserver-and-mqtt-modbus-gateway/14687/14 "2025-07-23T09:46:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Matas](https://community.teltonika.lt/user_avatar/community.teltonika.lt/matas/32/17132_2.png) [@Matas](https://community.teltonika.lt/u/Matas)\
**Post date:** [July 23, 2025, 9:58am UTC](https://community.teltonika.lt/t/similar-using-of-datatoserver-and-mqtt-modbus-gateway/14687/15 "2025-07-23T09:58:15Z")

</div>

Hi there,

Subscribing and publishing is explained in this particular section of the Wiki I’ve provided: [Monitoring via MQTT - Teltonika Networks Wiki](https://wiki.teltonika-networks.com/view/Monitoring_via_MQTT#Subscribing_and_Publishing)

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.

---

<div class="post-metadata">

**Author:** ![Markus](https://community.teltonika.lt/letter_avatar_proxy/v4/letter/m/b782af/32.png) [@Markus](https://community.teltonika.lt/u/Markus)\
**Post date:** [July 23, 2025, 2:09pm UTC](https://community.teltonika.lt/t/similar-using-of-datatoserver-and-mqtt-modbus-gateway/14687/16 "2025-07-23T14:09:02Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Matas](https://community.teltonika.lt/user_avatar/community.teltonika.lt/matas/32/17132_2.png) [@Matas](https://community.teltonika.lt/u/Matas)\
**Post date:** [July 24, 2025, 10:25am UTC](https://community.teltonika.lt/t/similar-using-of-datatoserver-and-mqtt-modbus-gateway/14687/17 "2025-07-24T10:25:20Z")

</div>

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](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](https://wiki.teltonika-networks.com/view/RUT241_Package_Downloads)

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](https://wiki.teltonika-networks.com/view/Monitoring_via_MQTT#Publisher)

Have a nice day,  
M.

---

<div class="post-metadata">

**Author:** ![Markus](https://community.teltonika.lt/letter_avatar_proxy/v4/letter/m/b782af/32.png) [@Markus](https://community.teltonika.lt/u/Markus)\
**Post date:** [July 24, 2025, 7:12pm UTC](https://community.teltonika.lt/t/similar-using-of-datatoserver-and-mqtt-modbus-gateway/14687/18 "2025-07-24T19:12:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Matas](https://community.teltonika.lt/user_avatar/community.teltonika.lt/matas/32/17132_2.png) [@Matas](https://community.teltonika.lt/u/Matas)\
**Post date:** [July 25, 2025, 8:53am UTC](https://community.teltonika.lt/t/similar-using-of-datatoserver-and-mqtt-modbus-gateway/14687/19 "2025-07-25T08:53:10Z")

</div>

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](https://wiki.teltonika-networks.com/view/RUT241_Input/Output#Type:_MQTT)

Regards,  
M.

---

<div class="post-metadata">

**Author:** ![system](https://community.teltonika.lt/user_avatar/community.teltonika.lt/system/32/15707_2.png) [@system](https://community.teltonika.lt/u/system)\
**Post date:** [September 14, 2025, 7:01pm UTC](https://community.teltonika.lt/t/similar-using-of-datatoserver-and-mqtt-modbus-gateway/14687/20 "2025-09-14T19:01:03Z")

</div>

Closed on September 14, 2025, 7:01pm UTC

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