Homey Community Forum

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 huisvanvandaag.nl (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: https://apps.athom.com/app/com.athom.homeyduino

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 https://randomnerdtutorials.com/reprogram-sonoff-smart-switch-with-web-server/

Rui Santos
Complete project details at http://randomnerdtutorials.com

#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 https://randomnerdtutorials.com/reprogram-sonoff-smart-switch-with-web-server/ do I need to add library and how ?

Thanks and sorry for being so noob :rofl:


Sorry ! Bad research I guess information is here: https://github.com/athombv/homey-arduino-library/blob/master/docs/usage.md

Yes indeed. Good luck!

1 Like

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:

There is actually an more easier way to flash Tasmota in an sonoff device.

You dont need to compile anything just flash the tasmota bin file with an FTDI programmer into the SONOFF and use the Termite client to setup the network and you are up and running. After its flashed with tasmota you can update new tasmota releases over the air (OTA) no FTDI cables needed.

FTDI Programmer can set with a jumper too 3.3v or 5 volt:

Make sure the FTDI is set on 3.3 Volt otherwise you fry the electronics of the Sonoff.
Make sure TX is connecting with RX and RX with TX common mistake is TX-TX and RX-RX

Hooking up the FTDI - -> SONOFF

FTDI VCC 3.3v - > VCC sonoff
FTDI GND --> GND sonoff
FTDI RX --> TX sonoff
FTDI TX - ->> RX sonoff
FTDI GND - -> GPIO1 sonoff

The reason why you need too hookup the GPIO1 to GND is that the ESPXXXX chip needs to be set in Flashmode to accept the Tasmota bin file.

The Video Explains all:

Tasmota firmware:

ESPEasy flasher

Termite Client