简体   繁体   English

仅从AWS IoT规则的json数据中接收一个参数

[英]Receive only one parameter from aws IoT rule's json data

I am receiveing data from AWS IoT and the incomming data looks like: 我正在从AWS IoT接收数据,传入数据如下所示:

{
  "desired": {
    "status": "ON",
    "Temperature": 4,
  },
  "reported": {
    "status": "ON",
    "Temperature": 4
  }
} 

I have set up a text message alert every time that new data comes in. With the text message I only want to receive the temperature. 每当有新数据输入时,我都会设置一个短信警报。通过短信,我只想接收温度。 The current query string is: 当前查询字符串为:

SELECT * FROM '$aws/things/MyDashButton/shadow/update'

I am assuming that I have to change the star to Temperature, but when I do the text message I receive is blank. 我假设我必须将星标更改为“温度”,但是当我收到短信时,我会收到空​​白。 I tried looking through the documentation, but cannot find an answer for this. 我尝试浏览文档,但是找不到答案。

EDIT: 编辑:

If I use 如果我用

SELECT state.desired.Temperature FROM '$aws/things/MyDashButton/shadow/update'

I get {"Temperature": 4} is there a way just to get the value? 我得到{“ Temperature”:4}有没有一种方法来获取价值?

There is no way to just get a value by using only the AWS IoT rule engine. 无法仅通过使用AWS IoT规则引擎来获取价值。

You can instead write some code in AWS Lambda to send you just the value (or with other cosmetics you desire) via AWS SES. 您可以改为在AWS Lambda中编写一些代码,以通过AWS SES仅向您发送价值(或与其他所需的化妆品)。 Use the Rule Engine to invoke the Lambda function. 使用规则引擎调用Lambda函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM