0
0
IOT Protocolsdevops~10 mins

Last Will and Testament (LWT) 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 Last Will and Testament (LWT) topic in an MQTT client.

IOT Protocols
client.will_set(topic=[1], payload="Offline", qos=1, retain=False)
Drag options to blanks, or click blank then click option'
A"home/temperature"
B"home/status"
C"home/light"
D"home/command"
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a sensor data topic instead of a status topic.
2fill in blank
medium

Complete the code to set the LWT payload message indicating the client is offline.

IOT Protocols
client.will_set(topic="home/status", payload=[1], qos=1, retain=False)
Drag options to blanks, or click blank then click option'
A"Offline"
B"Online"
C"Connected"
D"Active"
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Online' or 'Connected' which indicate the client is active.
3fill in blank
hard

Fix the error in the code to correctly set the LWT with retain flag.

IOT Protocols
client.will_set(topic="home/status", payload="Offline", qos=1, retain=[1])
Drag options to blanks, or click blank then click option'
A1
B"True"
CFalse
DTrue
Attempts:
3 left
💡 Hint
Common Mistakes
Using string "True" instead of boolean True.
Using integer 1 instead of boolean.
4fill in blank
hard

Fill both blanks to create a dictionary for LWT settings with topic and payload.

IOT Protocols
lwt_settings = {"topic": [1], "payload": [2]
Drag options to blanks, or click blank then click option'
A"home/status"
B"Offline"
C"home/command"
D"Online"
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping topic and payload values.
Using wrong topic or payload strings.
5fill in blank
hard

Fill all three blanks to set LWT with topic, payload, and QoS level.

IOT Protocols
client.will_set(topic=[1], payload=[2], qos=[3], retain=True)
Drag options to blanks, or click blank then click option'
A"home/status"
B"Offline"
C1
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using QoS 0 which is less reliable.
Using wrong topic or payload.