Sonoff-Homekit icon indicating copy to clipboard operation
Sonoff-Homekit copied to clipboard

Added an erase.sh script that will erase the Sonoff's flash

Open rickvdl opened this issue 5 years ago β€’ 15 comments

I encountered some issues while connecting the Sonoff to my WiFi using the captive portal. The captive portal would not close and the Sonoff would not connect to my WiFi. After reading this very helpful comment: https://github.com/Gruppio/Sonoff-Homekit/pull/3#issuecomment-465571317 I managed to solve the issue by erasing the Sonoff's flash before flashing the firmware.

I have added a little helper script and updated the README on how to solve this issue should you encounter it.

rickvdl avatar Nov 24 '19 20:11 rickvdl

@gsvan I haven't tried this yet, but I suspect it is (at least) running make on the Makefile that can be found in the sonoff_advanced directory. I will try this in the coming days so if I have any more information I will let you know :)

rickvdl avatar Nov 24 '19 20:11 rickvdl

That will be great, please let me know as I have no idea where I should put those advance directory files to compile :) thank you

gsvan avatar Nov 24 '19 22:11 gsvan

Beautiful!!! It resolved the wifi issue for me!! you did, however, forget the "./" before esptool.py

NajibNour avatar Nov 29 '19 21:11 NajibNour

@gsvan I haven't tried this yet, but I suspect it is (at least) running make on the Makefile that can be found in the sonoff_advanced directory. I will try this in the coming days so if I have any more information I will let you know :)

Hi did you get chance to test building using the makefile and if successful what route you took. I need to be able to change the gpio outputs. binary files work great I've even managed to combine them into a single bin for flashing, I just can't seem to get a hold of compiling from the advanced folder. any help would be appreciated.

magnip avatar Dec 18 '19 20:12 magnip

@magnip Hi, sorry no unfortunately not. I ended up setting up a home-assistent instance on a raspberry pi and running tasmota on my switches, so I'm afraid I won't be of much help here. Good luck :)

rickvdl avatar Dec 18 '19 20:12 rickvdl

@rickvdl Hey! Thanks for this PR, it helped me to successfully flash my sonoffs. πŸ‘

mariuszmikolajczak avatar Jan 22 '20 17:01 mariuszmikolajczak

I have this problem and I can't find the solution. Sonoff won't connect to my wifi, the captive portal won't shut down.

This doesn't seem to solve my problem.

I have a Sonoff RF R2

Any solutions? Thank you

pablorierad avatar Feb 03 '20 16:02 pablorierad

@pablorierad Did you confirm erasing actually worked? (It might be that you have to change the serial port in the .sh script to your actual port)

rickvdl avatar Feb 03 '20 16:02 rickvdl

Thank you for your immediate response.

I copy the code from my terminal to show the procedure. I don't think I'm wrong about anything.

First I erase

iMac-de-Pablo:esptool-master pablorieraduarte$ sudo ./esptool.py -p /dev/cu.usbserial-A92DH7ZN --baud 115200 erase_flash
esptool.py v2.9-dev
Serial port /dev/cu.usbserial-A92DH7ZN
Connecting....
Detecting chip type... ESP8266
Chip is ESP8285
Features: WiFi, Embedded Flash
Crystal is 26MHz
MAC: dc:4f:22:be:b9:f7
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 3.1s
Hard resetting via RTS pin...
iMac-de-Pablo:esptool-master pablorieraduarte$ 

Then I load the firmware

