Another POSSIBILITY is air in the cooling system. The temp sensor is at the high point in the cooling system, where air bubbles would tend to gather. When the engine's warmed up, an air bubble under the sensor would make it report "cold." When the air bubble moves away, the sensor would report "warm." So the ECU drives the car back and forth between cold idle (high) and warm idle (lower).
If this is the problem, the fix is to bleed the cooling system.