

지원 종료 알림: 2026년 5월 20일에 AWS 에 대한 지원이 종료됩니다 AWS IoT Events. 2026년 5월 20일 이후에는 AWS IoT Events 콘솔 또는 AWS IoT Events 리소스에 더 이상 액세스할 수 없습니다. 자세한 내용은 [AWS IoT Events 지원 종료를 참조하세요](https://docs.aws.amazon.com/iotevents/latest/developerguide/iotevents-end-of-support.html).

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# AWS IoT Events 감지기 모델 예제
<a name="iotevents-examples"></a>

 이 페이지에서는 다양한 AWS IoT Events 기능을 구성하는 방법을 보여주는 예제 사용 사례 목록을 제공합니다. 이 예제는 온도 임계값과 같은 기본 감지부터 고급 이상 탐지 및 기계 학습 시나리오에 이르기까지 다양합니다. 각 예제에는 AWS IoT Events 탐지, 작업 및 통합을 설정하는 데 도움이 되는 절차와 코드 조각이 포함되어 있습니다. 이 예제에서는 AWS IoT Events 서비스의 유연성과 다양한 IoT 애플리케이션 및 사용 사례에 맞게 서비스를 사용자 지정하는 방법을 보여줍니다. AWS IoT Events 기능을 탐색하거나 특정 탐지 또는 자동화 워크플로를 구현하는 지침이 필요한 경우이 페이지를 참조하세요.

**Topics**
+ [

# 예:에서 HVAC 온도 제어 사용 AWS IoT Events
](iotevents-examples-hvac.md)
+ [

# 예:를 사용하여 조건을 감지하는 크레인 AWS IoT Events
](iotevents-examples-cranes.md)
+ [

# 에서 감지된 조건에 대한 응답으로 명령 전송 AWS IoT Events
](iotevents-examples-cranes-commands.md)
+ [

# 크레인 모니터링을 위한 AWS IoT Events 감지기 모델
](iotevents-examples-cranes-detector-models.md)
+ [

# AWS IoT Events 크레인 모니터링을 위한 입력
](iotevents-examples-cranes-inputs.md)
+ [

# 를 사용하여 경보 및 운영 메시지 전송 AWS IoT Events
](iotevents-examples-cranes-messages.md)
+ [

# 예: 센서 및 애플리케이션을 사용한 AWS IoT Events 이벤트 감지
](iotevents-examples-edwsaa.md)
+ [

# 예: 와의 디바이스 연결을 모니터링하기 위한 디바이스 HeartBeat AWS IoT Events
](iotevents-examples-dhb.md)
+ [

# 예:의 ISA 경보 AWS IoT Events
](iotevents-examples-bisaa.md)
+ [

# 예:를 사용하여 간단한 경보 빌드 AWS IoT Events
](iotevents-examples-bsa.md)

# 예:에서 HVAC 온도 제어 사용 AWS IoT Events
<a name="iotevents-examples-hvac"></a>

## 백그라운드 스토리
<a name="iotevents-examples-hvac-background"></a>

이 예제는 다음과 같은 기능을 갖춘 온도 제어 모델(온도 조절기)을 구현합니다.
+ 여러 영역을 모니터링하고 제어할 수 있는 하나의 감지기 모델을 정의하십시오. (각 영역에 대해 감지기 인스턴스가 생성됩니다.)
+ 각 감지기 인스턴스는 각 제어 영역에 배치된 여러 센서로부터 온도 데이터를 수신합니다.
+ 언제든지 각 영역의 원하는 온도(설정점)를 변경할 수 있습니다.
+ 각 영역의 작동 파라미터를 정의하고 언제든지 이러한 파라미터를 변경할 수 있습니다.
+ 언제든지 영역에 센서를 추가하거나 영역에서 센서를 삭제할 수 있습니다.
+ 난방 및 냉방 장치의 최소 작동 시간을 설정하여 손상을 방지할 수 있습니다.
+ 감지기는 비정상적인 센서 판독값을 거부하고 보고합니다.
+ 비상 온도 설정점을 정의할 수 있습니다. 센서 중 하나에서 사용자가 정의한 설정값보다 높거나 낮은 온도를 보고하면 난방 또는 냉방 장치가 즉시 작동하고 감지기가 온도 급상승을 보고합니다.

이 예제는 다음과 같은 기능을 보여줍니다.
+ 이벤트 감지기 모델을 생성합니다.
+ 입력을 생성합니다.
+ 감지기 모델로 입력을 수집합니다.
+ 트리거 조건을 평가하십시오.
+ 조건의 상태 변수를 참조하고 조건에 따라 변수 값을 설정합니다.
+ 조건의 타이머를 참조하고 조건에 따라 타이머를 설정하십시오.
+ Amazon SNS와 MQTT 메시지의 조치를 취하십시오.

# 의 HVAC 시스템에 대한 입력 정의 AWS IoT Events
<a name="iotevents-examples-hvac-inputs"></a>

`seedTemperatureInput`는 특정 지역의 감지기 인스턴스를 생성하고 해당 영역의 작동 파라미터를 정의하는 데 사용됩니다.

효과적인 기후 제어를 위해서는에서 HVAC 시스템에 대한 입력을 구성하는 AWS IoT Events 것이 중요합니다. 이 예제에서는 온도, 습도, 점유율 및 에너지 소비 데이터와 같은 파라미터를 캡처하는 입력을 설정하는 방법을 보여줍니다. 입력 속성을 정의하고, 데이터 소스를 구성하고, 탐지기 모델이 최적의 관리 및 효율성을 위해 정확하고 시기 적절한 정보를 받을 수 있도록 사전 처리 규칙을 설정하는 방법을 알아봅니다.

CLI 명령은 다음을 사용합니다.

```
aws iotevents create-input --cli-input-json file://seedInput.json
```

파일: `seedInput.json`

```
{
  "inputName": "seedTemperatureInput",
  "inputDescription": "Temperature seed values.",
  "inputDefinition": {
    "attributes": [
      { "jsonPath": "areaId" },
      { "jsonPath": "desiredTemperature" },
      { "jsonPath": "allowedError" },
      { "jsonPath": "rangeHigh" },
      { "jsonPath": "rangeLow" },
      { "jsonPath": "anomalousHigh" },
      { "jsonPath": "anomalousLow" },
      { "jsonPath": "sensorCount" },
      { "jsonPath": "noDelay" }
    ]
  }
}
```

응답:

```
{
    "inputConfiguration": {
        "status": "ACTIVE", 
        "inputArn": "arn:aws:iotevents:us-west-2:123456789012:input/seedTemperatureInput", 
        "lastUpdateTime": 1557519620.736, 
        "creationTime": 1557519620.736, 
        "inputName": "seedTemperatureInput", 
        "inputDescription": "Temperature seed values."
    }
}
```

필요에 따라 각 영역의 각 센서가 `temperatureInput`을 전송해야 합니다.

CLI 명령은 다음을 사용합니다.

```
aws iotevents create-input --cli-input-json file://temperatureInput.json
```

파일: `temperatureInput.json`

```
{
  "inputName": "temperatureInput",
  "inputDescription": "Temperature sensor unit data.",
  "inputDefinition": {
    "attributes": [
      { "jsonPath": "sensorId" },
      { "jsonPath": "areaId" },
      { "jsonPath": "sensorData.temperature" }
    ]
  }
}
```

응답:

```
{
    "inputConfiguration": {
        "status": "ACTIVE", 
        "inputArn": "arn:aws:iotevents:us-west-2:123456789012:input/temperatureInput", 
        "lastUpdateTime": 1557519707.399, 
        "creationTime": 1557519707.399, 
        "inputName": "temperatureInput", 
        "inputDescription": "Temperature sensor unit data."
    }
}
```

# 를 사용하여 HVAC 시스템에 대한 감지기 모델 정의 AWS IoT Events
<a name="iotevents-examples-hvac-detector-model"></a>

`areaDetectorModel`는 각 감지기 인스턴스의 작동 방식을 정의합니다. 각 `state machine` 인스턴스는 온도 센서 판독값을 수집한 다음 이 판독값에 따라 상태를 변경하고 제어 메시지를 보냅니다.

CLI 명령은 다음을 사용합니다.

```
aws iotevents create-detector-model --cli-input-json file://areaDetectorModel.json
```

파일: `areaDetectorModel.json`

```
{
  "detectorModelName": "areaDetectorModel",
  "detectorModelDefinition": {
    "states": [
      {
        "stateName": "start",
        "onEnter": {
          "events": [
            {
              "eventName": "prepare",
              "condition": "true",
              "actions": [
                {
                  "setVariable": {
                    "variableName": "sensorId",
                    "value": "0"
                  }
                },
                {
                  "setVariable": {
                    "variableName": "reportedTemperature",
                    "value": "0.1"
                  }
                },
                {
                  "setVariable": {
                    "variableName": "resetMe",
                    "value": "false"
                  }
                }
              ]
            }
          ]
        },
        "onInput": {
          "transitionEvents": [
            {
              "eventName": "initialize",
              "condition": "$input.seedTemperatureInput.sensorCount > 0",
              "actions": [
                { 
                  "setVariable": {
                    "variableName": "rangeHigh",
                    "value": "$input.seedTemperatureInput.rangeHigh"
                  }
                },
                { 
                  "setVariable": {
                    "variableName": "rangeLow",
                    "value": "$input.seedTemperatureInput.rangeLow"
                  }
                },
                { 
                  "setVariable": {
                    "variableName": "desiredTemperature",
                    "value": "$input.seedTemperatureInput.desiredTemperature"
                  }
                },
                { 
                  "setVariable": {
                    "variableName": "averageTemperature",
                    "value": "$input.seedTemperatureInput.desiredTemperature"
                  }
                },
                { 
                  "setVariable": {
                    "variableName": "allowedError",
                    "value": "$input.seedTemperatureInput.allowedError"
                  }
                },
                {
                  "setVariable": {
                    "variableName": "anomalousHigh",
                    "value": "$input.seedTemperatureInput.anomalousHigh"
                  }
                },
                {
                  "setVariable": {
                    "variableName": "anomalousLow",
                    "value": "$input.seedTemperatureInput.anomalousLow"
                  }
                },
                {
                  "setVariable": {
                    "variableName": "sensorCount",
                    "value": "$input.seedTemperatureInput.sensorCount"
                  }
                },
                {
                  "setVariable": {
                    "variableName": "noDelay",
                    "value": "$input.seedTemperatureInput.noDelay == true"
                  }
                }
              ],
              "nextState": "idle"
            },
            {
              "eventName": "reset",
              "condition": "($variable.resetMe == true) && ($input.temperatureInput.sensorData.temperature < $variable.anomalousHigh && $input.temperatureInput.sensorData.temperature > $variable.anomalousLow)",
              "actions": [
                {
                  "setVariable": {
                    "variableName": "averageTemperature",
                    "value": "((($variable.averageTemperature * ($variable.sensorCount - 1)) + $input.temperatureInput.sensorData.temperature) / $variable.sensorCount)"
                  }
                }
              ],
              "nextState": "idle"
            }
          ]
        },
        "onExit": {
          "events": [
            {
              "eventName": "resetHeatCool",
              "condition": "true",
              "actions": [
                {
                  "sns": {
                    "targetArn": "arn:aws:sns:us-west-2:123456789012:heatOff"
                  }
                },
                {
                  "sns": {
                    "targetArn": "arn:aws:sns:us-west-2:123456789012:coolOff"
                  }
                },
                {
                  "iotTopicPublish": {
                    "mqttTopic": "hvac/Heating/Off"
                  }
                },
                {
                  "iotTopicPublish": {
                    "mqttTopic": "hvac/Cooling/Off"
                  }
                }
              ]
            }
          ]
        }
      },


      {
        "stateName": "idle",
        "onInput": {
          "events": [
            {
              "eventName": "whatWasInput",
              "condition": "true",
              "actions": [
                {
                  "setVariable": {
                    "variableName": "sensorId",
                    "value": "$input.temperatureInput.sensorId"
                  }
                },
                {
                  "setVariable": {
                    "variableName": "reportedTemperature",
                    "value": "$input.temperatureInput.sensorData.temperature"
                  }
                }
              ]
            },
            {
              "eventName": "changeDesired",
              "condition": "$input.seedTemperatureInput.desiredTemperature != $variable.desiredTemperature",
              "actions": [
                { 
                  "setVariable": {
                    "variableName": "desiredTemperature",
                    "value": "$input.seedTemperatureInput.desiredTemperature"
                  }
                }
              ]
            },
            {
              "eventName": "calculateAverage",
              "condition": "$input.temperatureInput.sensorData.temperature < $variable.anomalousHigh && $input.temperatureInput.sensorData.temperature > $variable.anomalousLow",
              "actions": [
                {
                  "setVariable": {
                    "variableName": "averageTemperature",
                    "value": "((($variable.averageTemperature * ($variable.sensorCount - 1)) + $input.temperatureInput.sensorData.temperature) / $variable.sensorCount)"
                  }
                }
              ]
            }
          ],
          "transitionEvents": [
            {
              "eventName": "anomalousInputArrived",
              "condition": "$input.temperatureInput.sensorData.temperature >= $variable.anomalousHigh || $input.temperatureInput.sensorData.temperature <= $variable.anomalousLow",
              "actions": [
                { 
                  "iotTopicPublish": {
                    "mqttTopic": "temperatureSensor/anomaly"
                  }
                }
              ],
              "nextState": "idle"
            },

            {
              "eventName": "highTemperatureSpike",
              "condition": "$input.temperatureInput.sensorData.temperature > $variable.rangeHigh",
              "actions": [
                {
                  "iotTopicPublish": {
                    "mqttTopic": "temperatureSensor/spike"
                  }
                },
                {
                  "sns": {
                    "targetArn": "arn:aws:sns:us-west-2:123456789012:coolOn"
                  }
                },
                {
                  "iotTopicPublish": {
                    "mqttTopic": "hvac/Cooling/On"
                  }
                },
                {
                  "setVariable": {
                    "variableName": "enteringNewState",
                    "value": "true"
                  }
                }
              ],
              "nextState": "cooling"
            },

            {
              "eventName": "lowTemperatureSpike",
              "condition": "$input.temperatureInput.sensorData.temperature < $variable.rangeLow",
              "actions": [
                {
                  "iotTopicPublish": {
                    "mqttTopic": "temperatureSensor/spike"
                  }
                },
                {
                  "sns": {
                    "targetArn": "arn:aws:sns:us-west-2:123456789012:heatOn"
                  }
                },
                {
                  "iotTopicPublish": {
                    "mqttTopic": "hvac/Heating/On"
                  }
                },
                {
                  "setVariable": {
                    "variableName": "enteringNewState",
                    "value": "true"
                  }
                }
              ],
              "nextState": "heating"
            },

            {
              "eventName": "highTemperatureThreshold",
              "condition": "(((($variable.averageTemperature * ($variable.sensorCount - 1)) + $input.temperatureInput.sensorData.temperature) / $variable.sensorCount) > ($variable.desiredTemperature + $variable.allowedError))",
              "actions": [
                {
                  "sns": {
                    "targetArn": "arn:aws:sns:us-west-2:123456789012:coolOn"
                  }
                },
                {
                  "iotTopicPublish": {
                    "mqttTopic": "hvac/Cooling/On"
                  }
                },
                {
                  "setVariable": {
                    "variableName": "enteringNewState",
                    "value": "true"
                  }
                }
              ],
              "nextState": "cooling"
            },

            {
              "eventName": "lowTemperatureThreshold",
              "condition": "(((($variable.averageTemperature * ($variable.sensorCount - 1)) + $input.temperatureInput.sensorData.temperature) / $variable.sensorCount) < ($variable.desiredTemperature - $variable.allowedError))",
              "actions": [
                {
                  "sns": {
                    "targetArn": "arn:aws:sns:us-west-2:123456789012:heatOn"
                  }
                },
                {
                  "iotTopicPublish": {
                    "mqttTopic": "hvac/Heating/On"
                  }
                },
                {
                  "setVariable": {
                    "variableName": "enteringNewState",
                    "value": "true"
                  }
                }
              ],
              "nextState": "heating"
            }
          ]
        }
      },


      {
        "stateName": "cooling",
        "onEnter": {
          "events": [
            {
              "eventName": "delay",
              "condition": "!$variable.noDelay && $variable.enteringNewState",
              "actions": [
                {
                  "setTimer": {
                    "timerName": "coolingTimer",
                    "seconds": 180
                  }
                },
                {
                  "setVariable": {
                    "variableName": "goodToGo",
                    "value": "false"
                  }
                }
              ]
            },
            {
              "eventName": "dontDelay",
              "condition": "$variable.noDelay == true",
              "actions": [
                {
                  "setVariable": {
                    "variableName": "goodToGo",
                    "value": "true"
                  }
                }
              ]
            },
            {
              "eventName": "beenHere",
              "condition": "true",
              "actions": [
                {
                  "setVariable": {
                    "variableName": "enteringNewState",
                    "value": "false"
                  }
                }
              ]
            }
          ]
        },

        "onInput": {
          "events": [
            {
              "eventName": "whatWasInput",
              "condition": "true",
              "actions": [
                {
                  "setVariable": {
                    "variableName": "sensorId",
                    "value": "$input.temperatureInput.sensorId"
                  }
                },
                {
                  "setVariable": {
                    "variableName": "reportedTemperature",
                    "value": "$input.temperatureInput.sensorData.temperature"
                  }
                }
              ]
            },
            {
              "eventName": "changeDesired",
              "condition": "$input.seedTemperatureInput.desiredTemperature != $variable.desiredTemperature",
              "actions": [
                { 
                  "setVariable": {
                    "variableName": "desiredTemperature",
                    "value": "$input.seedTemperatureInput.desiredTemperature"
                  }
                }
              ]
            },
            {
              "eventName": "calculateAverage",
              "condition": "$input.temperatureInput.sensorData.temperature < $variable.anomalousHigh && $input.temperatureInput.sensorData.temperature > $variable.anomalousLow",
              "actions": [
                {
                  "setVariable": {
                    "variableName": "averageTemperature",
                    "value": "((($variable.averageTemperature * ($variable.sensorCount - 1)) + $input.temperatureInput.sensorData.temperature) / $variable.sensorCount)"
                  }
                }
              ]
            },
            {
              "eventName": "areWeThereYet",
              "condition": "(timeout(\"coolingTimer\"))",
              "actions": [
                {
                  "setVariable": {
                    "variableName": "goodToGo",
                    "value": "true"
                  }
                }
              ]
            }
          ],
          "transitionEvents": [
            {
              "eventName": "anomalousInputArrived",
              "condition": "$input.temperatureInput.sensorData.temperature >= $variable.anomalousHigh || $input.temperatureInput.sensorData.temperature <= $variable.anomalousLow",
              "actions": [
                { 
                  "iotTopicPublish": {
                    "mqttTopic": "temperatureSensor/anomaly"
                  }
                }
              ],
              "nextState": "cooling"
            },

            {
              "eventName": "highTemperatureSpike",
              "condition": "$input.temperatureInput.sensorData.temperature > $variable.rangeHigh",
              "actions": [
                {
                  "iotTopicPublish": {
                    "mqttTopic": "temperatureSensor/spike"
                  }
                }
              ],
              "nextState": "cooling"
            },

            {
              "eventName": "lowTemperatureSpike",
              "condition": "$input.temperatureInput.sensorData.temperature < $variable.rangeLow",
              "actions": [
                {
                  "iotTopicPublish": {
                    "mqttTopic": "temperatureSensor/spike"
                  }
                },
                {
                  "sns": {
                    "targetArn": "arn:aws:sns:us-west-2:123456789012:coolOff"
                  }
                },
                {
                  "sns": {
                    "targetArn": "arn:aws:sns:us-west-2:123456789012:heatOn"
                  }
                },
                {
                  "iotTopicPublish": {
                    "mqttTopic": "hvac/Cooling/Off"
                  }
                },
                {
                  "iotTopicPublish": {
                    "mqttTopic": "hvac/Heating/On"
                  }
                },
                {
                  "setVariable": {
                    "variableName": "enteringNewState",
                    "value": "true"
                  }
                }
              ],
              "nextState": "heating"
            },

            {
              "eventName": "desiredTemperature",
              "condition": "(((($variable.averageTemperature * ($variable.sensorCount - 1)) + $input.temperatureInput.sensorData.temperature) / $variable.sensorCount) <= ($variable.desiredTemperature - $variable.allowedError)) && $variable.goodToGo == true",
              "actions": [
                {
                  "sns": {
                    "targetArn": "arn:aws:sns:us-west-2:123456789012:coolOff"
                  }
                },
                {
                  "iotTopicPublish": {
                    "mqttTopic": "hvac/Cooling/Off"
                  }
                }
              ],
              "nextState": "idle"
            }
          ]
        }
      },


      {
        "stateName": "heating",
        "onEnter": {
          "events": [
            {
              "eventName": "delay",
              "condition": "!$variable.noDelay && $variable.enteringNewState",
              "actions": [
                {
                  "setTimer": {
                    "timerName": "heatingTimer",
                    "seconds": 120
                  }
                },
                {
                  "setVariable": {
                    "variableName": "goodToGo",
                    "value": "false"
                  }
                }
              ]
            },
            {
              "eventName": "dontDelay",
              "condition": "$variable.noDelay == true",
              "actions": [
                {
                  "setVariable": {
                    "variableName": "goodToGo",
                    "value": "true"
                  }
                }
              ]
            },
            {
              "eventName": "beenHere",
              "condition": "true",
              "actions": [
                {
                  "setVariable": {
                    "variableName": "enteringNewState",
                    "value": "false"
                  }
                }
              ]
            }
          ]
        },

        "onInput": {
          "events": [
            {
              "eventName": "whatWasInput",
              "condition": "true",
              "actions": [
                {
                  "setVariable": {
                    "variableName": "sensorId",
                    "value": "$input.temperatureInput.sensorId"
                  }
                },
                {
                  "setVariable": {
                    "variableName": "reportedTemperature",
                    "value": "$input.temperatureInput.sensorData.temperature"
                  }
                }
              ]
            },
            {
              "eventName": "changeDesired",
              "condition": "$input.seedTemperatureInput.desiredTemperature != $variable.desiredTemperature",
              "actions": [
                { 
                  "setVariable": {
                    "variableName": "desiredTemperature",
                    "value": "$input.seedTemperatureInput.desiredTemperature"
                  }
                }
              ]
            },
            {
              "eventName": "calculateAverage",
              "condition": "$input.temperatureInput.sensorData.temperature < $variable.anomalousHigh && $input.temperatureInput.sensorData.temperature > $variable.anomalousLow",
              "actions": [
                {
                  "setVariable": {
                    "variableName": "averageTemperature",
                    "value": "((($variable.averageTemperature * ($variable.sensorCount - 1)) + $input.temperatureInput.sensorData.temperature) / $variable.sensorCount)"
                  }
                }
              ]
            },
            {
              "eventName": "areWeThereYet",
              "condition": "(timeout(\"heatingTimer\"))",
              "actions": [
                {
                  "setVariable": {
                    "variableName": "goodToGo",
                    "value": "true"
                  }
                }
              ]
            }
          ],
          "transitionEvents": [
            {
              "eventName": "anomalousInputArrived",
              "condition": "$input.temperatureInput.sensorData.temperature >= $variable.anomalousHigh || $input.temperatureInput.sensorData.temperature <= $variable.anomalousLow",
              "actions": [
                { 
                  "iotTopicPublish": {
                    "mqttTopic": "temperatureSensor/anomaly"
                  }
                }
              ],
              "nextState": "heating"
            },

            {
              "eventName": "highTemperatureSpike",
              "condition": "$input.temperatureInput.sensorData.temperature > $variable.rangeHigh",
              "actions": [
                {
                  "iotTopicPublish": {
                    "mqttTopic": "temperatureSensor/spike"
                  }
                },
                {
                  "sns": {
                    "targetArn": "arn:aws:sns:us-west-2:123456789012:heatOff"
                  }
                },
                {
                  "sns": {
                    "targetArn": "arn:aws:sns:us-west-2:123456789012:coolOn"
                  }
                },
                {
                  "iotTopicPublish": {
                    "mqttTopic": "hvac/Heating/Off"
                  }
                },
                {
                  "iotTopicPublish": {
                    "mqttTopic": "hvac/Cooling/On"
                  }
                },
                {
                  "setVariable": {
                    "variableName": "enteringNewState",
                    "value": "true"
                  }
                }
              ],
              "nextState": "cooling"
            },

            {
              "eventName": "lowTemperatureSpike",
              "condition": "$input.temperatureInput.sensorData.temperature < $variable.rangeLow",
              "actions": [
                {
                  "iotTopicPublish": {
                    "mqttTopic": "temperatureSensor/spike"
                  }
                }
              ],
              "nextState": "heating"
            },

            {
              "eventName": "desiredTemperature",
              "condition": "(((($variable.averageTemperature * ($variable.sensorCount - 1)) + $input.temperatureInput.sensorData.temperature) / $variable.sensorCount) >= ($variable.desiredTemperature + $variable.allowedError)) && $variable.goodToGo == true",
              "actions": [
                {
                  "sns": {
                    "targetArn": "arn:aws:sns:us-west-2:123456789012:heatOff"
                  }
                },
                {
                  "iotTopicPublish": {
                    "mqttTopic": "hvac/Heating/Off"
                  }
                }
              ],
              "nextState": "idle"
            }
          ]
        }
      } 

    ],

    "initialStateName": "start"
  },
  "key": "areaId",
  "roleArn": "arn:aws:iam::123456789012:role/IoTEventsRole" 
}
```

응답:

```
{
    "detectorModelConfiguration": {
        "status": "ACTIVATING", 
        "lastUpdateTime": 1557523491.168, 
        "roleArn": "arn:aws:iam::123456789012:role/IoTEventsRole", 
        "creationTime": 1557523491.168, 
        "detectorModelArn": "arn:aws:iotevents:us-west-2:123456789012:detectorModel/areaDetectorModel", 
        "key": "areaId", 
        "detectorModelName": "areaDetectorModel", 
        "detectorModelVersion": "1"
    }
}
```

# 의 HVAC 시스템에 대한 BatchPutMessage 예제 AWS IoT Events
<a name="iotevents-examples-hvac-input-usage-examples"></a>

이 예제에서 `BatchPutMessage`은(는) 영역에 대한 감지기 인스턴스를 만들고 초기 작동 파라미터를 정의하는 데 사용됩니다.

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": []
}
```

이 예시에서 `BatchPutMessage`은(는) 영역 내 단일 센서에 대한 온도 센서 판독값을 보고하는 데 사용됩니다.

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": []
}
```

