1 Resposta
- Mais recentes
- Mais votos
- Mais comentários
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.
respondido há um ano
Conteúdo relevante
- AWS OFICIALAtualizada há 3 anos
- AWS OFICIALAtualizada há 2 anos
- AWS OFICIALAtualizada há um ano
- AWS OFICIALAtualizada há 3 anos
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?