Ubidots Community

Connecting Teltonika routers to Ubidots (OpenVPN, mosquitto)?

I have a remotely deployed Teltonika RUT955 modem router, with a sim card for internet connection and run from a 12V battery. It has a modbus pressure gauge and analogue temperature probe connected. The device data are being read by the router ok, and I can get the ‘modbus data to server’ function to read the registers that I want to send to Ubidots.
But I’m struggling to send the data to Ubidots, although it looks like it should be able to. Does anyone know how to get it working?

I’ve tried many times to correctly fill in the options on the ‘Data to server’ page on the router, but cannot get a device to appear in Ubidots. The settings I’ve tried are described here: https://wiki.teltonika-networks.com/view/RUT955_Data_to_Server

Any pointers would be very appreciated!

Hi @DanR,

Overall, your setup seems close to correct, however, I’m hesitating on 3 particular fields, the JSON format, Host and Topic:

  1. JSON format: As you might already know, Ubidots MQTT broker receives a standardized JSON format as explained here. The format you’re sending, namely, {"value": %a} doesn’t seem compatible because, according to the image, the %a is a JSON itself, which I’m pretty sure that at runtime, it deviates from what Ubidots expects.
  2. Host: You typed in mqtt://industrial.api.ubidots.com but I’m thinking, based on the Docs, that it should be without the leading mqtt:// prefix
  3. Topic: You have an extra trailing / in the topic. It should be /v1.6/devices/rut955

With the above in mind, I propose the following 2 paths (they’re not exclusive to one another, rather steps):

  1. Adjusting the fields for Host and Topic based on the above, that is, lose the mqtt:// prefix and the trailing /. Once you make the change and if my suspicious is right, you should see a device and variable labelled as “rut955” and “value”, respectively, in your account. The variable won’t have data as the %a probably makes the whole JSON incompatible, but at least we can confirm the modem router connected properly and a payload was sent and partially parsed.

  2. We need to understand what the JSON payload –rendered out of {"value": %a}, looks like, and the way to do so involves using a different data ingestion path: MQTT+UbiFunctions. It is still MQTT, but instead of going directly to Ubidots, it first lands at an UbiFunction which will allow you to inspect the payload, understand it and give us clue how to parse it. Please follow the Docs in the link to setup your modem router to send data to an UbiFunction.
    The Python snippet below prints everything getting to the UbiFunction to the console and will let us see the payload.

def main(args): 
    return args

We will be here in case you stumble upon a wall along the way of making theses changes.