For anyone tinkering with the ESP8266/NodeMCU/Wemos devices, and are interested in MQTT, you should definitely check out the open source framework called Homie. This is a very well written and stable framework you can deploy to your device and it will handle all the WIFI and MQTT setup and connections etc. All you have to do is worry about reading your sensors etc.
One of the best things about the ESP8266 and Homie is that it supports OTA (over-the-air) updates. So you can deploy your devices and then upgrade the firmware without needing any physical access to the device - a huge advantage IMO!
In order to facilitate these OTA updates myself and another chap (JP Mens) have written a python based _Homie OTA Server_ which allows you to maintain an inventory of firmware versions, keep track of your Homie devices, and schedule OTA updates.
https://github.com/jpmens/homie-ota/
Just thought some of you might find this useful so figured I would share it here.