diff --git a/get-sensors.py b/get-sensors.py index 2beef18..41a7d75 100755 --- a/get-sensors.py +++ b/get-sensors.py @@ -4,9 +4,10 @@ # Version 1.0 - 20191028 # Version 1.1 - 20191106 - added battery status # Version 1.2 - 20200507 - added config file support +# Version 1.3 - 20200509 - added dimmer switch # -# Get all sensor IDs (ZLLPresence, ZLLLightLevel and ZLLTemperature) -# grouped by ZLLPresence name +# Get all sensor IDs ZZLSwitch, ZLLPresence (+ ZLLLightLevel and ZLLTemperature) +# grouped by ZZLSwitch and ZLLPresence name # # For example: # $ get-sensors.py @@ -73,6 +74,9 @@ for key in json_data: for key in sensors: for i in sensors[key]: if not battery: + if json_data.get(i)['type'] == 'ZLLSwitch': + print(f"{json_data.get(i)['name']:<32s} ({json_data.get(i)['config']['battery']}%)") + print(f"{i:>5s}: {json_data.get(i)['productname']}") if json_data.get(i)['type'] == 'ZLLPresence': print(f"{json_data.get(i)['name']:<32s} ({json_data.get(i)['config']['battery']}%)") print(f"{i:>5s}: {json_data.get(i)['productname']}")