commit 17c6e3a632310fff5165f76e02002df768d6452b from: mischa date: Sat May 09 13:00:06 2020 UTC added ZLLSwitch to get-sensors.py commit - f331785aa71f556770dd288a802525a1ef8f03ae commit + 17c6e3a632310fff5165f76e02002df768d6452b blob - 2beef18025048774008f7d94a04ada1af6ee976b blob + 41a7d75dde95fbf51c0758677e915cd11c89d487 --- get-sensors.py +++ 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']}")