MQTT Engine BIRTH certificate format for custom array properties

Hi,

I’m looking for the correct format in the BIRTH certificate to add a custom array property for my tag.

Thus far I can add properties (keys and values) with the BIRTH certificate as follows

{
    "timestamp": 1565577612580,
    "metrics": [
        {
            "name": "myTagName",
            "type": "boolean",
            "value": false,
            "properties": {
                "keys": {
                    "type": "uint8",
                    "value": 321
                },
                "values": {
                    "type": "string",
                    "value": "spam"
                }
            }
        }
    ]
}

However, I’m looking for the correct syntax for adding arrays/lists as properties. i.e. if keys would be a fixed or variabe list of numbers.

Kind Regards
Art

Are you actually asking about a DBIRTH payload?

The optional properties in a metric is actually a PropertySet object, which would look something like this, I think:

{
    "timestamp": 1565577612580,
    "metrics": [
        {
            "name": "myTagName",
            "type": "boolean",
            "value": false,
            "properties": {
                "keys": [
                    "prop1name",
                    "prop2name"
                ],
                "values": [
                    {
                        "type": "uint8",
                        "value": 321
                    },
                    {
                        "type": "string",
                        "value": "spam"
                    }
                ]
            }
        }
    ]
}

If you’re going to be working with Sparkplug at this level you’re going to have to dig through the relatively difficult to navigate and understand and spec: https://www.eclipse.org/tahu/spec/Sparkplug%20Topic%20Namespace%20and%20State%20ManagementV2.2-with%20appendix%20B%20format%20-%20Eclipse.pdf

The spec is being worked on now that it’s an Eclipse Foundation project. Hopefully future versions are easier to digest.

Hi Kevin,

The Node-RED client does not seem to like the format. I get a TypeError: Cannot read property 'toUpperCase' of undefined, when that JSON is used for DBIRTH

I know what you mean about the spec as I’ve read it, I’ve noticed that I could not just set datatype as PropertySet thus I thought I’ll ask.

I basically want to create a tag property that is a list of strings. And since I saw that an Array is an option under Custom Properties I was wondering what is the format to assign a datatype to a tag array property.

Maybe @wes0johnson can chime in here.

1 Like

I don’t think Sparkplug has array/list types… other than maybe Dataset. You might have to make a single string property that is comma separated or something and then split it when consumed?

It is a possibility. I was hoping there is a slicker way, but I can fall back on a comma separated list or JSON

Arrays of Strings are not supported yet. We did just add array support for all Ignition array types except arrays of Strings and arrays of DateTime in Ignition8 compatible Transmission and Engine modules. These will be release later in the week. But since arrays of Strings are not supported I’d suggest using a comma separated String or something similar as Kevin suggested.

1 Like

Thanks Wes for clarifying this