However, by understanding the thermal physics of the LM393 and IR phototransistor, you can implement simple countermeasures: reduce voltage, duty cycle the power, calibrate while hot, or add hysteresis. For critical systems, upgrade to a thermally-compensated sensor.