Sonoff re-program

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

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

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:

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

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ā€ā€¦

Thanks,

Julien

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:
46

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

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);
 
  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();
}

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:

Julien

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
https://www.compuphase.com/software_termite.htm