Here's my script for controlling the AC from my laptop shell while I'm working at home in a sunny room
This is for Nest Thermosats that have been jailbroken with the NoLongerEvil firmware hack: https://NoLongerEvil.com
Google bricked Gen1 and Gen2 Nest Thermostats last year, but NLE has a linux flash tool that updates your thermostat to connect to a new non-google cloud at NoLongerEvil.com, or you can self-host it. Inspired by Louis Rossman's FULU bounties https://bounties.fulu.org/bounties The new cloud supports MQTT and HTTPS APIs, and I'd argue is functionally better than the normal Nest thermostats if you want to integrate with your own systems.
You save it as /usr/local/bin/chillout and symlink to it as unchill. Fill in your own serial number, device ID and api key.
When you call chillout, it will turn the temperature down substantially to make the system start, then back up 0.5C below ambient, so the equipment stays on for a little period of time
unchill does the inverse: it turns the temp up to stop the ac then back down to 0.5 above ambient, so that it stays off. But it also gives you an option to keep the fan running for a while to dry condensation out of the air conditioner and get the last bit of cooling you paid for.
It also keeps a logfile of what it does each time its run, and shows the full https request and responses if ever they error.