diff --git a/get-sensors.py b/get-sensors.py index 3ad480f..d40ae10 100755 --- a/get-sensors.py +++ b/get-sensors.py @@ -2,6 +2,7 @@ # # Copyright 2019, Mischa Peters , High5!. # Version 1.0 - 20191028 +# Version 1.1 - 20191106 - added battery status # # Get all sensor IDs (ZLLPresence, ZLLLightLevel and ZLLTemperature) # grouped by ZLLPresence name @@ -58,9 +59,9 @@ for key in json_data: for key in sensors: for i in sensors[key]: if json_data.get(i)['type'] == 'ZLLPresence': - print(json_data.get(i)['name']) - print(f"\t{i}: {json_data.get(i)['productname']}") + print(f"{json_data.get(i)['name']} ({json_data.get(i)['config']['battery']}%)") + print(f"{i:>5s}: {json_data.get(i)['productname']}") if json_data.get(i)['type'] == 'ZLLLightLevel': - print(f"\t{i}: {json_data.get(i)['productname']}") + print(f"{i:>5s}: {json_data.get(i)['productname']}") if json_data.get(i)['type'] == 'ZLLTemperature': - print(f"\t{i}: {json_data.get(i)['productname']}") + print(f"{i:>5s}: {json_data.get(i)['productname']}")