added ZLLSwitch to get-sensors.py

This commit is contained in:
mischa 2020-05-09 15:00:06 +02:00
parent f331785aa7
commit 17c6e3a632
1 changed files with 6 additions and 2 deletions

View File

@ -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 <bridge name>
@ -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']}")