Avviso di fine del supporto: il 20 maggio 2026, AWS terminerà il supporto per AWS IoT Events. Dopo il 20 maggio 2026, non potrai più accedere alla AWS IoT Events console o AWS IoT Events alle risorse. Per ulteriori informazioni, consulta AWS IoT Events Fine del supporto.
Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.
Il motore AWS IoT Core delle regole e AWS IoT Events
Le seguenti regole ripubblicano i messaggi AWS IoT Events MQTT come messaggi di richiesta di aggiornamento shadow. Partiamo dal presupposto che AWS IoT Core le cose siano definite per un'unità di riscaldamento e un'unità di raffreddamento per ogni area controllata dal modello di rilevatore.
In questo esempio, abbiamo definito cose denominate Area51HeatingUnit
eArea51CoolingUnit
.
Comando CLI utilizzato:
aws iot create-topic-rule --cli-input-json file://ADMShadowCoolOffRule.json
File: 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" } } ] } }
Risposta: [vuoto]
Comando CLI utilizzato:
aws iot create-topic-rule --cli-input-json file://ADMShadowCoolOnRule.json
File: 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" } } ] } }
Risposta: [vuoto]
Comando CLI utilizzato:
aws iot create-topic-rule --cli-input-json file://ADMShadowHeatOffRule.json
File: 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" } } ] } }
Risposta: [vuoto]
Comando CLI utilizzato:
aws iot create-topic-rule --cli-input-json file://ADMShadowHeatOnRule.json
File: 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" } } ] } }
Risposta: [vuoto]