from smbus2 import SMBus def read_case_temp(): addr = 0x48 # change if your scan shows different with SMBus(1) as bus: msb, lsb = bus.read_i2c_block_data(addr, 0x00, 2) raw = ((msb << 8) | lsb) >> 4 if raw & 0x800: # sign bit for 12-bit raw -= 1 << 12 return round(raw * 0.0625, 2) def read_cpu_temp(): with open("/sys/class/thermal/thermal_zone0/temp", "r") as f: return round(int(f.read()) / 1000, 2) if __name__ == "__main__": print("Case temperature: ", read_case_temp(), "°C") print("CPU temperature: ", read_cpu_temp(), "°C")