0
0
IOT Protocolsdevops~10 mins

MQTT-SN for sensor networks 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 set the MQTT-SN client ID.

IOT Protocols
client.setClientId("[1]")
Drag options to blanks, or click blank then click option'
AsensorNode01
Bconnect
Cpublish
Dsubscribe
Attempts:
3 left
💡 Hint
Common Mistakes
Using MQTT actions like 'connect' or 'publish' as client ID.
2fill in blank
medium

Complete the code to connect the MQTT-SN client to the gateway.

IOT Protocols
client.[1]()
Drag options to blanks, or click blank then click option'
Aconnect
Bpublish
Cdisconnect
Dsubscribe
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'disconnect' or 'publish' instead of 'connect' here.
3fill in blank
hard

Fix the error in the publish command to send sensor data.

IOT Protocols
client.publish("sensor/data", [1])
Drag options to blanks, or click blank then click option'
Adisconnect
Bconnect
Csubscribe
Dtemperature
Attempts:
3 left
💡 Hint
Common Mistakes
Using method names like 'connect' or 'subscribe' as data payload.
4fill in blank
hard

Fill both blanks to subscribe to a topic and set the callback function.

IOT Protocols
client.[1]("sensor/alerts")
client.[2] = alertHandler
Drag options to blanks, or click blank then click option'
Asubscribe
Bpublish
ConMessage
Dconnect
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'publish' instead of 'subscribe' or wrong handler property.
5fill in blank
hard

Fill all three blanks to create a dictionary of sensor readings filtered by value.

IOT Protocols
filtered = [1]: [2] for [3] in readings if readings[[3]] > 50}
Drag options to blanks, or click blank then click option'
Asensor
Breadings[sensor]
Dvalue
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong variable names or values in comprehension.