FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
+1 vote
963 views 3 comments
by anonymous
Hi,

I simply want to publish the current analog input value over mqtt every [5] seconds, without any interaction/polling from my server. Is this possible?

Previous results on the forum indicate "no", however according to the changelog of the firmware there have been quite some changes over the past months...

Regards,

Dennis

1 Answer

0 votes
by anonymous
Yes, you can.

Enable Modbus Tcp Slave at port 502

Add TRB141 as Modbus Slave on Modbus TCP Master

Read 32 bits int / register 142 / length 2 / 1234 order

Data to Server : configure Mqtt JSON Format and remote broker / topic

Option : You can enable TRB Broker on MQTT Tab and Data Sender can publish on it.

That's all.
Best answer
by anonymous
Hi,

I'm struggling to follow this / seeing different things on the RUT955

Any chance you could elaborate on the steps (For an idiot... lol )

Thanks
by anonymous

Hello,

First read the value at the analog input.
So you must already activate the Modbus TCP Slave service.
https://wiki.teltonika-networks.com/view/RUT955_Modbus#Modbus_TCP

Chapter Modbus TCP Slave > Enable / Port 502 / Device ID 1
See the list of all parameters

>Section Get Parameter: Analog Input Value :
Register Number 142
Length 2
Datatype : 32 bits integer

Chapter Modbus TCP Master
> add a device / Name: MyRUT955 / Slave ID: 1 / IP: Your RUT IP address / Period 5s Timeout 1s
Request Configuration section
> add an instance
> Name: MyAnalog Value / Datatype: 32 bits Integers 1-2-3-4 (byte order)
> Function code 3 (Read)
> First Register : 142
> Number of registers : 2 (ie length)
> Enabled YES

>> Test to visualize your analog value

At this step, the RUT will read its own Modbus registers (here the value of the analog input) every 5s.

Chapter Modbus Data to Server
> Add an instance: Name Analog MQTT / Enable
> Configure how data should be sent
For example: {"ID":"%i", "TS":"%t", "ST":"%s", "VR":"%a"} will give {"ID": "1", "TS": "1603020476", "ST": "142", "VR": "5.000"} (= 5V)
 

Then configure the MQTT protocol, the broker to publish to, the topic (ie analogval) and the period to publish to (5s).
So every 5s, the RUT955 will publish on the topic analogval in MQTT on the chosen broker.

Option: You can publish to the Internal Broker.
To do this, you must already activate it. The Modbus Data Sender will then be able to publish to the broker hosted by your RUT955 (Broker IP: Your IP address, Port 1883).

https://wiki.teltonika-networks.com/view/RUT955_MQTT

This way, your application will be able to subscribe to the topic on which the Modbus Data Sender publishes

by anonymous
Hello,

I am trying to do exactly the same but it is not working.

I noticed that after I create an instance in the "Modbus Data to Server" section, I save it and when I navigate to another section and come back, the instance is no longer existing. Do you think this might be the issue preventing me to succeed?

Is there any other section in which I can review information in order to send Analog Input to MQTT using RUT955?