A leadless cardiac pacemaker comprises a hermetic housing, a power source disposed in the housing, at least two electrodes supported by the housing, a semiconductor temperature sensor disposed in the housing, and a controller disposed in the housing and configured to deliver energy from the power source to the electrodes to stimulate the heart based upon temperature information from the temperature sensor. In some embodiments, the sensor can be configured to sense temperature information within a predetermined range of less than 20 degrees C. The temperature sensor can be disposed in the housing but not bonded to the housing.