# Sonoff re-program

**URL:** <https://community.homey.app/t/sonoff-re-program/3256>\
**Category:** Devices\
**Created:** [October 24, 2018, 10:41pm UTC](https://community.homey.app/t/sonoff-re-program/3256 "2018-10-24T22:41:46Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Slof](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/slof/32/1318_2.png) [@Slof](https://community.homey.app/u/Slof)\
**Post date:** [October 24, 2018, 10:41pm UTC](https://community.homey.app/t/sonoff-re-program/3256/1 "2018-10-24T22:41:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rhannink](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rhannink/32/10648_2.png) [@rhannink](https://community.homey.app/u/rhannink)\
**Post date:** [October 25, 2018, 9:38am UTC](https://community.homey.app/t/sonoff-re-program/3256/2 "2018-10-25T09:38:37Z")

</div>

Yes,  
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

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [October 25, 2018, 10:55am UTC](https://community.homey.app/t/sonoff-re-program/3256/3 "2018-10-25T10:55:56Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![Macleod](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/macleod/32/2500_2.png) [@Macleod](https://community.homey.app/u/Macleod)\
**Post date:** [October 25, 2018, 11:14am UTC](https://community.homey.app/t/sonoff-re-program/3256/4 "2018-10-25T11:14:38Z")

</div>

How can we recognise these Tasmota flashed son off devices ?

---

<div class="post-metadata">

**Author:** ![rhannink](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rhannink/32/10648_2.png) [@rhannink](https://community.homey.app/u/rhannink)\
**Post date:** [October 25, 2018, 12:31pm UTC](https://community.homey.app/t/sonoff-re-program/3256/5 "2018-10-25T12:31:38Z")

</div>

There you go:

> **[CREATIONX Sonoff Basic WiFi - Mit TASMOTA FIRMWARE: Amazon.de: Elektronik](https://www.amazon.de/CREATIONX-Sonoff-Basic-WiFi-FIRMWARE/dp/B0735C4BZ6)**

Gr. Remco

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [October 25, 2018, 12:56pm UTC](https://community.homey.app/t/sonoff-re-program/3256/6 "2018-10-25T12:56:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Slof](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/slof/32/1318_2.png) [@Slof](https://community.homey.app/u/Slof)\
**Post date:** [October 25, 2018, 3:27pm UTC](https://community.homey.app/t/sonoff-re-program/3256/7 "2018-10-25T15:27:37Z")

</div>

Yes that’s correct, I found this:

[https://randomnerdtutorials.com/reprogram-sonoff-smart-switch-with-web-server/](https://randomnerdtutorials.com/reprogram-sonoff-smart-switch-with-web-server/)

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

---

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [October 26, 2018, 12:44pm UTC](https://community.homey.app/t/sonoff-re-program/3256/8 "2018-10-26T12:44:33Z")

</div>

See also huisvanvandaag.nl (Dutch)

---

<div class="post-metadata">

**Author:** ![Julien\_Moors](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/julien_moors/32/26538_2.png) [@Julien\_Moors](https://community.homey.app/u/Julien_Moors)\
**Post date:** [October 30, 2018, 7:27pm UTC](https://community.homey.app/t/sonoff-re-program/3256/9 "2018-10-30T19:27:45Z")

</div>

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”…

Thanks,

Julien

---

<div class="post-metadata">

**Author:** ![Slof](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/slof/32/1318_2.png) [@Slof](https://community.homey.app/u/Slof)\
**Post date:** [October 30, 2018, 8:20pm UTC](https://community.homey.app/t/sonoff-re-program/3256/10 "2018-10-30T20:20:29Z")

</div>

Easy peasy with: [https://apps.athom.com/app/com.athom.homeyduino](https://apps.athom.com/app/com.athom.homeyduino)

---

<div class="post-metadata">

**Author:** ![Julien\_Moors](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/julien_moors/32/26538_2.png) [@Julien\_Moors](https://community.homey.app/u/Julien_Moors)\
**Post date:** [October 30, 2018, 8:48pm UTC](https://community.homey.app/t/sonoff-re-program/3256/11 "2018-10-30T20:48:56Z")

</div>

Thanks for answer !

But when I try to add I got this message:

 ![16](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/0/07e6c3b1909b4bc7fd6c11ea92143e5b84219ca8.png)

ans if I continue manually and add Sonoff IP I get this:  
 ![46](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/a/a9139e6e46127de1f23a509c5ecc4264f45fc931.png)

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,

Julien

---

<div class="post-metadata">

**Author:** ![Slof](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/slof/32/1318_2.png) [@Slof](https://community.homey.app/u/Slof)\
**Post date:** [October 31, 2018, 10:00am UTC](https://community.homey.app/t/sonoff-re-program/3256/12 "2018-10-31T10:00:35Z")

</div>

Can you post you’re arduino source code?

---

<div class="post-metadata">

**Author:** ![Julien\_Moors](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/julien_moors/32/26538_2.png) [@Julien\_Moors](https://community.homey.app/u/Julien_Moors)\
**Post date:** [October 31, 2018, 10:17am UTC](https://community.homey.app/t/sonoff-re-program/3256/13 "2018-10-31T10:17:47Z")

</div>

Code is from [https://randomnerdtutorials.com/reprogram-sonoff-smart-switch-with-web-server/](https://randomnerdtutorials.com/reprogram-sonoff-smart-switch-with-web-server/)

/\*\*\*\*\*\*\*\*\*  
Rui Santos  
Complete project details at [http://randomnerdtutorials.com](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);
 
  Serial.begin(115200); 
  delay(5000);
  WiFi.begin(ssid, password);
  Serial.println("");

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
  
  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);
    delay(1000);
  });
  server.on("/off", [](){
    server.send(200, "text/html", webPage);
    digitalWrite(gpio13Led, HIGH);
    digitalWrite(gpio12Relay, LOW);
    delay(1000); 
  });
  server.begin();
  Serial.println("HTTP server started");
}
 
void loop(void){
  server.handleClient();
}
```

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [October 31, 2018, 12:31pm UTC](https://community.homey.app/t/sonoff-re-program/3256/14 "2018-10-31T12:31:08Z")

</div>

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

Homeyduino is a [separate Arduino library](https://github.com/athombv/homey-arduino-library) that you need to install, and the code needs to be modified so it uses that library.

---

<div class="post-metadata">

**Author:** ![Julien\_Moors](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/julien_moors/32/26538_2.png) [@Julien\_Moors](https://community.homey.app/u/Julien_Moors)\
**Post date:** [October 31, 2018, 1:37pm UTC](https://community.homey.app/t/sonoff-re-program/3256/15 "2018-10-31T13:37:54Z")

</div>

Thank you Robert !

I’ll try it, I hope I’ll able to do it 😅

May you just tell me in wich step from the tutorial [https://randomnerdtutorials.com/reprogram-sonoff-smart-switch-with-web-server/](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 🤣

Julien

---

<div class="post-metadata">

**Author:** ![Julien\_Moors](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/julien_moors/32/26538_2.png) [@Julien\_Moors](https://community.homey.app/u/Julien_Moors)\
**Post date:** [October 31, 2018, 1:40pm UTC](https://community.homey.app/t/sonoff-re-program/3256/16 "2018-10-31T13:40:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Slof](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/slof/32/1318_2.png) [@Slof](https://community.homey.app/u/Slof)\
**Post date:** [October 31, 2018, 8:31pm UTC](https://community.homey.app/t/sonoff-re-program/3256/17 "2018-10-31T20:31:31Z")

</div>

Yes indeed. Good luck!

---

<div class="post-metadata">

**Author:** ![Slof](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/slof/32/1318_2.png) [@Slof](https://community.homey.app/u/Slof)\
**Post date:** [November 14, 2018, 11:44am UTC](https://community.homey.app/t/sonoff-re-program/3256/18 "2018-11-14T11:44:50Z")

</div>

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 😉

---

<div class="post-metadata">

**Author:** ![Julien\_Moors](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/julien_moors/32/26538_2.png) [@Julien\_Moors](https://community.homey.app/u/Julien_Moors)\
**Post date:** [November 14, 2018, 8:11pm UTC](https://community.homey.app/t/sonoff-re-program/3256/19 "2018-11-14T20:11:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Capt.Kiwi](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/capt.kiwi/32/9670_2.png) [@Capt.Kiwi](https://community.homey.app/u/Capt.Kiwi)\
**Post date:** [January 21, 2019, 7:32pm UTC](https://community.homey.app/t/sonoff-re-program/3256/20 "2019-01-21T19:32:29Z")

</div>

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:

> **[FT232RL 3.3V 5.5V FTDI USB to TTL Serial Adapter Module for Arduino Mini Port ...](https://www.ebay.com/itm/FT232RL-3-3V-5-5V-FTDI-USB-to-TTL-Serial-Adapter-Module-for-Arduino-Mini-Port/381374421597?hash=item58cbafda5d:g:jk8AAOSwrklVMjIp:rk:1:pf:1&frcectupt=true)**
>
> Support 3.3V, 5V. RXD/TXD transceiver communication indicator. Module size:36mm(length) 17.5mm(width). We will leave it for everyone that leaves it for us. | eBay!

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:

> **[arendst/Sonoff-Tasmota](https://github.com/arendst/Sonoff-Tasmota/releases)**
>
> Provide ESP8266 based itead Sonoff with Web, MQTT and OTA firmware using Arduino IDE or PlatformIO - arendst/Sonoff-Tasmota

ESPEasy flasher

> **[letscontrolit/ESPEasy](https://github.com/letscontrolit/ESPEasy/releases)**
>
> Easy MultiSensor device based on ESP8266. Contribute to letscontrolit/ESPEasy development by creating an account on GitHub.

Termite Client  
[https://www.compuphase.com/software\_termite.htm](https://www.compuphase.com/software_termite.htm)
