Yep, temperature and humidity literally turn a guitar into a tuning machine. Especially here in central Kansas where we have very wild swings in both temperature and humidity. If I have a guitar I haven’t played in a few weeks, well guess what, out comes the Snark tuner, ‘cause it isn’t going to be in tune. Especially the Taylor 352CE twelve strings. They are a beast to tune. But I love it.
I keep humidifiers (winter) and dehumidifiers (summer)bin my music room. It takes time for the guitar to absorb or give off moisture, so if you keep the guitar at the proper moisture level, and transport it in a good case, and keep it away from temperature extremes, you should be able to keep it in good tune when you play.
Also, a good trick someone taught me was when you tune the open strings, tune it very slightly flat. Finger pressure when you fret sharpens the note slightly, and when you are playing in a gig, your finger pressure tends to be more than just practicing at home.