Files
2021-11-23 23:38:44 +01:00

25 lines
603 B
Python
Executable File

#!/usr/bin/env python3
import os
import json
sensors = json.loads(os.popen("sensors -j").read())
for sensor in sensors:
print(sensor)
for value in sensors[sensor]:
if value == "Adapter":
continue
for input in sensors[sensor][value]:
if input.endswith('input'):
c = float(sensors[sensor][value][input])
print(" {}{:.1f}\x1b[0m {}".format(
'\x1b[91m' if c > 80 else '\x1b[93m' if
c > 65 else '\x1b[92m',
c,
value
))
print()