Nest Sensor as Thermostat

Hello-

Can I trigger events using the Nest sensor, or do I need to use the thermostat for that? I would like to essentially use the sensor as a thermostat by having it turn an AC on within a target range.

If the answer is no, what is a good alternative, short of buying a smart thermostat? Build a temp / humidity sensor with an ESP8266 and use MQTT protocol to publish to HA?

Thanks!