[英]Siemens logo Shadows and AWS IoT Timestream problem
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.我试图将我的影子数据值从 Siemens Logo 设备中分离到正确的列中——每个值都应该分别写入
Amazon Timestream
,但是它们的值名称包含破折号等字符,我无法通过设置 SQL 来分离这些值筛选。
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所以我只能 select 更新和设置影子文件中的所有数据
Dimension Name: device_id
Dimension Value: ${clientId()}
The result in Timestream looks unusable - attached print screen Timestream 中的结果看起来无法使用 - 附上打印屏幕
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
}
}
}
}
I am facing the same problem.我面临着同样的问题。 The best solution I found is to use an AWS Lambda function:
我找到的最佳解决方案是使用 AWS Lambda function:
In Lambda I can access the Logo.在Lambda我可以访问Logo。 telemetry values as a dictionary.
作为字典的遥测值。 I used C# (.Net6) but the same principle can be used with a programming language of your choice.
我使用了 C# (.Net6),但同样的原理也适用于您选择的编程语言。
I created a message structure in C#:我在C#中创建了一个消息结构:
public class TelemetryMsg
{
public Dictionary<string, string> State { get; set; } = new Dictionary<string, string>();
...
}
Then I can access data using C# notation:然后我可以使用 C# 表示法访问数据:
public TestFunction (TelemetryMsg msg)
{
string myData = msg.State["I..1:1-1"]
}
Another solution is this: AWS IoT Rule re-publish topic MQTT using Timestram as destination instead of MQTT.另一个解决方案是: AWS IoT Rule 使用 Timestram 作为目标而不是 MQTT 重新发布主题MQTT。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.