danimtb / sonoff-danimtb

Alternative firmware for Itead Sonoff (ESP8266/ESP8285 based) devices to use them in Home Assistant
12 stars 3 forks source link

Sonoff S20 not working with board = esp01_1m #27

Open luisAzcuaga opened 6 years ago

luisAzcuaga commented 6 years ago

Found that works with

board = esp8285

Couldn't find why tho.

danimtb commented 6 years ago

Hi @luisAzcuaga!

Thank you for you feedback. It seems that new sonoff s20 could have the esp8285 instead of the esp8266.

Could you confirm this? You have to check the inside of your s20 and see if the esp8285 is there: https://uploads.disquscdn.com/images/698f28c20f5ebcd22bf839ee7cb5db6457ca31a3f5c6b1f0bbb74823792a2811.jpg

In that case we would have to add a new "device" to the repo with the esp8285.

There is a similar issue in the tasmota repo arendst/Sonoff-Tasmota#889

Please check it and let me know! 😄

luisAzcuaga commented 6 years ago

I haven't find a way to tear it down without breaking the device. Heh. Actually I based on the Tasmota issue to try flashing as ESP8285 because flashing as ESP01_1m wouldn't do a thing on the device.

danimtb commented 6 years ago

but you have to open it up in order to flash it. Can't you see the microncontroller then or would you have to tear it down completely?

luisAzcuaga commented 6 years ago

Good news! Found out that devices with the ESP01_1m are compatibles with the firmware for ESP8285 (not sure if ESP01_1m is a variation of ESP9266 as ESP8266-12F/12S/etc)

luisAzcuaga commented 6 years ago

I think the ESP is underneath the PCB :/ photo_2018-04-04_12-58-34

danimtb commented 6 years ago

Yes, the firmware is compatible dont worry. It even supports sonoff touch which uses esp8285 too.

Thanks a lot for the picture. Seems chip is on the other side of the pcb. However, it looks like it has the esp8266 because the layout is different. So we would need to give it a good name to make it identifiable by other users.

Option 1: sonoff-s20-us ? I dont know if it is related to the contry version. Option 2: sonoff-s20-esp8385 ? Dont know if this makes it identifiable. Option 3: ... any suggestion?

Could you provide me with the link where you bought this model? Many thanks @luisAzcuaga!

luisAzcuaga commented 6 years ago

Sorry for the late response, but by the time I saw your answer I was leaving the lab. Anyway, I'll make more tests tomorrow morning 10 am (GMT-6). About the name, I would call it sonoff-s20-alt because I'm not sure it's a permanent change, maybe it was only this batch(?)

And the store usally is iTead, but this time was from banggood

And thank you for the fast responses!

danimtb commented 6 years ago

Hi @luisAzcuaga

Did you have the time to do the checks? I'd like to include support for this device in the new release.

Thanks

luisAzcuaga commented 6 years ago

Yes, and found some other issues with my code and had to make some changes in order to keep the code working. In your library is webServer.

Had to add this everytime a GET or POST is called.

void setHeaders()
{
  self->server->sendHeader("Access-Control-Max-Age", "10000");
  self->server->sendHeader("Access-Control-Allow-Methods", "POST,GET,OPTIONS");
  self->server->sendHeader("Access-Control-Allow-Origin", "*");
  self->server->sendHeader("Access-Control-Allow-Headers","Origin, X-Requested-With, Accept, Content-Type, X-Amz-Date, Authorization, X-Api-Key, X-Amz-Security-Token, X-XSRF-TOKEN, Access-Control-Allow-Headers");
}

handleAccessHeader is a function that calls the function above.

server->on("/", HTTP_OPTIONS, handleAccessHeader);
  server->on("/", HTTP_GET, handleRoot);

  server->on("/scan", HTTP_OPTIONS, handleAccessHeader);
  server->on("/scan", HTTP_GET, handleScan);

  server->on("/configure", HTTP_OPTIONS, handleAccessHeader);
  server->on("/configure", HTTP_GET, handleConfigureGet);
  server->on("/configure", HTTP_POST, handleConfigurePost);

Guess It has something to do with the webKit, not the newest version of the ESP8266 library.

danimtb commented 6 years ago

I dont know why this is needed... could you explain which versions are you using? Is yours an old chip or something?

Is this related to the change on board = esp8285?

luisAzcuaga commented 6 years ago

I think this last thing I posted you it's related to ES6. The Sonoff plug we were using were v1.1 and we bought them about a year ago, this ones are version 1.3.

Sorry for the late response but I got moved to another project.