I want to turn off a metric for a single asset in a model in AWS IoT SiteWise.
Short description
AWS IoT SiteWise assets inherit metrics and measurements that you configure at the model level. You can use an attribute to exclude a single asset from an inherited metric or measurement.
You must create an attribute, and update the attribute's metric formula to include an if condition. Then, update the attribute value for the asset that you don't want the metric to apply to.
Resolution
Create an attribute
Complete the following steps:
- Open the AWS IoT SiteWise console.
- In the navigation pane, choose Models.
- On the Models page, select the model, and then choose Edit.
- Under Definitions, for Property Type, choose Attributes, and then choose Add new attribute.
- For the attribute, enter the following information:
For Name, enter a name for the attribute, such as metricEnabled.
For Data type, select Boolean.
For Default value, select True.
- Choose Save.
The model applies the metricEnabled attribute with a value of True to all assets that use the model.
Update the metric formula
Complete the following steps:
- Open the AWS IoT SiteWise console.
- In the navigation pane, choose Models.
- On the Models page, select the model, and then choose Edit.
- Under Definitions, for Property Type, choose Metrics, and then select the metric that you want to turn off.
- For Formula, update the formula to include an if condition for the attribute, for example, if({metricEnabled},avg({Wind Speed}),none).
- Choose Save.
Now that you turned on the metricEnabled attribute for the Average Wind Speed metric, the metric monitors all assets in the model.
Update the attribute value
Complete the following steps:
- Open the AWS IoT SiteWise console.
- In the navigation pane, choose Assets.
- On the Assets page, select the asset, and then choose Edit.
- Under Properties, for Property Type, choose Attributes.
- For metricEnabled, select False.
- Choose Save.
You now turned off the Average Wind Speed metric for the single asset.
Note: To turn off the metric for new assets, set the attribute value to False when you create the asset.