在 中使用 BatchPutMessage 進行輸入 AWS IoT Events - AWS IoT Events

終止支援通知:2026 年 5 月 20 日, AWS 將終止對 的支援 AWS IoT Events。2026 年 5 月 20 日之後,您將無法再存取 AWS IoT Events 主控台或 AWS IoT Events 資源。如需詳細資訊,請參閱AWS IoT Events 終止支援

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

在 中使用 BatchPutMessage 進行輸入 AWS IoT Events

範例 1

使用 BatchPutMessage操作來傳送訊息"seedTemperatureInput",以設定在溫度控制和監控下指定區域的操作參數。收到具有新 AWS IoT Events 的任何訊息都會建立新的"areaId"偵測器執行個體。但新的偵測器執行個體不會將狀態變更為 ,"idle"並開始監控溫度和控制加熱或冷卻單位,直到收到新區域"seedTemperatureInput"的訊息為止。

CLI 命令:

aws iotevents-data batch-put-message --cli-input-json file://seedExample.json --cli-binary-format raw-in-base64-out

檔案: seedExample.json

{ "messages": [ { "messageId": "00001", "inputName": "seedTemperatureInput", "payload": "{\"areaId\": \"Area51\", \"desiredTemperature\": 20.0, \"allowedError\": 0.7, \"rangeHigh\": 30.0, \"rangeLow\": 15.0, \"anomalousHigh\": 60.0, \"anomalousLow\": 0.0, \"sensorCount\": 10, \"noDelay\": false}" } ] }

回應:

{ "BatchPutMessageErrorEntries": [] }

2

使用 BatchPutMessage操作來傳送訊息"temperatureInput",報告指定控制和監控區域中感應器的溫度感應器資料。

CLI 命令:

aws iotevents-data batch-put-message --cli-input-json file://temperatureExample.json --cli-binary-format raw-in-base64-out

檔案: temperatureExample.json

{ "messages": [ { "messageId": "00005", "inputName": "temperatureInput", "payload": "{\"sensorId\": \"05\", \"areaId\": \"Area51\", \"sensorData\": {\"temperature\": 23.12} }" } ] }

回應:

{ "BatchPutMessageErrorEntries": [] }
範例 3

使用 BatchPutMessage操作來傳送訊息"seedTemperatureInput",以變更指定區域的所需溫度值。

CLI 命令:

aws iotevents-data batch-put-message --cli-input-json file://seedSetDesiredTemp.json --cli-binary-format raw-in-base64-out

檔案: seedSetDesiredTemp.json

{ "messages": [ { "messageId": "00001", "inputName": "seedTemperatureInput", "payload": "{\"areaId\": \"Area51\", \"desiredTemperature\": 23.0}" } ] }

回應:

{ "BatchPutMessageErrorEntries": [] }