Implemented clean shutdown
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pünkösd Marcell 2020-10-02 16:11:46 +02:00
parent f6e0b7b25e
commit a06e94147a

View File

@ -89,7 +89,16 @@ def main() -> None:
client.username_pw_set(config.MQTT_USERNAME, config.MQTT_PASSWORD) client.username_pw_set(config.MQTT_USERNAME, config.MQTT_PASSWORD)
client.connect(config.MQTT_HOSTNAME, config.MQTT_PORT, 60) client.connect(config.MQTT_HOSTNAME, config.MQTT_PORT, 60)
client.loop_forever()
try:
client.loop_forever() # This blocks
except KeyboardInterrupt:
logging.info("SIGINT recieved! Stopping...")
pass
client.disconnect()
loopingtimer.stop()
BirbnetesIoTPlatformStatusDriver.cleanup()
if __name__ == "__main__": if __name__ == "__main__":