Complete the code to import the MQTT client library.
import [1]
The correct library to import for MQTT in Python is paho.mqtt.client, which provides the MQTT client functionality.
Complete the code to create an MQTT client instance named 'client'.
client = [1]()The MQTT client instance is created by calling paho.mqtt.client.Client().
Fix the error in the code to connect the client to the MQTT broker at 'broker.hivemq.com' on port 1883.
client.connect([1], 1883)
The broker address must be a string, so it needs quotes: 'broker.hivemq.com'.
Fill both blanks to publish the message 'Hello IoT' to the topic 'home/temperature'.
client.publish([1], [2])
The first argument is the topic string 'home/temperature', and the second is the message 'Hello IoT'.
Fill all three blanks to subscribe to the topic 'home/lights' and start the network loop.
client.[1]('[2]') client.[3]()
connect instead of subscribe.Use subscribe to listen to a topic, the topic string is 'home/lights', and loop_start() runs the network loop in the background.