added battery status to get-sensors.py
This commit is contained in:
parent
a2baea55fb
commit
cd0be7d7ba
@ -43,10 +43,10 @@ with urllib.request.urlopen(req, context=no_cert_check) as response:
|
|||||||
json_data = json.loads(content)
|
json_data = json.loads(content)
|
||||||
|
|
||||||
|
|
||||||
print(f"{'ID':>2s}: {'Name':<32s} {'State':<5s} Type")
|
print(f"{'ID':>3s} {'Name':<32s} {'State':<5s} Type")
|
||||||
print ("################################################################################")
|
print ("################################################################################")
|
||||||
for key in json_data:
|
for key in json_data:
|
||||||
if not json_data[key]['state']['reachable']:
|
if not json_data[key]['state']['reachable']:
|
||||||
continue
|
continue
|
||||||
state = 'on' if json_data[key]['state']['on'] else 'off'
|
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']}")
|
||||||
|
Loading…
Reference in New Issue
Block a user