By using AWS re:Post, you agree to the Terms of Use

Automate SiteWise Asset Property Alias

0

Hi There

I'm looking for perhaps the missing link in how to automatically change asset properties within SiteWise?

This must be a common Sitewise requirement for the manufacturing industry? Yet the whole CLI workflow requesting asset ID, then parsing properties and then responding seems quite complicated for widespread use.

Even if forced to communicate with a server on per device, rather than a global configuration export/import; I'd still expect something as simple as: "aws iotsitewise {AssetName}.{PropertyName}.Alias = {GiveAliasString}"

Currently, it seams like I have to do the following:

  1. Search for all existing SiteWise Assets
  2. Search that JSON response for the human name of the Sitewise asset.
  3. Get AssetID that "owns" the assetName found in that JSON response
  4. Query server again using AssetID and get another JSON description of that particular Sitewise asset
  5. Search JSON response for parameter/metric of interest
  6. Get PropertryID from JSON response
  7. Finally use property ID to update alias string

I'd imagine 90% of SiteWises development is given to automation engineers. Yet based on assumed workflow, the response from 99% of them, myself included response would be to go find someone else... There must be a better way I haven't found?

Creating assets is easy enough, single CLI command; but some assets might have 20+ properties, and a normal project probably has 100+ assets. The console isn't practical for real project.

asked 3 months ago44 views
2 Answers
1
Accepted Answer

Hi rePost-User-6825629

Correct, most of the AWS IoT SiteWise APIs require the assetID and propertyID and there is no API call to find IDs using a property or asset name. But you can start from the AWS IoT SiteWise data stream view to simplify your workflow:

Using the CLI it could look like this :

  1. Fetch all properties that don't have an alias atttached:
aws iotsitewise list-time-series --query 'TimeSeriesSummaries[?!alias]'
[
    {
        "assetId": "4cd2ea29-8b35-4f94-aeb9-1446bcb90fae",
        "propertyId": "503b3aa0-75ec-4d42-a294-cd85ee863da2",
        "timeSeriesId": "43a0fede-c0d0-4c3a-84b5-1d575214784c",
        "dataType": "DOUBLE",
        "timeSeriesCreationDate": "2021-10-25T09:42:45+01:00",
        "timeSeriesLastUpdateDate": "2022-03-30T15:57:59+01:00"
    },
...

Iterate to the list and optionally fetch the asset and property names:

aws iotsitewise describe-asset-property --asset-id 4cd2ea29-8b35-4f94-aeb9-1446bcb90fae --property-id 503b3aa0-75ec-4d42-a294-cd85ee863da2 --query '[assetName, assetProperty.name]'
[
    "Furnace002",
    "HighTemperature"
]

Update the property alias:

aws iotsitewise update-asset-property --asset-id 4cd2ea29-8b35-4f94-aeb9-1446bcb90fae --property-id 503b3aa0-75ec-4d42-a294-cd85ee863da2 --property-alias "myAlias"

or as an alternative, if you already ingested data into SiteWise for this alias. You can attach the Data stream directly to the property:

aws iotsitewise associate-time-series-to-asset-property --asset-id 4cd2ea29-8b35-4f94-aeb9-1446bcb90fae --property-id 503b3aa0-75ec-4d42-a294-cd85ee863da2 --alias 'myalias'

profile picture
answered 2 months ago
0

Thank you Jan;

That is along the similar lines I've been playing with since I made the post. I'd gone from unassigned data streams backwards to find the asset. But that nearly runs as it, rather than trial and error with other API commands.

Much appreciated;

answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions