简体   繁体   中英

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

I am receiveing data from AWS IoT and the incomming data looks like:

{
  "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?

There is no way to just get a value by using only the AWS IoT rule engine.

You can instead write some code in AWS Lambda to send you just the value (or with other cosmetics you desire) via AWS SES. Use the Rule Engine to invoke the Lambda function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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