0

I was just following this document, and I see that there is no device template for Raspberry Pi 4 but for devices like MXChip it has, is it intended? Or is there any way to get the device template for Raspberry Pi 4?

enter image description here

Sibeesh Venu
  • 18,755
  • 12
  • 103
  • 140

1 Answers1

1

This is intended. A device template describes the capabilities of a device. For instance, the MXChip will send temperature, humidity, and motion events (among other things) and this is described in the device template. The ReButton you also posted in your screenshot will have capabilities like button press (with support for single/double/triple/long click).

This brings us to the reason there is no template for the Raspberry Pi, this device on its own has no out of the box capabilities to connect it to IoT Central. I might decide to add a temperature sensor to it, so I will build a template describing that capability. But you might decide to add a button and an LED to it, so you will build a template describing those capabilities.

As you stated in your comment, if you want a starting point, you will begin with the most basic and nearly empty capability model, but you can't have a capability model without any interfaces, so you can add the DeviceInformation interface that Microsoft provides. You will need to write the code that your Raspberry will run to actually fill out these fields!

{
  "@id": "urn:matthijsvdveer:RaspberryPi4_41:1",
  "@type": "CapabilityModel",
  "implements": [
    {
      "@id": "urn:matthijsvdveer:RaspberryPi4_41:2x_rlqmb2:1",
      "@type": "InterfaceInstance",
      "name": "DeviceInformation_z1",
      "schema": {
        "@id": "urn:azureiot:DeviceManagement:DeviceInformation:1",
        "@type": "Interface",
        "displayName": {
          "en": "Device information"
        },
        "contents": [
          {
            "@id": "urn:azureiot:DeviceManagement:DeviceInformation:manufacturer:1",
            "@type": "Property",
            "comment": "Company name of the device manufacturer. This could be the same as the name of the original equipment manufacturer (OEM). Ex. Contoso.",
            "displayName": {
              "en": "Manufacturer"
            },
            "name": "manufacturer",
            "schema": "string"
          },
          {
            "@id": "urn:azureiot:DeviceManagement:DeviceInformation:model:1",
            "@type": "Property",
            "comment": "Device model name or ID. Ex. Surface Book 2.",
            "displayName": {
              "en": "Device model"
            },
            "name": "model",
            "schema": "string"
          },
          {
            "@id": "urn:azureiot:DeviceManagement:DeviceInformation:swVersion:1",
            "@type": "Property",
            "comment": "Version of the software on your device. This could be the version of your firmware. Ex. 1.3.45",
            "displayName": {
              "en": "Software version"
            },
            "name": "swVersion",
            "schema": "string"
          },
          {
            "@id": "urn:azureiot:DeviceManagement:DeviceInformation:osName:1",
            "@type": "Property",
            "comment": "Name of the operating system on the device. Ex. Windows 10 IoT Core.",
            "displayName": {
              "en": "Operating system name"
            },
            "name": "osName",
            "schema": "string"
          },
          {
            "@id": "urn:azureiot:DeviceManagement:DeviceInformation:processorArchitecture:1",
            "@type": "Property",
            "comment": "Architecture of the processor on the device. Ex. x64 or ARM.",
            "displayName": {
              "en": "Processor architecture"
            },
            "name": "processorArchitecture",
            "schema": "string"
          },
          {
            "@id": "urn:azureiot:DeviceManagement:DeviceInformation:processorManufacturer:1",
            "@type": "Property",
            "comment": "Name of the manufacturer of the processor on the device. Ex. Intel.",
            "displayName": {
              "en": "Processor manufacturer"
            },
            "name": "processorManufacturer",
            "schema": "string"
          },
          {
            "@id": "urn:azureiot:DeviceManagement:DeviceInformation:totalStorage:1",
            "@type": "Property",
            "comment": "Total available storage on the device in kilobytes. Ex. 2048000 kilobytes.",
            "displayName": {
              "en": "Total storage"
            },
            "name": "totalStorage",
            "displayUnit": {
              "en": "kilobytes"
            },
            "schema": "long"
          },
          {
            "@id": "urn:azureiot:DeviceManagement:DeviceInformation:totalMemory:1",
            "@type": "Property",
            "comment": "Total available memory on the device in kilobytes. Ex. 256000 kilobytes.",
            "displayName": {
              "en": "Total memory"
            },
            "name": "totalMemory",
            "displayUnit": {
              "en": "kilobytes"
            },
            "schema": "long"
          }
        ]
      }
    }
  ],
  "displayName": {
    "en": "Raspberry Pi 4"
  },
  "@context": [
    "http://azureiot.com/v1/contexts/IoTModel.json"
  ]
}

My advice would be to create your own in IoT Central, while the above is a decent starting-off point, it takes only a minute to create your own in IoT Central and then you can add your own interfaces.

Hope this explains it a bit! Let me know if you need anything clarified.

Matthijs van der Veer
  • 3,865
  • 2
  • 12
  • 22
  • Thanks, but I was expecring a basic template where we can add the capabilities later. Do you know how can I create one basic template for my Raspberry Pi 4 ? – Sibeesh Venu Aug 10 '20 at 10:05
  • I updated my answer with a possible starting-off point. You can import that, but I would advise you to click together your own version. I added a link to the appropriate docs. – Matthijs van der Veer Aug 10 '20 at 10:18
  • Thanks, yet I am unclear about how you created this JSON file. Is there any UI to create this? – Sibeesh Venu Aug 10 '20 at 11:40
  • 1
    Absolutely! You can follow [this tutorial](https://learn.microsoft.com/en-us/learn/modules/create-your-first-iot-central-app/) to get started. It guides you through creating a template. After you create that template, you can export it, if you wish to use it in another application. You can do that by going back to the device template and clicking export. – Matthijs van der Veer Aug 10 '20 at 11:50
  • Ok, thanks. Let me have a look. I will accept the answer once I do that. – Sibeesh Venu Aug 10 '20 at 11:54