In the case of documentation, MQTT client was used on a PC to simulate MQTT communication between PC, Router, and Azure IoT Hub. The way MQTT works is there must be 3 entities for MQTT to operate:
- MQTT Publisher (MQTT Client on the PC in configuration example)
- MQTT Broker (RUT950 in the example)
- MQTT Subscriber (Azure IoT Hub in the example)
MQTT publisher sends data to a particular topic on MQTT broker. Azure IoT Hub service listens for the topic on the broker and then forwards this data to Azure. This way data get from MQTT publisher to MQTT subsriber. In the configuration example, the MQTT client on the PC was publishing data to topic 'test' on RUT950 (which was configured as MQTT Broker). Azure IoT package listens to the topic 'test' on the broker and forwards that data to Azure IoT Hub.
There is an issue here. It will not be possible to use MQTT to periodically send device information (information about RUT950 itself) to Azure IoT hub using that OPKG package.
Consider using GSM values in Azure IoT Hub configuration on RUT950 as described HERE and HERE. GSM values do not carry much information, but might be sufficient for your purposes. This way your devices can send information periodically to Azure IoT Hub. You can obtain cellular data, SIM card data input/output etc. You can use GSM information to determine whether the device is reachable (online).
If this data is not enough for your purposes, then could you please tell me which information about RUT950 are you trying to read/ send?
You can also use Data To Server functionality. How this works is that you configure RUT950 as a Modbus TCP Master and Slave at the same time. Modbus Master should be configured to query itself (using localhost address of 127.0.0.1). This way Modbus Master will receive the data about RUT950. Data to server functionality will then forward this data to Azure IoT Hub. For this:
Configure Modbus TCP Slave and Master on RUT950 as per THIS configuration. Set Modbus TCP Master to read registers of your choice. Modbus TCP Master should read data from RUT950 itself, so the IP address should be 127.0.0.1.
Configure Data to Server (Information available HERE).
- Enter a name of your choice.
- Choose MODBUS Data as a data source.
- Azure MQTT as a protocol.
- Slave ID should be the same as in Modbus TCP master/slave settings.
- In JSON format enter the data you want to send. (Look at the placeholder example)
- The connection String should be the 'Primary connection string' of your device in Azure.
- You can leave everything else as default or refer to the wiki page given before.
Note: When using Data to Server, Azure IoT Hub configuration on the router must be disabled (Under Services -> Cloud solutions -> Azure IoT Hub)
As an additional note, keep in mind that you can always use the Teltonika RMS platform. This is a great solution because it is a complete solution out of the box. With RMS you will be able to monitor all of your devices easily and without any issues. All you have to do is to register your devices in the RMS platform and obtain some credits. RMS has many more benefits and is worth taking a look at. More information about RMS can be found HERE.