Allow me to introduce V0.1 of “ESPARTO” (ESP all-purpose run-time object) which is pretty much MQTT firmware-in-a-box for anything with an ESP8266 in it SONOFF, Wemos D1, NodeMCU etc. It is intended to take all the pain of getting your own project up and running quickstyle.

The repository is at GitHub - philbowles/esparto: Esparto v3.3 is a rapid development framework, synchronous task queue and GPIO manager with web UI for ESP8266 devices but I think the introduction tells you all you need to know:

"Wouldn’t it be nice if this was all it took to build a robust MQTT-capable firmware for SONOFF, WEMOS, NODEMCU etc to remotely turn the device on or off from you own WiFi network? No cloud APP, no dead device when Internet is down , no unexpected WDT resets…

#include <ESPArto.h>
// ToiioT-Etage is my SSID, pw="" (I live in the forest) my raspi mosquitto is on
ESPArto Esparto("ToiioT-Etage", "", "esparto666", "", 1883); 
void setupHardware(){
   Esparto.pinDefDebounce(0,INPUT,buttonPressed,15); // 15 = ms debounce time
   pinMode(12,OUTPUT); // SONOFF relay / switch
void onMqttConnect(){  Esparto.subscribe("switch",mqttSwitch); }
void toggleRelay(){  digitalWrite(12,!digitalRead(12)); }
void buttonPressed(bool hilo){ if(hilo) toggleRelay(); }
void mqttSwitch(String topic,String payload){
  Esparto.publish("state",digitalRead(12) ? "ON":"OFF");

And wouldn’t it be nicer if that also already included MQTT support to set / read any pin, to reconnect automatically when the router fails, and to be able to update it via OTA? If it could also handle retriggering pins, latching pins and even fully debounced rotary encoder support, it would be pretty easy for newbies to get started…

Well now it is. Introducing Yet Another WiFi Novelty (YAWN…) <drum-roll…> ESPARTO"

I’m looking for initial comments, suggestions, beta testing if any of you have the time to check it out, I’d be grateful. If it helps anybody, I’ll be happy too!


Put the source code in the repository, not inside a .zip file. By setting up the repository the way you have it now you lose all the benefits of what GitHub actually is for: Easy collaboration. Github will provide automatically generated .zip files via Clone or Download > Download ZIP and GitHub releases.

Do some Markdown formatting on It currently just looks like a wall of text and is very difficult to navigate quickly to the information you're looking for.

I knew the formatting was bad - I'm very new to github, one of my own comments already says I need to tidy that! I just wanted to "get it out there" quickly. I will also upload the raw files as per your suggestion.

Thanks, this is exactly the sort of helpful comment I was hoping for.


update: @pert - your suggestions have been incorporated - thanks again