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.
0 votes
1,298 views 2 comments
by anonymous

Hi!

I'm trying to get TRB141 working with 1-wire sensor over MQTT, but I'm facing obstacles. I have client and broker set up in AWS and would like to publish 1-wire data over MQTT there from TRB141. It's listening to topic: router/id/#

Is there ways e.g to test MQTT connection via TRB141, since mosquitto_pub command is disabled. Tcpdump shows pretty much nothing except ssh, lan and https traffic.

I also have issues with the 1-wire sensor. It seems that the device acknowledges the sensor when viewing from syslog:

Wed Jan 15 11:08:09 2020 kern.info kernel: [    0.883865] Driver for 1-wire Dallas network protocol.

Is there a way where I could view the 1-wire data from the TRB141? I tried to look up ubus call command, but can't seem to figure it out. 

Thanks and Apologies. I'm fairly new with sensor stuff.

by anonymous
To test the MQTT connection via TRB141, you can try using an MQTT client such as MQTT.fx or MQTT Explorer. These clients will allow you to connect to the AWS broker and subscribe to the router/id/# topic to see if any messages are being published by the TRB141.

Regarding the 1-wire sensor, you can use the OWFS (One-Wire File System) package to access the sensor data. First, you need to install the package using the command `opkg update && opkg install owfs`. Once installed, you can access the sensor data by mounting the file system using the command `owfs -u /mnt/1wire/`. This will create a virtual file system in the /mnt/1wire directory, which you can browse using the `ls` command. The sensor data should be accessible in one of the directories under /mnt/1wire.

To view the 1-wire data from the TRB141 using ubus call command, you can try the following:

1. List the available ubus objects by running the command `ubus list`.
2. Look for the object related to the 1-wire interface. It may be called something like "owserver".
3. Call the "list" method of the object to get a list of available sensors. For example, if the object is named "owserver", you can run the command `ubus call owserver list`.
4. Once you have the list of sensors, you can call the "read" method to get the sensor data. For example, if the sensor you want to read is at address "28.5A1F01000000", you can run the command `ubus call owserver read '{"addr":"28.5A1F01000000"}'`.

2 Answers

+1 vote
by anonymous

Hello,

As Justin Burnett mentioned, if you want to test TRB141 MQTT try to use default TRB topics. However, to do this you have to use embedded MQTT broker. Other way to test MQTT is to configure ModBus TCP Master (https://wiki.teltonika.lt/view/TRB141_Modbus#Modbus_TCP_Master), which will read data from slave simulator on your PC (Modbus PLC Simulator on Windows or diagslave on Linux) and with Modbus data to Server (https://wiki.teltonika.lt/view/TRB141_Modbus#Modbus_Data_to_Server) configure data transferring with MQTT to your AWS Broker. With this you will be able to test data transfer via MQTT

About MQTT publisher, yeah currently it is not implemented in TRB141 and if you want to enable it, you will have compile your ownTRB141 firmware with this feature enabled using our SDK (https://wiki.teltonika.lt/view/Software_Development_Kit).

To read data from 1-Wired sensor try to follow this instructions, I have tested with Dallas DS1820 temperature sensor and was able to collect data:

Connect 1-wire device and open SSH for TRB141 and enter following commands:

  • echo 1018 > /sys/class/gpio/export
  • echo out > /sys/class/gpio/gpio1018/direction
  • echo 1 > /sys/class/gpio/gpio1018/value

Then

  • cd /sys/bus/w1/devices/

With ls command you will find several folders, one will be w1_bus_master1 and other should look similar to this 10-0008038275

  • cd in that folder

After that use:

  • ls
  • there should see w1-slave device
  • to get data simple - cat w1-slave
Best answer
by anonymous
Hi Tomas,

How can you send one-wire data using the "data-to-server" feature of the TRB141?  Currently it appears that you can only send modbus registers, but how do you send other input data to an MQTT beoker (publish) using the data-to-server feature?
+2 votes
by anonymous

You need to subscribe to the specific Topic required...

What 1 wire sensor are you using and how have you interfaced it to the TRB141?

The topic/s you want to subscribe to are below;

router/#/digital1

router/#/digital2

router/#/analog

MQTT data can be found here https://wiki.teltonika.lt/view/Monitoring_via_MQTT   (awesome resource)