You can wait for multiple message types at once, e.g.
useful_types = ("HEARTBEAT", "STATUSTEXT")
while "waiting for messages":
message = master.recv_match(type=useful_types, blocking=True, timeout=3)
if message is None:
# no messages of interest detected within timeout, including heartbeat
print("Heartbeat lost!")
elif message.name == "STATUSTEXT" and message.text == "Leak Detected":
print("LEAK!!")
...
By the way, I’ve edited your comment to include a code block, so it’s easier to read/understand. You can read about how to make them in the Formatting a Post/Comment section of the “How to Use the Forums” post