AWS IoT Sitewise - Device Name Management

0

I am interested in managing a group of Raspberry Pi devices through IoT Sitewise and alerting on sensor data processed by the devices. What is not clear to me is how to report the device names into Sitewise through IoT Core. Right now, my devices are given unique names through the IoT ClientID (ex. RaspberryPi001, RaspberryPi002, etc.) and I am routing the ClientID and sensor payload data to Sitewise through a rule in IoT Core. However, there does not appear to be a way to add the ClientId as a measurement to the Sitewise model. The examples I see in the Sitewise documentation all have the device name added as a hardcoded attribute. But how does that approach work when you have potentially a fleet of devices reporting into Sitewise? Also, I would like to add the device name to the Alarm message so the recipient can know which device is the active alarm state.

I am trying to use /ClientID/ as the property alias in the IoT Core Sitewise rule with the following query, and then add ClientId as a measurement in the Sitewise Asset Model. But I am not receiving any values on the ClientID measurement in Sitewise.

SELECT clientId() as ClientId, state.reported.payload.temperature as reported.temperature, state.reported.payload.humidity as reported.humidity, state.reported.payload.VOC as reported.VOC, state.reported.payload.CO2 as reported.CO2 FROM '$aws/things/+/shadow/update'

In summary, I am looking for a way to add the IoT device name to the Sitewise model or asset and alarm message. Thanks!

asked a year ago306 views
1 Answer
0

You can add the device name as a custom attribute to the Sitewise asset by including it in the payload that is sent from the device to Sitewise. You can use the IoT ClientID as the device name in the payload and include it in the SELECT statement in the IoT rule.

Here's an updated SELECT statement that you can use in your IoT rule:

SELECT clientId() as deviceName, state.reported.payload.temperature as temperature, state.reported.payload.humidity as humidity, state.reported.payload.VOC as VOC, state.reported.payload.CO2 as CO2 FROM '$aws/things/+/shadow/update'

In the Sitewise asset model, you can create a custom attribute for the device name and select "deviceName" as the measurement to map to that attribute. In the alarm message, you can include the custom attribute to display the device name.

Keep in mind that it may take some time for the data to be processed and appear in Sitewise after the SELECT statement is added to the IoT rule.

profile picture
answered a year ago
  • Gabriel, I updated my SQL query as suggested and added a new measurement to the asset model in Sitewise for DeviceName. Then I used the IoT Sitewise rule to map the DeviceName to the Property Alias for the measurement. The key to getting the ClientId to populate the new measurement was to provide this Property Value in the IoT Rule: ${clientId()}

    So the DeviceName is now populating the new measurement in the Sitewise Asset Model. You mentioned that a custom attribute should be created to include the DeviceName in the Alarm notification. I have created a custom attribute for the alarm but have not figured out how to map the DeviceName measurement to be the default value of the custom attribute. Can you give some clarification on this part?

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