Mindsphere

MindSphere is a cloud-based Internet of Things (IoT) platform developed by Siemens. It is designed to connect devices, systems, and machines to a central cloud platform, allowing users to collect, store, and analyze data generated by their connected devices. MindSphere provides tools and services for developing, deploying, and managing IoT applications, as well as for visualizing and analyzing data. It also offers a range of pre-built applications for various industries, including manufacturing, energy, and transportation. The goal of MindSphere is to help organizations increase efficiency, reduce costs, and improve decision-making through the use of IoT data.

MindSphere supports MQTT as a protocol for sending data to the platform. This means that devices that are connected to MindSphere can use MQTT to publish data to the platform, and applications running on the platform can use MQTT to subscribe to data from these devices.

To use MQTT with MindSphere, you will need to configure your devices to connect to the MindSphere MQTT broker, and use the appropriate MQTT topics to publish and subscribe to data. You can then use MindSphere’s APIs and tools to access and analyze the data that is being transmitted over MQTT.

Using MQTT with MindSphere allows you to easily and efficiently transmit large amounts of data from your connected devices to the platform, where it can be stored, processed, and visualized. It is a key component of the MindSphere IoT ecosystem.

MQTT API

First an agent needs to be created on the mindsphere platform. This process provides you with a certificate with which an mqtt connection can be made with the broker of mindsphere. The credentials of an agent is only able to establish and maintain one active connection to the IoT platform at a time.

To create the data model on mindsphere the following instructions were followed:

https://documentation.mindsphere.io/MindSphere/howto/howto-send-data-from-mqtt-agent.html

Here is a list of steps taken to send the data to mindsphere:

  1. Instantiate model on topic: tc/camexia/camexia_dash7_gateway_1/o/amo_v3/m

    {
      "id": "12314",
      "data":{
        "externalId":"Energy_4",
        "typeModel":{
          "aspectTypes":[
            {
              "id":"camexia.energy_4_AspectType",
              "name":"energy_4_AspectType",
              "category":"dynamic",
              "scope":"private",
              "variables":[
                {
                  "name":"realEnergy",
                  "dataType":"LONG",
                  "unit":"Wh",
                  "searchable":true,
                  "qualityCode":true
                },
                {
                  "name":"apparentEnergy",
                  "dataType":"LONG",
                  "unit":"VAh",
                  "searchable":true,
                  "qualityCode":true
                },
                {
                  "name":"validEnergy",
                  "dataType":"BOOLEAN",
                  "searchable":true,
                  "qualityCode":true
                },
                {
                  "name":"linkBudget",
                  "dataType":"INT",
                  "searchable":true,
                  "qualityCode":true
                }
              ],
              "description":"measured energy_4"
            }
          ],
          "assetTypes":[
            {
              "id":"camexia.energy_4_AssetType",
              "name":"energy_4_AssetType",
              "parentTypeId":"core.basicasset",
              "aspects":[
                {
                  "name":"energy_4_Aspect",
                  "aspectTypeId":"camexia.energy_4_AspectType"
                }
              ],
              "description":"Asset Type with energy measured",
              "instantiable":true,
              "scope":"private"
            }
          ]
        },
        "instanceModel":{
          "assets":[
            {
              "referenceId":"energy_4_AssetReference",
              "parentReferenceId":"root",
              "typeId":"camexia.energy_4_AssetType",
              "name":"energy_4_Asset",
              "description":"Asset with energy measured"
            }
          ]
        },
        "mappingModel":{
          "mappings":[
            {
              "dataPointId":"realEnergy",
              "assetReferenceId":"energy_4_AssetReference",
              "aspectName":"energy_4_Aspect",
              "variableName":"realEnergy"
            },
            {
              "dataPointId":"apparentEnergy",
              "assetReferenceId":"energy_4_AssetReference",
              "aspectName":"energy_4_Aspect",
              "variableName":"apparentEnergy",
            },
            {
              "dataPointId":"validEnergy",
              "assetReferenceId":"energy_4_AssetReference",
              "aspectName":"energy_4_Aspect",
              "variableName":"validEnergy"
            },
            {
              "dataPointId":"dataPoint4",
              "assetReferenceId":"energy_4_AssetReference",
              "aspectName":"energy_4_Aspect",
              "variableName":"linkBudget"
            }
          ]
        }
      }
    }
  
2. Subscribe to topic: tc/camexia/camexia_dash7_gateway_1/i/amo_v3/#
3. Publish to topic: tc/camexia/camexia_dash7_gateway_1/o/amo_v3/i
    {
        "id": "Energy_4_DeviceInstantiationRequest",
        "data": {
            "modelExternalId": "Energy_4",
            "parameterization": {
                "values": []
            }
        }
    }

    
4. (Optional) To test the connection, publish data to timeseries: tc/camexia/camexia_dash7_gateway_1/o/mc_v3/ts.
   {
     "timeseries": [
       {
         "timestamp": "2022-12-01T20:05:10Z",
         "values": [
           {
             "dataPointId": "realEnergy",
             "value": 605,
             "qualityCode": "0"
           },
           {
             "dataPointId": "apparentEnergy",
             "value": 15,
             "qualityCode": "0"
           },
           {
             "dataPointId": "validEnergy",
             "value": "true",
             "qualityCode": "0"
           },
           {
             "dataPointId": "dataPoint4",
             "value": 87,
             "qualityCode": "0"
           }
         ]
       }
     ]
   }
  
note: This format also gets used in the raspberry pi gateway software.

Energy measurement visualisation