I’m trying to pass Modbus TCP register value to single topic on MQTT.
Meaning:
Modbus reads value from 3rd party controller (for instance Temperature from hardwired input) and passes it to MQTT topic like: “something/TRB140/Temperature 1”
It has to be delivered single value to single topic.
Or if it is not possible, maybe someone could giude me how, using JSON extract values from Data to Server MQTT array?
It’s limitted, but at least values are there.
First option is nice straight forward, but the second could be kind of workaround.
Certainly, you have the capability to transmit Modbus data from the device that is connected to the Teltonika device, utilizing the Data to Server functionality.
Here’s how to achieve this:
Connect and set up the Teltonika device as the Modbus TCP/RTU Master. The third-party controller, linked to the Teltonika device, will function as the Modbus TCP/RTU Slave.
To retrieve a specific register value, let’s say you’re interested in obtaining the value from register address 9. This is accomplished by configuring the request configuration settings within the Teltonika device. Refer to the visual representation provided below for clarification:
After configuring the request settings, the next step involves activating the Data to Server feature. This action prompts the Teltonika device to send the value retrieved from the designated Modbus register to a predetermined MQTT Broker.
For example, the Teltonika device is connected to an MQTT broker at IP address: 192.168.1.126. The objective is to establish a data transmission frequency of every 30 seconds, where the Teltonika device sends data to this particular MQTT broker. To achieve this, the appropriate configuration would resemble the following: