diff --git a/api/ble.py b/api/ble.py index d1b4d1a..e7263d9 100644 --- a/api/ble.py +++ b/api/ble.py @@ -339,7 +339,8 @@ if __name__ == "__main__": for test_result in test_results: log.info(f"{test_result['test_label']}:") parts: List[str] = [] - for reading in test_result['test_result']['sensor_results']: + # Sort sensor results alphabetically by 'name' before printing + for reading in sorted(test_result['test_result']['sensor_results'], key=lambda r: r['name']): mac = reading['name'] temp = reading['temp'] # Grab the last two octets of the MAC address