Avis de fin de support : le 20 mai 2026, AWS le support de AWS IoT Events. Après le 20 mai 2026, vous ne pourrez plus accéder à la AWS IoT Events console ni aux AWS IoT Events ressources. Pour plus d'informations, consultez AWS IoT Events la fin du support.
Les traductions sont fournies par des outils de traduction automatique. En cas de conflit entre le contenu d'une traduction et celui de la version originale en anglais, la version anglaise prévaudra.
Utilisez le moteur de AWS IoT Core règles pour AWS IoT Events
Les règles suivantes republient les messages AWS IoT Core MQTT sous forme de messages de demande de mise à jour instantanée. Nous supposons que AWS IoT Core les éléments sont définis pour une unité de chauffage et une unité de refroidissement pour chaque zone contrôlée par le modèle de détecteur. Dans cet exemple, nous avons défini des éléments nommés "Area51HeatingUnit"
et"Area51CoolingUnit"
.
Commande CLI :
aws iot create-topic-rule --cli-input-json file://ADMShadowCoolOffRule.json
Dossier : 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" } } ] } }
Réponse : [vide]
Commande CLI :
aws iot create-topic-rule --cli-input-json file://ADMShadowCoolOnRule.json
Dossier : 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" } } ] } }
Réponse : [vide]
Commande CLI :
aws iot create-topic-rule --cli-input-json file://ADMShadowHeatOffRule.json
Dossier : 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" } } ] } }
Réponse : [vide]
Commande CLI :
aws iot create-topic-rule --cli-input-json file://ADMShadowHeatOnRule.json
Dossier : 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" } } ] } }
Réponse : [vide]