Send Data to SmartWorks

You need to create a connection between SmartWorks and the object to send the data. This connection can be created from an API. The platform offers access through a REST API to all the resources. It's protected by Oauth protocol allowing you to define fine grained access control according to your use case.

Data must be sent via HTTP or MQTT to SmartWorks. For this project we are using MQTT connection.

MQTT Is the standard for IoT messaging. It allows for messaging between device to cloud and cloud to device. More information on MQTT can be found here.

Client connections are always handled by a MQTT broker, which is responsible for receiving and filtering the messages, determining who is subscribed to each message and sending them. To configure the MQTT broker connection, the Host, Username and Password are the required parameters.

Follow the steps below to connect your device via MQTT.

  1. Open the SWX Computer Training-Guide file in your existing code editor. If you need a code editor, you can download one here. If you don't want to install a code editor and/or Python, you can access Jupyter online. Follow the steps here. See Connect Your First Device for more information.
  2. Complete the steps under Computer Metrics.
  3. Connect a Device via MQTT:
    1. In SWX Computer Training-Guide.ipynb, follow the steps for a MQTT broker connection.
    2. Get your username and password by turning ON the autogenerate feature for the platform to autogenerate the username and password.
      Note: You can also create your own username and password, if desired.


      Figure 1.
    3. Click Save.
    4. Execute the code as instructed in the SWX Computer Training-Guide.ipynb file.
    5. Check the data received in the Raw History panel as shown below.


      Figure 2. Details tab, Raw History
    6. You can also check the properties getting updated via the MQTT Inspector:
      Figure 3.