iMac-de-Pablo:esptool-master pablorieraduarte$ POWERON_STATE="ON"
iMac-de-Pablo:esptool-master pablorieraduarte$ SONOFF_PORT="/dev/cu.usbserial-A92DH7ZN"
iMac-de-Pablo:esptool-master pablorieraduarte$ 
iMac-de-Pablo:esptool-master pablorieraduarte$ #SONOFF_PORT="/dev/cu.SLAB_USBtoUART"
iMac-de-Pablo:esptool-master pablorieraduarte$ sudo ./esptool.py -p $SONOFF_PORT --baud 115200 write_flash -fs 1MB -fm dout -ff 40m 0x0 ./firmware/rboot.bin 0x1000 ./firmware/blank_config.bin 0x2000 ./firmware/Sonoff_$POWERON_STATE.bin
esptool.py v2.9-dev
Serial port /dev/cu.usbserial-A92DH7ZN
Connecting....
Detecting chip type... ESP8266
Chip is ESP8285
Features: WiFi, Embedded Flash
Crystal is 26MHz
MAC: dc:4f:22:be:b9:f7
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash params set to 0x0320
Compressed 3104 bytes to 2169...
Wrote 3104 bytes (2169 compressed) at 0x00000000 in 0.2 seconds (effective 119.3 kbit/s)...
Hash of data verified.
Compressed 2048 bytes to 23...
Wrote 2048 bytes (23 compressed) at 0x00001000 in 0.0 seconds (effective 1025.7 kbit/s)...
Hash of data verified.
Compressed 476756 bytes to 337774...
Wrote 476756 bytes (337774 compressed) at 0x00002000 in 30.0 seconds (effective 127.1 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
iMac-de-Pablo:esptool-master pablorieraduarte$ 

After turning it on, the captive portal appears, I try to connect to my wifi but it never closes or connects, I can see it with my router.

pablorierad avatar Feb 03 '20 16:02 pablorierad

@pablorierad Right, that looks OK to me, I'm sorry but I don't have any clue on what could be wrong, I don't maintain this project :) FYI I switched to Tasmota myself and let HomeAssistant do the communication with Homekit, since it appears to be a lot 'lighter' for the Sonoffs to run and it's much better supported.

Cheers

rickvdl avatar Feb 03 '20 16:02 rickvdl

The only time I had same issue as you it’s when I did not erase it properly. Also only times I struggle to connect is when I have 5ghz on WiFi. So usually I would switch it to only 2ghz and then connect. Not sure if I understand exactly what is the problem you have

Get Outlook for iOShttps://aka.ms/o0ukef


From: Rick [email protected] Sent: Monday, February 3, 2020 4:34:04 PM To: Gruppio/Sonoff-Homekit [email protected] Cc: gsvan [email protected]; Mention [email protected] Subject: Re: [Gruppio/Sonoff-Homekit] Added an erase.sh script that will erase the Sonoff's flash (#6)

@pablorieradhttps://github.com/pablorierad Right, that looks OK to me, I'm sorry but I don't have any clue on what could be wrong, I don't maintain this project :) FYI I switched to Tasmota myself and let HomeAssistant do the communication with Homekit, since it appears to be a lot 'lighter' for the Sonoffs to run and it's much better supported.

Cheers

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Gruppio/Sonoff-Homekit/pull/6?email_source=notifications&email_token=ALSVHGGN4KHFCSIS4MBDGTLRBBBPZA5CNFSM4JRAYFH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKUQB6Q#issuecomment-581501178, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALSVHGC7INC44HKOWGSQGFTRBBBPZANCNFSM4JRAYFHQ.

gsvan avatar Feb 03 '20 16:02 gsvan

Sorry meant 2.4gHz

Get Outlook for iOShttps://aka.ms/o0ukef


From: G S [email protected] Sent: Monday, February 3, 2020 4:36:32 PM To: Gruppio/Sonoff-Homekit [email protected]; Gruppio/Sonoff-Homekit [email protected] Cc: Mention [email protected] Subject: Re: [Gruppio/Sonoff-Homekit] Added an erase.sh script that will erase the Sonoff's flash (#6)

The only time I had same issue as you it’s when I did not erase it properly. Also only times I struggle to connect is when I have 5ghz on WiFi. So usually I would switch it to only 2ghz and then connect. Not sure if I understand exactly what is the problem you have

Get Outlook for iOShttps://aka.ms/o0ukef


From: Rick [email protected] Sent: Monday, February 3, 2020 4:34:04 PM To: Gruppio/Sonoff-Homekit [email protected] Cc: gsvan [email protected]; Mention [email protected] Subject: Re: [Gruppio/Sonoff-Homekit] Added an erase.sh script that will erase the Sonoff's flash (#6)

@pablorieradhttps://github.com/pablorierad Right, that looks OK to me, I'm sorry but I don't have any clue on what could be wrong, I don't maintain this project :) FYI I switched to Tasmota myself and let HomeAssistant do the communication with Homekit, since it appears to be a lot 'lighter' for the Sonoffs to run and it's much better supported.

Cheers

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Gruppio/Sonoff-Homekit/pull/6?email_source=notifications&email_token=ALSVHGGN4KHFCSIS4MBDGTLRBBBPZA5CNFSM4JRAYFH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKUQB6Q#issuecomment-581501178, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALSVHGC7INC44HKOWGSQGFTRBBBPZANCNFSM4JRAYFHQ.

gsvan avatar Feb 03 '20 16:02 gsvan

@rickvdl Thank you. I'll keep looking for a solution.

@gsvan Yeah, I only have 2.4gHz.

pablorierad avatar Feb 03 '20 17:02 pablorierad

I found the solution.

My problem was that I didn't connect to my router, the solution was to change the name of my network.

Only with that it already works. I hope I can help someone.

pablorierad avatar Feb 08 '20 13:02 pablorierad

This proved to be a necessary first step. FWIW I was successful in flashing a Sonoff S31 Lite.

ThomPatterson avatar Mar 02 '20 14:03 ThomPatterson