이 예제에서 `BatchPutMessage`은(는) 특정 지역의 원하는 온도를 변경하는 데 사용됩니다.

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": []
}
```

 

`Area51` 감지기 인스턴스에서 생성된 Amazon SNS 메시지의 예:

```
Heating system off command> {
  "eventTime":1557520274729,
  "payload":{
    "actionExecutionId":"f3159081-bac3-38a4-96f7-74af0940d0a4",
    "detector":{
      "detectorModelName":"areaDetectorModel",
      "keyValue":"Area51",
      "detectorModelVersion":"1"
    },
    "eventTriggerDetails":{
      "inputName":"seedTemperatureInput",
      "messageId":"00001",
      "triggerType":"Message"
    },
    "state":{
      "stateName":"start",
      "variables":{
        "sensorCount":10,
        "rangeHigh":30.0,
        "resetMe":false,
        "enteringNewState":true,
        "averageTemperature":20.0,
        "rangeLow":15.0,
        "noDelay":false,
        "allowedError":0.7,
        "desiredTemperature":20.0,
        "anomalousHigh":60.0,
        "reportedTemperature":0.1,
        "anomalousLow":0.0,
        "sensorId":0
      },
      "timers":{}
    }
  },
  "eventName":"resetHeatCool"
}
```

```
Cooling system off command> {
  "eventTime":1557520274729,
  "payload":{
    "actionExecutionId":"98f6a1b5-8f40-3cdb-9256-93afd4d66192",
    "detector":{
      "detectorModelName":"areaDetectorModel",
      "keyValue":"Area51",
      "detectorModelVersion":"1"
    },
    "eventTriggerDetails":{
      "inputName":"seedTemperatureInput",
      "messageId":"00001",
      "triggerType":"Message"
    },
    "state":{
      "stateName":"start",
      "variables":{
        "sensorCount":10,
        "rangeHigh":30.0,
        "resetMe":false,
        "enteringNewState":true,
        "averageTemperature":20.0,
        "rangeLow":15.0,
        "noDelay":false,
        "allowedError":0.7,
        "desiredTemperature":20.0,
        "anomalousHigh":60.0,
        "reportedTemperature":0.1,
        "anomalousLow":0.0,
        "sensorId":0
      },
      "timers":{}
    }
  },
  "eventName":"resetHeatCool"
}
```

이 예시에서는 `DescribeDetector` API를 사용하여 감지기 인스턴스의 현재 상태에 대한 정보를 가져옵니다.

```
aws iotevents-data describe-detector --detector-model-name areaDetectorModel --key-value Area51
```

응답:

```
{
    "detector": {
        "lastUpdateTime": 1557521572.216, 
        "creationTime": 1557520274.405, 
        "state": {
            "variables": [
                {
                    "name": "resetMe", 
                    "value": "false"
                }, 
                {
                    "name": "rangeLow", 
                    "value": "15.0"
                }, 
                {
                    "name": "noDelay", 
                    "value": "false"
                }, 
                {
                    "name": "desiredTemperature", 
                    "value": "20.0"
                }, 
                {
                    "name": "anomalousLow", 
                    "value": "0.0"
                }, 
                {
                    "name": "sensorId", 
                    "value": "\"01\""
                }, 
                {
                    "name": "sensorCount", 
                    "value": "10"
                }, 
                {
                    "name": "rangeHigh", 
                    "value": "30.0"
                }, 
                {
                    "name": "enteringNewState", 
                    "value": "false"
                }, 
                {
                    "name": "averageTemperature", 
                    "value": "19.572"
                }, 
                {
                    "name": "allowedError", 
                    "value": "0.7"
                }, 
                {
                    "name": "anomalousHigh", 
                    "value": "60.0"
                }, 
                {
                    "name": "reportedTemperature", 
                    "value": "15.72"
                }, 
                {
                    "name": "goodToGo", 
                    "value": "false"
                }
            ], 
            "stateName": "idle", 
            "timers": [
                {
                    "timestamp": 1557520454.0, 
                    "name": "idleTimer"
                }
            ]
        }, 
        "keyValue": "Area51", 
        "detectorModelName": "areaDetectorModel", 
        "detectorModelVersion": "1"
    }
}
```

# 의 HVAC 시스템에 대한 BatchUpdateDetector 예제 AWS IoT Events
<a name="iotevents-examples-hvac-batch-update-detector"></a>

이 예시에서 `BatchUpdateDetector`은(는) 작동 중인 감지기 인스턴스의 작동 파라미터를 변경하는 데 사용됩니다.

효율적인 HVAC 시스템 관리에는 여러 탐지기에 대한 배치 업데이트가 필요한 경우가 많습니다. 이 섹션에서는 감지기에 AWS IoT Events의 배치 업데이트 기능을 사용하는 방법을 보여줍니다. 여러 제어 파라미터를 동시에 수정하고 임계값을 업데이트하여 디바이스 플릿에서 응답 작업을 조정하여 대규모 시스템을 효과적으로 관리하는 기능을 개선하는 방법을 알아봅니다.

CLI 명령은 다음을 사용합니다.

```
aws iotevents-data batch-update-detector --cli-input-json file://areaDM.BUD.json
```

파일: `areaDM.BUD.json`

```
{
  "detectors": [
    {
      "messageId": "0001",
      "detectorModelName": "areaDetectorModel",
      "keyValue": "Area51",
      "state": {
        "stateName": "start",
        "variables": [
          {
            "name": "desiredTemperature",
            "value": "22"
          },
          {
            "name": "averageTemperature",
            "value": "22"
          },
          {
            "name": "allowedError",
            "value": "1.0"
          },
          {
            "name": "rangeHigh",
            "value": "30.0"
          },
          {
            "name": "rangeLow",
            "value": "15.0"
          },
          {
            "name": "anomalousHigh",
            "value": "60.0"
          },
          {
            "name": "anomalousLow",
            "value": "0.0"
          },
          {
            "name": "sensorCount",
            "value": "12"
          },
          {
            "name": "noDelay",
            "value": "true"
          },
          {
            "name": "goodToGo",
            "value": "true"
          },
          {
            "name": "sensorId",
            "value": "0"
          },
          {
            "name": "reportedTemperature",
            "value": "0.1"
          },
          {
            "name": "resetMe",
            "value": "true"
          }
        ],
        "timers": [
        ]
      }
    }
  ]
}
```

응답:

```
{
    An error occurred (InvalidRequestException) when calling the BatchUpdateDetector operation: Number of variables in the detector exceeds the limit 10
}
```

# AWS IoT Core 규칙 엔진 및 AWS IoT Events
<a name="iotevents-examples-hvac-iot-rules-examples"></a>

다음 규칙은 AWS IoT Events MQTT 메시지를 섀도우 업데이트 요청 메시지로 다시 게시합니다. 감지기 모델에 의해 제어되는 각 영역의 난방 장치 및 냉각 장치에 AWS IoT Core 사물이 정의되어 있다고 가정합니다.

이 예제에서는 이름이 `Area51HeatingUnit` 및 `Area51CoolingUnit`인 항목을 정의했습니다.

CLI 명령은 다음을 사용합니다.

```
aws iot create-topic-rule --cli-input-json file://ADMShadowCoolOffRule.json
```

파일: `ADMShadowCoolOffRule.json`

```
{
  "ruleName": "ADMShadowCoolOff",
  "topicRulePayload": {
    "sql": "SELECT topic(3) as state.desired.command FROM 'hvac/Cooling/Off'",
    "description": "areaDetectorModel mqtt topic publish to cooling unit shadow request",
    "ruleDisabled": false,
    "awsIotSqlVersion": "2016-03-23",
    "actions": [
      {
        "republish": {
          "topic": "$$aws/things/${payload.detector.keyValue}CoolingUnit/shadow/update",
          "roleArn": "arn:aws:iam::123456789012:role/service-role/ADMShadowRole" 
        }
      }
    ]
  }
}
```

응답: [비어 있음]

CLI 명령은 다음을 사용합니다.

```
aws iot create-topic-rule --cli-input-json file://ADMShadowCoolOnRule.json
```

파일: `ADMShadowCoolOnRule.json`

```
{
  "ruleName": "ADMShadowCoolOn",
  "topicRulePayload": {
    "sql": "SELECT topic(3) as state.desired.command FROM 'hvac/Cooling/On'",
    "description": "areaDetectorModel mqtt topic publish to cooling unit shadow request",
    "ruleDisabled": false,
    "awsIotSqlVersion": "2016-03-23",
    "actions": [
      {
        "republish": {
          "topic": "$$aws/things/${payload.detector.keyValue}CoolingUnit/shadow/update",
          "roleArn": "arn:aws:iam::123456789012:role/service-role/ADMShadowRole" 
        }
      }
    ]
  }
}
```

응답: [비어 있음]

CLI 명령은 다음을 사용합니다.

```
aws iot create-topic-rule --cli-input-json file://ADMShadowHeatOffRule.json
```

파일: `ADMShadowHeatOffRule.json`

```
{
  "ruleName": "ADMShadowHeatOff",
  "topicRulePayload": {
    "sql": "SELECT topic(3) as state.desired.command FROM 'hvac/Heating/Off'",
    "description": "areaDetectorModel mqtt topic publish to heating unit shadow request",
    "ruleDisabled": false,
    "awsIotSqlVersion": "2016-03-23",
    "actions": [
      {
        "republish": {
          "topic": "$$aws/things/${payload.detector.keyValue}HeatingUnit/shadow/update",
          "roleArn": "arn:aws:iam::123456789012:role/service-role/ADMShadowRole" 
        }
      }
    ]
  }
}
```

응답: [비어 있음]

CLI 명령은 다음을 사용합니다.

```
aws iot create-topic-rule --cli-input-json file://ADMShadowHeatOnRule.json
```

파일: `ADMShadowHeatOnRule.json`

```
{
  "ruleName": "ADMShadowHeatOn",
  "topicRulePayload": {
    "sql": "SELECT topic(3) as state.desired.command FROM 'hvac/Heating/On'",
    "description": "areaDetectorModel mqtt topic publish to heating unit shadow request",
    "ruleDisabled": false,
    "awsIotSqlVersion": "2016-03-23",
    "actions": [
      {
        "republish": {
          "topic": "$$aws/things/${payload.detector.keyValue}HeatingUnit/shadow/update",
          "roleArn": "arn:aws:iam::123456789012:role/service-role/ADMShadowRole" 
        }
      }
    ]
  }
}
```

응답: [비어 있음]

# 예:를 사용하여 조건을 감지하는 크레인 AWS IoT Events
<a name="iotevents-examples-cranes"></a>

많은 크레인 운전자는 기계의 유지 보수 또는 교체가 필요한 시기를 감지하여 적절한 알림을 트리거하고자 합니다. 각 크레인에는 모터가 있습니다. 모터는 압력과 온도에 대한 정보가 포함된 메시지(입력)를 내보냅니다. 운영자는 두 가지 수준의 이벤트 감지기를 원합니다.
+ 크레인 수준의 이벤트 감지기
+ 모터 수준의 이벤트 감지기

운영자는 모터의 메시지(`craneId` 및 `motorid`가 모두 포함된 메타데이터 포함)를 사용하여 적절한 라우팅을 통해 두 수준의 이벤트 감지기를 모두 실행할 수 있습니다. 이벤트 조건이 충족되면 적절한 Amazon SNS 주제로 알림을 보내야 합니다. 운영자는 알림이 중복되지 않도록 감지기 모델을 구성할 수 있습니다.

이 예제는 다음과 같은 기능을 보여줍니다.
+ 입력 생성, 읽기, 업데이트, 삭제(CRUD)
+ 이벤트 감지기 모델 및 다양한 버전의 이벤트 감지기 생성, 읽기, 업데이트, 삭제(CRUD)
+ 하나의 입력을 여러 이벤트 감지기로 라우팅합니다.
+ 감지기 모델로의 입력
+ 트리거 조건 및 라이프사이클 이벤트 평가.
+ 조건의 상태 변수를 참조하고 조건에 따라 해당 값을 설정할 수 있습니다.
+ 정의, 상태, 트리거 평가자 및 작업 실행자를 사용한 런타임 오케스트레이션.
+ SNS 타겟을 사용한 `ActionsExecutor`의 작업 실행.

# 에서 감지된 조건에 대한 응답으로 명령 전송 AWS IoT Events
<a name="iotevents-examples-cranes-commands"></a>

이 페이지에서는 AWS IoT Events 명령을 사용하여 입력을 설정하고, 감지기 모델을 생성하고, 시뮬레이션된 센서 데이터를 전송하는 예를 제공합니다. 이 예제에서는를 AWS IoT Events 사용하여 모터 및 크레인과 같은 산업 장비를 모니터링하는 방법을 보여줍니다.

```
#Create Pressure Input
aws iotevents create-input  --cli-input-json file://pressureInput.json
aws iotevents describe-input --input-name PressureInput 
aws iotevents update-input  --cli-input-json file://pressureInput.json
aws iotevents list-inputs
aws iotevents delete-input --input-name PressureInput

