Reputation: 11
I´m trying to separate my shadow data values from Siemens Logo device into correct columns - each value should be written to Amazon Timestream
separately however they value names contains characters like dashes etc. and I´m not able to separate the values by setting SQL filter.
The best what I was able to done was to set:
// Rule query statement
SELECT state.reported FROM '$aws/things/HneviceIoT1/shadow/update'
So I was able only select all data from the shadow file update and set
Dimension Name: device_id
Dimension Value: ${clientId()}
The result in Timestream looks unusable - attached print screen
Any help and Ideas would be very very appreciated.
Example of shadow document.
// Device Shadow state:
{
"state": {
"reported": {
"AM..4:1-1": "0027",
"I..1:1-1": "00",
"I..1:2-1": "01",
"Q..1:5-1": "01",
"M..1:25-1": "01",
"M..1:1-1": "00"
}
}
}
// Device Shadow metadata
{
"metadata": {
"reported": {
"AM..4:1-1": {
"timestamp": 1633104862
},
"I..1:1-1": {
"timestamp": 1633104862
},
"I..1:2-1": {
"timestamp": 1633104862
},
"Q..1:5-1": {
"timestamp": 1633104862
},
"M..1:25-1": {
"timestamp": 1633104862
},
"M..1:1-1": {
"timestamp": 1633104862
}
}
}
}
Upvotes: 1
Views: 363
Reputation: 41
Another solution is this: AWS IoT Rule re-publish topic MQTT using Timestram as destination instead of MQTT.
Upvotes: 0
Reputation: 41
I am facing the same problem. The best solution I found is to use an AWS Lambda function:
In Lambda I can access the Logo! telemetry values as a dictionary. I used C# (.Net6) but the same principle can be used with a programming language of your choice.
I created a message structure in C#:
public class TelemetryMsg
{
public Dictionary<string, string> State { get; set; } = new Dictionary<string, string>();
...
}
Then I can access data using C# notation:
public TestFunction (TelemetryMsg msg)
{
string myData = msg.State["I..1:1-1"]
}
Upvotes: 0