Sonoff re-program


Did somebody allready re-programmed the ESP8266 chip on the Sonoff to use for example the Homey Arduino app?


I did flash several Sonoff devices with Tasmota firmware. Works 100% with Homey.

You can now even buy son off devices on Amazon which are already flashed with Tasmota firmware.

Gr. Remco


I haven’t specifically, but should be possible. Not sure how the relays and/or sensors are connected to the ESP8266 on Sonoff devices (which GPIO’s), though (specifically for sensor support, you’re going to need additional Arduino libraries if you want support for those).


How can we recognise these Tasmota flashed son off devices ?


There you go:

Gr. Remco


To be clear: OP isn’t asking about an alternative firmware, like Tasmota. He’s asking about flashing a Homeyduino-based program onto the ESP8266 inside a Sonoff device.


Yes that’s correct, I found this:

Now waiting on my sonoff to arrive and then try if I can get my code in it after a re-flash.
The reason is that I want to have a nice box for it, I have some “hobby” versions now


See also (Dutch)


Hello, i’ve done this tutorial and my sonoff is flashed (I can control it via 192.168…/on - /off).

What’s the next step to control it with Homey ? I don’t really understand “MQTT”…




Easy peasy with:


Thanks for answer !

But when I try to add I got this message:

ans if I continue manually and add Sonoff IP I get this:

Since i’ve fashed my sonoff, I don’t have a “pairing mode” on my Sonoff (normal ?)

Do you know why I’m not able to add it ?

Thanks again,



Can you post you’re arduino source code?


Code is from

Rui Santos
Complete project details at

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>

MDNSResponder mdns;

// Replace with your network credentials
const char* ssid = "YOUR_SSID";
const char* password = "YOUR_PASSWORD";

ESP8266WebServer server(80);

String webPage = "";

int gpio13Led = 13;
int gpio12Relay = 12;

void setup(void){
  webPage += "<h1>SONOFF Web Server</h1><p><a href=\"on\"><button>ON</button></a>&nbsp;<a href=\"off\"><button>OFF</button></a></p>";  
  // preparing GPIOs
  pinMode(gpio13Led, OUTPUT);
  digitalWrite(gpio13Led, HIGH);
  pinMode(gpio12Relay, OUTPUT);
  digitalWrite(gpio12Relay, HIGH);
  WiFi.begin(ssid, password);

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
  Serial.print("Connected to ");
  Serial.print("IP address: ");
  if (mdns.begin("esp8266", WiFi.localIP())) {
    Serial.println("MDNS responder started");
  server.on("/", [](){
    server.send(200, "text/html", webPage);
  server.on("/on", [](){
    server.send(200, "text/html", webPage);
    digitalWrite(gpio13Led, LOW);
    digitalWrite(gpio12Relay, HIGH);
  server.on("/off", [](){
    server.send(200, "text/html", webPage);
    digitalWrite(gpio13Led, HIGH);
    digitalWrite(gpio12Relay, LOW);
  Serial.println("HTTP server started");
void loop(void){


That’s not Homeyduino code, that’s regular ESP8266 Arduino code.

Homeyduino is a separate Arduino library that you need to install, and the code needs to be modified so it uses that library.


Thank you Robert !

I’ll try it, I hope I’ll able to do it :sweat_smile:

May you just tell me in wich step from the tutorial do I need to add library and how ?

Thanks and sorry for being so noob :rofl:



Sorry ! Bad research I guess information is here:


Yes indeed. Good luck!


By the way, got my Sonoff stuff.
And re-program then to work with Homey was very easy, me happy and more importment my wife also :wink:


Yes it works for me too ! It was easier than I thought ! I feel like a hacker now :joy: