SuperHouseTV have a great video on using the Sonoff, Arduino, OpenHAB and MQTT to control your house. Jon demos using the embedded software/cloud solution to control a light, as well as flashing the firmware yourself and setting up the Sonoff for over-the-air updates and controlling with MQTT. Well worth a watch!
Links to the Github pages for the sketches are in the show-notes.