範例:使用感測器和應用程式 AWS IoT Events 進行事件偵測 - AWS IoT Events

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

範例:使用感測器和應用程式 AWS IoT Events 進行事件偵測

此偵測器模型是主控台提供的其中一個範本 AWS IoT Events 。為了您的方便,此處包含此項目。

此範例示範使用感應器資料偵測 AWS IoT Events的應用程式事件。它顯示如何建立監控指定事件的偵測器模型,以便您可以觸發適當的動作。您可以建立多個感應器輸入、定義複雜的事件條件,以及設定漸進式回應機制。

{ "detectorModelName": "EventDetectionSensorsAndApplications", "detectorModelDefinition": { "states": [ { "onInput": { "transitionEvents": [], "events": [] }, "stateName": "Device_exception", "onEnter": { "events": [ { "eventName": "Send_mqtt", "actions": [ { "iotTopicPublish": { "mqttTopic": "Device_stolen" } } ], "condition": "true" } ] }, "onExit": { "events": [] } }, { "onInput": { "transitionEvents": [ { "eventName": "To_in_use", "actions": [], "condition": "$variable.position != $input.AWS_IoTEvents_Blueprints_Tracking_DeviceInput.gps_position", "nextState": "Device_in_use" } ], "events": [] }, "stateName": "Device_idle", "onEnter": { "events": [ { "eventName": "Set_position", "actions": [ { "setVariable": { "variableName": "position", "value": "$input.AWS_IoTEvents_Blueprints_Tracking_DeviceInput.gps_position" } } ], "condition": "true" } ] }, "onExit": { "events": [] } }, { "onInput": { "transitionEvents": [ { "eventName": "To_exception", "actions": [], "condition": "$input.AWS_IoTEvents_Blueprints_Tracking_UserInput.device_id != $input.AWS_IoTEvents_Blueprints_Tracking_DeviceInput.device_id", "nextState": "Device_exception" } ], "events": [] }, "stateName": "Device_in_use", "onEnter": { "events": [] }, "onExit": { "events": [] } } ], "initialStateName": "Device_idle" } }