1 回答
- 最新
- 投票最多
- 评论最多
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.
已回答 1 年前
相关内容
- AWS 官方已更新 1 年前
- AWS 官方已更新 1 年前
- AWS 官方已更新 3 年前
- AWS 官方已更新 1 年前
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?