+
+def connect_mqtt() -> mqtt_client:
+
+ client = mqtt_client.Client(MQTT_CLIENT_ID)
+
+ client.will_set(MQTT_AVAIL_TOPIC, payload="dead", qos=0, retain=True)
+
+ client.on_connect = on_connect
+ client.connect_async(MQTT_BROKER, MQTT_PORT, keepalive=3600)
+
+ return client
+
+
+def subscribe(client) -> None:
+ client.subscribe(MQTT_TOPIC, qos=0)
+ client.on_message = handle_request
+
+
+def threaded_handle() -> None:
+ print("Working thread started!")
+
+ with requests.session() as session: