Line 198: |
Line 198: |
| | | |
| </ul> | | </ul> |
| + | |
| + | ==Direct methods configuration== |
| + | Direct method is a term that describes process where some action is called from the Azure IoT Hub to a specific device identity. The receiving device executes certain actions and returns an answer back to the Azure portal. Let's see how it works on our devices. |
| + | |
| + | By default, all configurations instances will have this option disabled. To enabled it, you should navigate on router WebUI to Services -> Cloud Solutions -> Azure IoT Hub and press edit button on specific instance. There, you will be able to see "Enable Direct Methods" button, which you need to press. |
| + | [[File:Azure RutOSconf 19.png|border|class=tlt-border]] |
| + | |
| + | For testing and demonstration purposes we will use Azure IoT explorer application. The Azure IoT explorer is a graphical tool for interacting with devices connected to your IoT hub. If you are not familiar with it, you can follow this Microsoft installation and usage guide https://learn.microsoft.com/en-us/azure/iot/howto-use-iot-explorer |
| + | |
| + | After enabling the Direct Method feature manually, go to Azure IoT Explorer, select proper device indentity and head to direct methods tab. All our RUT devices supports api_call direct method, which exposes the API interface to be used from the Azure side. In this example, we will call simple get request to retrieve I/O status of the device. Full documentation of Teltonika devices API can be found here https://developers.teltonika-networks.com/ |
| + | |
| + | In the Azure IoT explorer direct method tab you can see Payload field. It expects to have JSON formatted information. |
| + | |
| + | [[File:Azure RutOSconf 20.png|border|class=tlt-border]] |
| + | API call expects at least two parameters. The first one is called "method". This needs to have an integer value between zero and three, which corresponds to API method type - either "get", "out", "post", "delete". The second one is endpoint which expects a string value of the API endpoint. In this case we will call the /io/status endpoint. |
| + | [[File:Azure RutOSconf 22.1.png|border|class=tlt-border]] |
| + | |
| + | After pressing "Invoke Method" button, we can a response from the device. |
| + | [[File:Azure RutOSconf 21.png|border|class=tlt-border]] |
| | | |
| ==Checking if Data reaches Azure IoT Hub== | | ==Checking if Data reaches Azure IoT Hub== |