Updating attribute values - Amazon IoT SiteWise
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Updating attribute values

Assets inherit the attributes of their asset model, including the default value of the attribute. In some cases, you will want to keep the asset model's default attribute, such as for an asset manufacturer property. In other cases, you will want to update the inherited attribute, such as for an asset's latitude and longitude.

Updating an attribute value (console)

You can use the Amazon IoT SiteWise console to update the value of an attribute asset property.

To update an attribute's value (console)
  1. Navigate to the Amazon IoT SiteWise console.

  2. In the navigation pane, choose Assets.

  3. Choose the asset for which you want to update an attribute.


    You can choose the arrow icon to expand an asset hierarchy to find your asset.

  4. Choose Edit.

  5. Find the attribute to update, and then enter its new value.

                        Amazon IoT SiteWise "Edit asset" page screenshot with an attribute value
  6. Choose Save.

Updating an attribute value (Amazon CLI)

You can use the Amazon Command Line Interface (Amazon CLI) to update an attribute value.

You must know your asset's assetId and property's propertyId to complete this procedure. You can also use the external ID. If you created an asset but don't know its assetId, use the ListAssets API to view all of your assets for a specific model. Then, use the DescribeAsset operation to view your asset's properties including property IDs.

Use the BatchPutAssetPropertyValue operation to assign attribute values to your asset. You can use this operation to set multiple attributes at once. This operation's payload contains a list of entries, and each entry contains the asset ID, property ID, and attribute value.

To update an attribute's value (Amazon CLI)
  1. Create a file called batch-put-payload.json and copy the following JSON object into the file. This example payload demonstrates how to set a wind turbine's latitude and longitude. Update the IDs, values, and timestamps to modify the payload for your use case.

    { "entries": [ { "entryId": "windfarm3-turbine7-latitude", "assetId": "a1b2c3d4-5678-90ab-cdef-22222EXAMPLE", "propertyId": "a1b2c3d4-5678-90ab-cdef-33333EXAMPLE", "propertyValues": [ { "value": { "doubleValue": 47.6204 }, "timestamp": { "timeInSeconds": 1575691200 } } ] }, { "entryId": "windfarm3-turbine7-longitude", "assetId": "a1b2c3d4-5678-90ab-cdef-22222EXAMPLE", "propertyId": "a1b2c3d4-5678-90ab-cdef-55555EXAMPLE", "propertyValues": [ { "value": { "doubleValue": 122.3491 }, "timestamp": { "timeInSeconds": 1575691200 } } ] } ] }

    Each entry in the payload contains an entryId that you can define as any unique string. If any request entries fail, each error will contain the entryId of the corresponding request so that you know which requests to retry.

    To set an attribute value, you can include one timestamp-quality-value (TQV) structure in the list of propertyValues for each attribute property. This structure must contain the new value and the current timestamp.

    • value – A structure that contains one of the following fields, depending on the type of the property being set:

      • booleanValue

      • doubleValue

      • integerValue

      • stringValue

    • timestamp – A structure that contains the current Unix epoch time in seconds, timeInSeconds. Amazon IoT SiteWise rejects any data points with timestamps that existed longer than 7 days in the past or newer than 5 minutes in the future.

    For more information about how to prepare a payload for BatchPutAssetPropertyValue, see Ingesting data using the Amazon IoT SiteWise API.

  2. Run the following command to send the attribute values to Amazon IoT SiteWise:

    aws iotsitewise batch-put-asset-property-value --cli-input-json file://batch-put-payload.json