This is an example of reading the temperature from a DS18B20 one-wire sensor, and publishing the result to an MQTT server.
Based on https://github.com/ok1cdj/ESP8266-LUA which I modified to send the data to MQTT instead.
This is the wiring that is required: https://github.com/ok1cdj/ESP8266-LUA/blob/master/Thermometer-DS18B20-Thingspeak/esp8266-ds18b20-2_bb.png