Verwenden Sie die AWS IoT Core Regel-Engine für AWS IoT Events - AWS IoT Events

Hinweis zum Ende des Supports: Am 20. Mai 2026 AWS endet der Support für AWS IoT Events. Nach dem 20. Mai 2026 können Sie nicht mehr auf die AWS IoT Events Konsole oder AWS IoT Events die Ressourcen zugreifen. Weitere Informationen finden Sie unter AWS IoT Events Ende des Supports.

Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich.

Verwenden Sie die AWS IoT Core Regel-Engine für AWS IoT Events

Die folgenden Regeln veröffentlichen AWS IoT Core MQTT-Nachrichten erneut als Shadow-Update-Anforderungsnachrichten. Wir gehen davon aus, dass für jeden Bereich, der durch das Detektormodell gesteuert wird, AWS IoT Core Dinge für eine Heiz- und eine Kühleinheit definiert sind. In diesem Beispiel haben wir Dinge mit dem Namen "Area51HeatingUnit" und definiert"Area51CoolingUnit".

CLI-Befehl:

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

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

Antwort: [leer]

CLI-Befehl:

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

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

Antwort: [leer]

CLI-Befehl:

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

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

Antwort: [leer]

CLI-Befehl:

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

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

Antwort: [leer]