added battery status to get-sensors.py

This commit is contained in:
mischa 2019-11-06 11:11:27 +01:00
parent a2baea55fb
commit cd0be7d7ba
1 changed files with 2 additions and 2 deletions

View File

@ -43,10 +43,10 @@ with urllib.request.urlopen(req, context=no_cert_check) as response:
json_data = json.loads(content)
print(f"{'ID':>2s}: {'Name':<32s} {'State':<5s} Type")
print(f"{'ID':>3s} {'Name':<32s} {'State':<5s} Type")
print ("################################################################################")
for key in json_data:
if not json_data[key]['state']['reachable']:
continue
state = 'on' if json_data[key]['state']['on'] else 'off'
print(f"{key:>2s}: {json_data[key]['name']:<32s} {state:<5s} {json_data[key]['type']}")
print(f"{key:>3s}: {json_data[key]['name']:<32s} {state:<5s} {json_data[key]['type']}")