From eb78856c45cc22c9f16600d4807802cecb5fc666 Mon Sep 17 00:00:00 2001 From: mischa Date: Wed, 6 Nov 2019 11:13:00 +0100 Subject: [PATCH] added description --- get-sensors.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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']}")