#Create Temperature Input
aws iotevents create-input  --cli-input-json file://temperatureInput.json
aws iotevents describe-input --input-name TemperatureInput 
aws iotevents update-input  --cli-input-json file://temperatureInput.json
aws iotevents list-inputs
aws iotevents delete-input --input-name TemperatureInput

#Create Motor Event Detector using pressure and temperature input
aws iotevents create-detector-model  --cli-input-json file://motorDetectorModel.json
aws iotevents describe-detector-model --detector-model-name motorDetectorModel 
aws iotevents update-detector-model  --cli-input-json file://updateMotorDetectorModel.json
aws iotevents list-detector-models
aws iotevents list-detector-model-versions --detector-model-name motorDetectorModel 
aws iotevents delete-detector-model --detector-model-name motorDetectorModel

#Create Crane Event Detector using temperature input
aws iotevents create-detector-model  --cli-input-json file://craneDetectorModel.json
aws iotevents describe-detector-model --detector-model-name craneDetectorModel 
aws iotevents update-detector-model  --cli-input-json file://updateCraneDetectorModel.json
aws iotevents list-detector-models
aws iotevents list-detector-model-versions --detector-model-name craneDetectorModel 
aws iotevents delete-detector-model --detector-model-name craneDetectorModel

#Replace craneIds
sed -i '' "s/100008/100009/g" messages/* 

#Replace motorIds
sed -i '' "s/200008/200009/g" messages/* 

#Send HighPressure message
aws iotevents-data batch-put-message --cli-input-json file://messages/highPressureMessage.json --cli-binary-format raw-in-base64-out

#Send HighTemperature message
aws iotevents-data batch-put-message --cli-input-json file://messages/highTemperatureMessage.json --cli-binary-format raw-in-base64-out

#Send LowPressure message
aws iotevents-data batch-put-message --cli-input-json file://messages/lowPressureMessage.json --cli-binary-format raw-in-base64-out

#Send LowTemperature message
aws iotevents-data batch-put-message --cli-input-json file://messages/lowTemperatureMessage.json --cli-binary-format raw-in-base64-out
```

# 크레인 모니터링을 위한 AWS IoT Events 감지기 모델
<a name="iotevents-examples-cranes-detector-models"></a>

장비 또는 디바이스 플릿의 장애 또는 작동 변경을 모니터링하고 이러한 이벤트가 발생할 때 작업을 트리거합니다. 상태, 규칙 및 작업을 지정하는 감지기 모델을 JSON으로 정의합니다. 이를 통해 온도 및 압력과 같은 입력을 모니터링하고, 임계값 위반을 추적하고, 알림을 보낼 수 있습니다. 이 예제는 크레인 및 모터에 대한 감지기 모델을 보여 주며, 과열 문제를 감지하고 임계값이 초과되면 Amazon SNS에서 알립니다. 모델을 업데이트하여 모니터링을 중단하지 않고 동작을 세분화할 수 있습니다.

파일: `craneDetectorModel.json`

```
{
    "detectorModelName": "craneDetectorModel",
    "detectorModelDefinition": {
        "states": [
            {
                "stateName": "Running",
                "onEnter": {
                    "events": [
                        {
                            "eventName": "init",
                            "condition": "true",
                            "actions": [
                                {
                                    "setVariable": {
                                        "variableName": "craneThresholdBreached",
                                        "value": "0"
                                    }
                                }
                            ]
                        }
                    ]
                },
                "onInput": {
                    "events": [
                        {
                            "eventName": "Overheated",
                            "condition": "$input.TemperatureInput.temperature > 35",
                            "actions": [
                                {
                                    "setVariable": {
                                        "variableName": "craneThresholdBreached",
                                        "value": "$variable.craneThresholdBreached + 1"
                                    }
                                }
                            ]
                        },
                        {
                            "eventName": "Crane Threshold Breached",
                            "condition": "$variable.craneThresholdBreached > 5",
                            "actions": [
                                {
                                    "sns": {
                                        "targetArn": "arn:aws:sns:us-east-1:123456789012:CraneSNSTopic"
                                    }
                                }
                            ]
                        },
                        {
                            "eventName": "Underheated",
                            "condition": "$input.TemperatureInput.temperature < 25",
                            "actions": [
                                {
                                    "setVariable": {
                                        "variableName": "craneThresholdBreached",
                                        "value": "0"
                                    }
                                }
                            ]
                        }
                    ]
                }
            }
        ],
        "initialStateName": "Running"
    },
    "key": "craneid",
    "roleArn": "arn:aws:iam::123456789012:role/columboSNSRole"
}
```

기존 감지기 모델을 업데이트하려면. 파일: `updateCraneDetectorModel.json`

```
{
    "detectorModelName": "craneDetectorModel",
    "detectorModelDefinition": {
        "states": [
            {
                "stateName": "Running",
                "onEnter": {
                    "events": [
                        {
                            "eventName": "init",
                            "condition": "true",
                            "actions": [
                                {
                                    "setVariable": {
                                        "variableName": "craneThresholdBreached",
                                        "value": "0"
                                    }
                                },
                                {
                                    "setVariable": {
                                        "variableName": "alarmRaised",
                                        "value": "'false'"
                                    }
                                }
                            ]
                        }
                    ]
                },
                "onInput": {
                    "events": [
                        {
                            "eventName": "Overheated",
                            "condition": "$input.TemperatureInput.temperature > 30",
                            "actions": [
                                {
                                    "setVariable": {
                                        "variableName": "craneThresholdBreached",
                                        "value": "$variable.craneThresholdBreached + 1"
                                    }
                                }
                            ]
                        },
                        {
                            "eventName": "Crane Threshold Breached",
                            "condition": "$variable.craneThresholdBreached > 5 && $variable.alarmRaised == 'false'",
                            "actions": [
                                {
                                    "sns": {
                                        "targetArn": "arn:aws:sns:us-east-1:123456789012:CraneSNSTopic"
                                    }
                                },
                                {
                                    "setVariable": {
                                        "variableName": "alarmRaised",
                                        "value": "'true'"
                                    }
                                }
                            ]
                        },
                        {
                            "eventName": "Underheated",
                            "condition": "$input.TemperatureInput.temperature < 10",
                            "actions": [
                                {
                                    "setVariable": {
                                        "variableName": "craneThresholdBreached",
                                        "value": "0"
                                    }
                                }
                            ]
                        }
                    ]
                }
            }
        ],
        "initialStateName": "Running"
    },
    "roleArn": "arn:aws:iam::123456789012:role/columboSNSRole"
}
```

파일: `motorDetectorModel.json`

```
{
    "detectorModelName": "motorDetectorModel",
    "detectorModelDefinition": {
        "states": [
            {
                "stateName": "Running",
                "onEnter": {
                    "events": [
                        {
                            "eventName": "init",
                            "condition": "true",
                            "actions": [
                                {
                                    "setVariable": {
                                        "variableName": "motorThresholdBreached",
                                        "value": "0"
                                    }
                                }
                            ]
                        }
                    ]
                },
                "onInput": {
                    "events": [
                        {
                            "eventName": "Overheated And Overpressurized",
                            "condition": "$input.PressureInput.pressure > 70 && $input.TemperatureInput.temperature > 30",
                            "actions": [
                                {
                                    "setVariable": {
                                        "variableName": "motorThresholdBreached",
                                        "value": "$variable.motorThresholdBreached + 1"
                                    }
                                }
                            ]
                        },
                        {
                            "eventName": "Motor Threshold Breached",
                            "condition": "$variable.motorThresholdBreached > 5",
                            "actions": [
                                {
                                    "sns": {
                                        "targetArn": "arn:aws:sns:us-east-1:123456789012:MotorSNSTopic"
                                    }
                                }
                            ]
                        }
                    ]
                }
            }
        ],
        "initialStateName": "Running"
    },
    "key": "motorId",
    "roleArn": "arn:aws:iam::123456789012:role/columboSNSRole"
}
```

기존 감지기 모델을 업데이트하려면. 파일: `updateMotorDetectorModel.json`

```
{
    "detectorModelName": "motorDetectorModel",
    "detectorModelDefinition": {
        "states": [
            {
                "stateName": "Running",
                "onEnter": {
                    "events": [
                        {
                            "eventName": "init",
                            "condition": "true",
                            "actions": [
                                {
                                    "setVariable": {
                                        "variableName": "motorThresholdBreached",
                                        "value": "0"
                                    }
                                }
                            ]
                        }
                    ]
                },
                "onInput": {
                    "events": [
                        {
                            "eventName": "Overheated And Overpressurized",
                            "condition": "$input.PressureInput.pressure > 70 && $input.TemperatureInput.temperature > 30",
                            "actions": [
                                {
                                    "setVariable": {
                                        "variableName": "motorThresholdBreached",
                                        "value": "$variable.motorThresholdBreached + 1"
                                    }
                                }
                            ]
                        },
                        {
                            "eventName": "Motor Threshold Breached",
                            "condition": "$variable.motorThresholdBreached > 5",
                            "actions": [
                                {
                                    "sns": {
                                        "targetArn": "arn:aws:sns:us-east-1:123456789012:MotorSNSTopic"
                                    }
                                }
                            ]
                        }
                    ]
                }
            }
        ],
        "initialStateName": "Running"
    },
    "roleArn": "arn:aws:iam::123456789012:role/columboSNSRole"
}
```

# AWS IoT Events 크레인 모니터링을 위한 입력
<a name="iotevents-examples-cranes-inputs"></a>

이 예제에서는를 사용하여 크레인 모니터링 시스템에 대한 입력을 설정하는 방법을 보여줍니다 AWS IoT Events. 압력 및 온도 입력을 캡처하여 복잡한 산업 장비 모니터링을 위한 입력을 구성하는 방법을 보여줍니다.

파일: `pressureInput.json`

```
{
    "inputName": "PressureInput",
    "inputDescription": "this is a pressure input description",
    "inputDefinition": {
        "attributes": [
          {"jsonPath": "pressure"}
        ]
    }
}
```

파일: `temperatureInput.json`

```
{
    "inputName": "TemperatureInput",
    "inputDescription": "this is temperature input description",
    "inputDefinition": {
        "attributes": [
            {"jsonPath": "temperature"}
        ]
    }
}
```

# 를 사용하여 경보 및 운영 메시지 전송 AWS IoT Events
<a name="iotevents-examples-cranes-messages"></a>

크레인 모니터링 시스템에서는 효과적인 메시지 처리가 중요합니다. 이 섹션에서는 크레인 센서의 다양한 메시지 유형을 처리하고 이에 응답 AWS IoT Events 하도록를 구성하는 방법을 보여줍니다. 특정 메시지를 기반으로 경보를 설정하면 상태 업데이트를 구문 분석, 필터링 및 라우팅하여 적절한 작업을 트리거하는 데 도움이 될 수 있습니다.

파일: `highPressureMessage.json`

```
{
   "messages": [
        {
           "messageId": "1",
           "inputName": "PressureInput",
           "payload": "{\"craneid\": \"100009\", \"pressure\": 80, \"motorid\": \"200009\"}"

        }
    ]
}
```

파일: `highTemperatureMessage.json` 

```
{
   "messages": [
        {
           "messageId": "2",
           "inputName": "TemperatureInput",
           "payload": "{\"craneid\": \"100009\", \"temperature\": 40, \"motorid\": \"200009\"}"
        }
    ]
}
```

파일: `lowPressureMessage.json` 

```
{
   "messages": [
        {
           "messageId": "1",
           "inputName": "PressureInput",
           "payload": "{\"craneid\": \"100009\", \"pressure\": 20, \"motorid\": \"200009\"}"
        }
    ]
}
```

파일: `lowTemperatureMessage.json` 

```
{
   "messages": [
        {
           "messageId": "2",
           "inputName": "TemperatureInput",
           "payload": "{\"craneid\": \"100009\", \"temperature\": 20, \"motorid\": \"200009\"}"
        }
    ]
}
```

# 예: 센서 및 애플리케이션을 사용한 AWS IoT Events 이벤트 감지
<a name="iotevents-examples-edwsaa"></a>

이 감지기 모델은 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"
    }
}
```

# 예: 와의 디바이스 연결을 모니터링하기 위한 디바이스 HeartBeat AWS IoT Events
<a name="iotevents-examples-dhb"></a>

이 감지기 모델은 AWS IoT Events 콘솔에서 사용할 수 있는 템플릿 중 하나입니다. 편의를 위해 여기에도 포함되어 있습니다.

Defective Heart Beat(DHB) 예제에서는 AWS IoT Events 를 의료 모니터링에 사용하는 방법을 보여줍니다. 이 예제에서는 심박수 데이터를 분석하고, 불규칙한 패턴을 감지하고, 적절한 응답을 트리거하는 감지기 모델을 생성하는 방법을 보여줍니다. 입력을 설정하고, 임계값을 정의하고, 잠재적 심장 문제에 대한 알림을 구성하여 관련 의료 애플리케이션에서 AWS IoT Events의 다양성을 보여주는 방법을 알아봅니다.

```
{
    "detectorModelDefinition": {
        "states": [
            {
                "onInput": {
                    "transitionEvents": [
                        {
                            "eventName": "To_normal",
                            "actions": [],
                            "condition": "currentInput(\"AWS_IoTEvents_Blueprints_Heartbeat_Input\")",
                            "nextState": "Normal"
                        }
                    ],
                    "events": []
                },
                "stateName": "Offline",
                "onEnter": {
                    "events": [
                        {
                            "eventName": "Send_notification",
                            "actions": [
                                {
                                    "sns": {
                                        "targetArn": "sns-topic-arn"
                                    }
                                }
                            ],
                            "condition": "true"
                        }
                    ]
                },
                "onExit": {
                    "events": []
                }
            },
            {
                "onInput": {
                    "transitionEvents": [
                        {
                            "eventName": "Go_offline",
                            "actions": [],
                            "condition": "timeout(\"awake\")",
                            "nextState": "Offline"
                        }
                    ],
                    "events": [
                        {
                            "eventName": "Reset_timer",
                            "actions": [
                                {
                                    "resetTimer": {
                                        "timerName": "awake"
                                    }
                                }
                            ],
                            "condition": "currentInput(\"AWS_IoTEvents_Blueprints_Heartbeat_Input\")"
                        }
                    ]
                },
                "stateName": "Normal",
                "onEnter": {
                    "events": [
                        {
                            "eventName": "Create_timer",
                            "actions": [
                                {
                                    "setTimer": {
                                        "seconds": 300,
                                        "timerName": "awake"
                                    }
                                }
                            ],
                            "condition": "$input.AWS_IoTEvents_Blueprints_Heartbeat_Input.value > 0"
                        }
                    ]
                },
                "onExit": {
                    "events": []
                }
            }
        ],
        "initialStateName": "Normal"
    }
}
```

# 예:의 ISA 경보 AWS IoT Events
<a name="iotevents-examples-bisaa"></a>

이 감지기 모델은 AWS IoT Events 콘솔에서 사용할 수 있는 템플릿 중 하나입니다. 편의를 위해 여기에도 포함되어 있습니다.

```
{
    "detectorModelName": "AWS_IoTEvents_Blueprints_ISA_Alarm", 
    "detectorModelDefinition": {
        "states": [
            {
                "onInput": {
                    "transitionEvents": [
                        {
                            "eventName": "unshelve", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"unshelve\" && $variable.state == \"rtnunack\"", 
                            "nextState": "RTN_Unacknowledged"
                        }, 
                        {
                            "eventName": "unshelve", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"unshelve\" && $variable.state == \"ack\"", 
                            "nextState": "Acknowledged"
                        }, 
                        {
                            "eventName": "unshelve", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"unshelve\" && $variable.state == \"unack\"", 
                            "nextState": "Unacknowledged"
                        }, 
                        {
                            "eventName": "unshelve", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"unshelve\" && $variable.state == \"normal\"", 
                            "nextState": "Normal"
                        }
                    ], 
                    "events": []
                }, 
                "stateName": "Shelved", 
                "onEnter": {
                    "events": []
                }, 
                "onExit": {
                    "events": []
                }
            }, 
            {
                "onInput": {
                    "transitionEvents": [
                        {
                            "eventName": "abnormal_condition", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.value > $variable.higher_threshold || $input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.value < $variable.lower_threshold", 
                            "nextState": "Unacknowledged"
                        }, 
                        {
                            "eventName": "acknowledge", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"acknowledge\"", 
                            "nextState": "Normal"
                        }, 
                        {
                            "eventName": "shelve", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"shelve\"", 
                            "nextState": "Shelved"
                        }, 
                        {
                            "eventName": "remove_from_service", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"remove\"", 
                            "nextState": "Out_of_service"
                        }, 
                        {
                            "eventName": "suppression", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"suppressed\"", 
                            "nextState": "Suppressed_by_design"
                        }
                    ], 
                    "events": []
                }, 
                "stateName": "RTN_Unacknowledged", 
                "onEnter": {
                    "events": [
                        {
                            "eventName": "State Save", 
                            "actions": [
                                {
                                    "setVariable": {
                                        "variableName": "state", 
                                        "value": "\"rtnunack\""
                                    }
                                }
                            ], 
                            "condition": "true"
                        }
                    ]
                }, 
                "onExit": {
                    "events": []
                }
            }, 
            {
                "onInput": {
                    "transitionEvents": [
                        {
                            "eventName": "abnormal_condition", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.value > $variable.higher_threshold || $input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.value < $variable.lower_threshold", 
                            "nextState": "Unacknowledged"
                        }, 
                        {
                            "eventName": "shelve", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"shelve\"", 
                            "nextState": "Shelved"
                        }, 
                        {
                            "eventName": "remove_from_service", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"remove\"", 
                            "nextState": "Out_of_service"
                        }, 
                        {
                            "eventName": "suppression", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"suppressed\"", 
                            "nextState": "Suppressed_by_design"
                        }
                    ], 
                    "events": [
                        {
                            "eventName": "Create Config variables", 
                            "actions": [
                                {
                                    "setVariable": {
                                        "variableName": "lower_threshold", 
                                        "value": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.lower_threshold"
                                    }
                                }, 
                                {
                                    "setVariable": {
                                        "variableName": "higher_threshold", 
                                        "value": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.higher_threshold"
                                    }
                                }
                            ], 
                            "condition": "$variable.lower_threshold != $variable.lower_threshold"
                        }
                    ]
                }, 
                "stateName": "Normal", 
                "onEnter": {
                    "events": [
                        {
                            "eventName": "State Save", 
                            "actions": [
                                {
                                    "setVariable": {
                                        "variableName": "state", 
                                        "value": "\"normal\""
                                    }
                                }
                            ], 
                            "condition": "true"
                        }
                    ]
                }, 
                "onExit": {
                    "events": []
                }
            }, 
            {
                "onInput": {
                    "transitionEvents": [
                        {
                            "eventName": "acknowledge", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"acknowledge\"", 
                            "nextState": "Acknowledged"
                        }, 
                        {
                            "eventName": "return_to_normal", 
                            "actions": [], 
                            "condition": "($input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.value <= $variable.higher_threshold && $input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.value >= $variable.lower_threshold)", 
                            "nextState": "RTN_Unacknowledged"
                        }, 
                        {
                            "eventName": "shelve", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"shelve\"", 
                            "nextState": "Shelved"
                        }, 
                        {
                            "eventName": "remove_from_service", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"remove\"", 
                            "nextState": "Out_of_service"
                        }, 
                        {
                            "eventName": "suppression", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"suppressed\"", 
                            "nextState": "Suppressed_by_design"
                        }
                    ], 
                    "events": []
                }, 
                "stateName": "Unacknowledged", 
                "onEnter": {
                    "events": [
                        {
                            "eventName": "State Save", 
                            "actions": [
                                {
                                    "setVariable": {
                                        "variableName": "state", 
                                        "value": "\"unack\""
                                    }
                                }
                            ], 
                            "condition": "true"
                        }
                    ]
                }, 
                "onExit": {
                    "events": []
                }
            }, 
            {
                "onInput": {
                    "transitionEvents": [
                        {
                            "eventName": "unsuppression", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"unsuppressed\" && $variable.state == \"normal\"", 
                            "nextState": "Normal"
                        }, 
                        {
                            "eventName": "unsuppression", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"unsuppressed\" && $variable.state == \"unack\"", 
                            "nextState": "Unacknowledged"
                        }, 
                        {
                            "eventName": "unsuppression", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"unsuppressed\" && $variable.state == \"ack\"", 
                            "nextState": "Acknowledged"
                        }, 
                        {
                            "eventName": "unsuppression", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"unsuppressed\" && $variable.state == \"rtnunack\"", 
                            "nextState": "RTN_Unacknowledged"
                        }
                    ], 
                    "events": []
                }, 
                "stateName": "Suppressed_by_design", 
                "onEnter": {
                    "events": []
                }, 
                "onExit": {
                    "events": []
                }
            }, 
            {
                "onInput": {
                    "transitionEvents": [
                        {
                            "eventName": "return_to_service", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"add\" && $variable.state == \"rtnunack\"", 
                            "nextState": "RTN_Unacknowledged"
                        }, 
                        {
                            "eventName": "return_to_service", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"add\" && $variable.state == \"unack\"", 
                            "nextState": "Unacknowledged"
                        }, 
                        {
                            "eventName": "return_to_service", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"add\" && $variable.state == \"ack\"", 
                            "nextState": "Acknowledged"
                        }, 
                        {
                            "eventName": "return_to_service", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"add\" && $variable.state == \"normal\"", 
                            "nextState": "Normal"
                        }
                    ], 
                    "events": []
                }, 
                "stateName": "Out_of_service", 
                "onEnter": {
                    "events": []
                }, 
                "onExit": {
                    "events": []
                }
            }, 
            {
                "onInput": {
                    "transitionEvents": [
                        {
                            "eventName": "re-alarm", 
                            "actions": [], 
                            "condition": "timeout(\"snooze\")", 
                            "nextState": "Unacknowledged"
                        }, 
                        {
                            "eventName": "return_to_normal", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"reset\"", 
                            "nextState": "Normal"
                        }, 
                        {
                            "eventName": "shelve", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"shelve\"", 
                            "nextState": "Shelved"
                        }, 
                        {
                            "eventName": "remove_from_service", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"remove\"", 
                            "nextState": "Out_of_service"
                        }, 
                        {
                            "eventName": "suppression", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_ISA_Alarm_Input.command == \"suppressed\"", 
                            "nextState": "Suppressed_by_design"
                        }
                    ], 
                    "events": []
                }, 
                "stateName": "Acknowledged", 
                "onEnter": {
                    "events": [
                        {
                            "eventName": "Create Timer", 
                            "actions": [
                                {
                                    "setTimer": {
                                        "seconds": 60, 
                                        "timerName": "snooze"
                                    }
                                }
                            ], 
                            "condition": "true"
                        }, 
                        {
                            "eventName": "State Save", 
                            "actions": [
                                {
                                    "setVariable": {
                                        "variableName": "state", 
                                        "value": "\"ack\""
                                    }
                                }
                            ], 
                            "condition": "true"
                        }
                    ]
                }, 
                "onExit": {
                    "events": []
                }
            }
        ], 
        "initialStateName": "Normal"
    },
    "detectorModelDescription": "This detector model is used to detect if a monitored device is in an Alarming State in accordance to the ISA 18.2.", 
    "roleArn": "arn:aws:iam::123456789012:role/IoTEventsRole", 
    "key": "alarmId" 
}
```

# 예:를 사용하여 간단한 경보 빌드 AWS IoT Events
<a name="iotevents-examples-bsa"></a>

이 감지기 모델은 AWS IoT Events 콘솔에서 사용할 수 있는 템플릿 중 하나입니다. 편의를 위해 여기에도 포함되어 있습니다.

```
{
    "detectorModelDefinition": {
        "states": [
            {
                "onInput": {
                    "transitionEvents": [
                        {
                            "eventName": "not_fixed", 
                            "actions": [], 
                            "condition": "timeout(\"snoozeTime\")", 
                            "nextState": "Alarming"
                        }, 
                        {
                            "eventName": "reset", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_Simple_Alarm_Input.command == \"reset\"", 
                            "nextState": "Normal"
                        }
                    ], 
                    "events": [
                        {
                            "eventName": "DND", 
                            "actions": [
                                {
                                    "setVariable": {
                                        "variableName": "dnd_active", 
                                        "value": "1"
                                    }
                                }
                            ], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_Simple_Alarm_Input.command == \"dnd\""
                        }
                    ]
                }, 
                "stateName": "Snooze", 
                "onEnter": {
                    "events": [
                        {
                            "eventName": "Create Timer", 
                            "actions": [
                                {
                                    "setTimer": {
                                        "seconds": 120, 
                                        "timerName": "snoozeTime"
                                    }
                                }
                            ], 
                            "condition": "true"
                        }
                    ]
                }, 
                "onExit": {
                    "events": []
                }
            }, 
            {
                "onInput": {
                    "transitionEvents": [
                        {
                            "eventName": "out_of_range", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_Simple_Alarm_Input.value > $variable.threshold", 
                            "nextState": "Alarming"
                        }
                    ], 
                    "events": [
                        {
                            "eventName": "Create Config variables", 
                            "actions": [
                                {
                                    "setVariable": {
                                        "variableName": "threshold", 
                                        "value": "$input.AWS_IoTEvents_Blueprints_Simple_Alarm_Input.threshold"
                                    }
                                }
                            ], 
                            "condition": "$variable.threshold != $variable.threshold"
                        }
                    ]
                }, 
                "stateName": "Normal", 
                "onEnter": {
                    "events": [
                        {
                            "eventName": "Init", 
                            "actions": [
                                {
                                    "setVariable": {
                                        "variableName": "dnd_active", 
                                        "value": "0"
                                    }
                                }
                            ], 
                            "condition": "true"
                        }
                    ]
                }, 
                "onExit": {
                    "events": []
                }
            }, 
            {
                "onInput": {
                    "transitionEvents": [
                        {
                            "eventName": "reset", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_Simple_Alarm_Input.command == \"reset\"", 
                            "nextState": "Normal"
                        }, 
                        {
                            "eventName": "acknowledge", 
                            "actions": [], 
                            "condition": "$input.AWS_IoTEvents_Blueprints_Simple_Alarm_Input.command == \"acknowledge\"", 
                            "nextState": "Snooze"
                        }
                    ], 
                    "events": [
                        {
                            "eventName": "Escalated Alarm Notification", 
                            "actions": [
                                {
                                    "sns": {
                                        "targetArn": "arn:aws:sns:us-west-2:123456789012:escalatedAlarmNotification"
                                    }
                                }
                            ], 
                            "condition": "timeout(\"unacknowledgeTIme\")"
                        }
                    ]
                }, 
                "stateName": "Alarming", 
                "onEnter": {
                    "events": [
                        {
                            "eventName": "Alarm Notification", 
                            "actions": [
                                {
                                    "sns": {
                                        "targetArn": "arn:aws:sns:us-west-2:123456789012:alarmNotification"
                                    }
                                }, 
                                {
                                    "setTimer": {
                                        "seconds": 300, 
                                        "timerName": "unacknowledgeTIme"
                                    }
                                }
                            ], 
                            "condition": "$variable.dnd_active != 1"
                        }
                    ]
                }, 
                "onExit": {
                    "events": []
                }
            }
        ], 
        "initialStateName": "Normal"
    }, 
    "detectorModelDescription": "This detector model is used to detect if a monitored device is in an Alarming State.", 
    "roleArn": "arn:aws:iam::123456789012:role/IoTEventsRole", 
    "key": "alarmId" 
}
```