Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes firmware yells "WiFi FAILED!" but device answers to pings. #19

Open
linuxlurak opened this issue May 7, 2017 · 12 comments
Open

Comments

@linuxlurak
Copy link

linuxlurak commented May 7, 2017

HASS Version: 0.44
Sonoff Basic "2017 Version"
Sonoff-HomeAssistant version: ESPsonoff-v1.01tOTA

Repeatedly I saw the message "WiFi FAILED!" three or four times in a row in my arduino ide serial monitor on COM. I waited for the mqtt broker connection to show up with "ok". But nothing showed up. Not even "Connecting to " appears. Instead the device restarts and prints again "WiFi FAILED!".

I see in the sources that the devices restarts after failing to connect to wifi. So thats expected and working. No problem with restarting after failing. Problem seems to be the detection mechanism for successful wifi connection establishment.

At any time I can ping my device even if it thinks that wifi failed. There is no other device in my network with the same ip address. If I cut power to my Sonoff no pings return.

Any idea why connecting to wifi checking wifi connection fails? Is the routine for checking the connection reliable/state of the art?

After some time wifi works obviously since I can switch the relay of my Sonoff.

What else can I provide you for debugging?

Cheers and thanks for your work.

@1043717432
Copy link

I also have the same problem, the second day in the morning IP Ping barrier. Continuous attention, thank you, author

@PonyOny
Copy link

PonyOny commented Jun 3, 2017

I am having the same problem, seem it has hard time to connect to Wifi i'm receiving this several times and not conecting to Wifi, sometimes it connects just fine after some atempts.

mqtt broker connection . . . . . . . . . . LOST

ets Jan 8 2013,rst cause:1, boot mode:(3,7)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v3de0c112
~ld

---------------- Sonoff Powerpoint v1.01pOTA -----------------

Unit ID: esp8266-A795F3
Connecting to XXXXXX Wifi . . . . . . . . . . WiFi FAILED!


@Phileep
Copy link

Phileep commented Jun 5, 2017

I have had this issue also with my sonoff basics. I use my own firmware but they were often not identifying that they were connected to the wifi network.

This is an ESP8266 Arduino issue, not specific to this firmware.

It is noted in the esp8266 arduino issues #2186 and forums

I added to the setup section in my own code the following

  WiFi.persistent(false);
  WiFi.mode(WIFI_OFF); 

immediately before the line:
WiFi.mode(WIFI_STA);

This has made my sonoffs stable with connecting to my wifi - suggest you try it also. It is a workaround until the arduino code is somehow fixed.

Try it in the kman code and see if it works for you.

@1043717432
Copy link

@Phileep Thank you for sharing, i am a novice, would i ask where to add in the firmware? Can I intercept an image for me?

@Phileep
Copy link

Phileep commented Jun 5, 2017

1043717432,

you have to add the 2 lines inside the relevant .ino file that you are using.

It should be in the section marked setup() - but you can search for the line WiFi.mode(WIFI_STA); and add the two lines suggested immediately above that line.

Then upload the code to the sonoff

@1043717432
Copy link

@Phileep Hi, is this added?
wifi8266

@PonyOny
Copy link

PonyOny commented Jun 5, 2017

Hi, thanks for reply, I added those lines of code but still facing the same issue :( that did not fix the problem, any other thing to try?

thanks.

This is the imediat output after uploading the code:

. . . . . . . . . . WiFi FAILED!


mqtt broker connection . . . . . . . . . . LOST

ets Jan 8 2013,rst cause:1, boot mode:(1,7)

ets Jan 8 2013,rst cause:4, boot mode:(1,7)

wdt reset

Then I have to reset the device and this is the output all the time.

. WiFi FAILED!


Relay . . . . . . . . . . . . . . . . . . OFF //Pushed the button manually
Relay . . . . . . . . . . . . . . . . . . ON //Pushed the button manually
mqtt broker connection . . . . . . . . . . LOST

ets Jan 8 2013,rst cause:1, boot mode:(3,7)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v3de0c112
~ld

---------------- Sonoff Powerpoint v1.01pOTA -----------------

Unit ID: esp8266-A795F3
Connecting to XXXXX Wifi . . . . . . . . . . WiFi FAILED!


@Phileep
Copy link

Phileep commented Jun 5, 2017

sorry then, my only suggestion is read the issues thread for esp8266 in my link above - that is how I solved my issue.

It does seem to depend on what version of esp8266 board in the arduino IDE you are running etc.

@linuxlurak
Copy link
Author

linuxlurak commented Jun 5, 2017

@Phileep what is it about arduino? Do you mean the arduino IDE (the programming gui where you write the code, compile and upload it)? That's the only thing about arduino. The esp-8266 (I am using an esp-01) has nothing else to do with arduino... The esp8266 is no arduino chip. It's a esp8266 chip. The modules (meaning the PCB) just combine some flash chip with the esp chip. So on the hardware side there ist nothing about arduino (typically this would be some kind of ATMEGA chip).

@Phileep
Copy link

Phileep commented Jun 5, 2017

Tweaked my last comment to show I mean Arduino IDE. Again, see the link in my first post if you want more detail.

My suggestion worked for me in my use case in my own Arduino sketch for the Sonoff.

Unfortunately, some peoples mileage has varied.

That's all I have to contribute to this issue.

@linuxlurak
Copy link
Author

@Phileep: Thanks for the hint. I'll check on it as soon as I get the time to.

@KmanOz
Copy link
Owner

KmanOz commented Jun 11, 2017

Thanks Phil. This is talked about in the Community Forum so didn't bother answering here. I'll leave this here for reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants