diff --git a/sound.py b/sound.py index d6bbf3d..1ca898c 100644 --- a/sound.py +++ b/sound.py @@ -57,4 +57,11 @@ def play_alarm(): play_alarm() client.publish(MQTT_TOPIC_SOUND, "Sound Detected") except KeyboardInterrupt: - print("Exiting...") \ No newline at end of file + print("Exiting...") + +# Clean up +stream.stop_stream() +stream.close() +p.terminate() +client.loop_stop() +client.disconnect() \ No newline at end of file