in aws-iot-greengrass-for-beginners/alert/main.py [0:0]
def device_main():
"""
main loop for Alert device
"""
global device_name, mqtt_connection
arg_check()
mqtt_connection = discover_gg_host()
topic = "alert/#"
subscribe_future, _ = mqtt_connection.subscribe(
topic, QoS.AT_MOST_ONCE, on_message_received)
subscribe_result = subscribe_future.result()
print("Subscribed to {} with {}".format(
topic, str(subscribe_result['qos'])))
while True:
# eait for events
time.sleep(1)