0
0
IOT Protocolsdevops~10 mins

Rule engine for IoT data routing in IOT Protocols - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a rule that routes temperature data to the cooling system.

IOT Protocols
rule = {"condition": "data.type == '[1]'", "action": "send_to_cooling()"}
Drag options to blanks, or click blank then click option'
Ahumidity
Blight
Cpressure
Dtemperature
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'humidity' or other data types instead of 'temperature'.
2fill in blank
medium

Complete the code to route data with value above 75 to the alert system.

IOT Protocols
rule = {"condition": "data.value [1] 75", "action": "send_alert()"}
Drag options to blanks, or click blank then click option'
A<
B>
C==
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' or '==' which do not check for values above 75.
3fill in blank
hard

Fix the error in the rule condition to correctly check if data.status equals 'active'.

IOT Protocols
rule = {"condition": "data.status [1] 'active'", "action": "process_active()"}
Drag options to blanks, or click blank then click option'
A=
B!=
C==
D=>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' which assigns instead of compares.
Using '=>' which is invalid here.
4fill in blank
hard

Fill both blanks to create a rule that routes data with type 'humidity' and value less than 30 to the dehumidifier.

IOT Protocols
rule = {"condition": "data.type == '[1]' and data.value [2] 30", "action": "activate_dehumidifier()"}
Drag options to blanks, or click blank then click option'
Ahumidity
B>
C<
Dtemperature
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'temperature' instead of 'humidity'.
Using '>' instead of '<' for value comparison.
5fill in blank
hard

Fill all three blanks to define a rule that routes data with type 'pressure', value greater than 100, and status 'critical' to the emergency system.

IOT Protocols
rule = {"condition": "data.type == '[1]' and data.value [2] 100 and data.status == '[3]'", "action": "trigger_emergency()"}
Drag options to blanks, or click blank then click option'
Atemperature
B>
Ccritical
Dpressure
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong data type like 'temperature'.
Using '<' instead of '>' for value.
Using wrong status value.