If the ambient temp sensor is sending an incorrect voltage that's interpreted by the ECU as a very low ambient temp, then the compressor will not be allowed to run. Later on, the combination of higher ambient temp, along with sunlight hitting the photo sensor on the dash, could be high enough to trigger the A/C to run.If the car sits in the heat it works otherwise prepare to wait 20-30 minutes
You can check the ambient temp value using an OBD live data scan tool. Not even necessary to start the engine - just plug the tool into the OBD port first thing in the morning, turn the key to on, and read the ambient temp value (which should be fairly close to the actual temp). If the scan tool shows a significantly lower temp than the actual one, it needs to be replaced.