import os, json, sys try: sensor_group = sys.argv[1] sensor = sys.argv[2] except IndexError: print("usage: python3 "+sys.argv[0]+" ") sys.exit(1) sensors_process = os.popen("sensors -j") temps_str = sensors_process.read() sensors_process.close() temps = json.loads(temps_str) try: print([value for key, value in temps[sensor_group][sensor].items() if key.endswith("input")][0]) except KeyError: print("Sensor \""+sensor_group+":"+sensor+" not found!") sys.exit(1)