kakopappa / arduino-esp8266-alexa-wemo-switch

Amazon Alexa + WeMos switch made with Arduino D1 Mini

Home Page:https://sinric.pro

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

having issues with keeping wemos d1 connected

rramesh68 opened this issue · comments

I am not a software programmer by profession and I am just a DIY enthusiast so plese go easy on me as I put down my peculiar problem.

When I first configured my first 4 devices on Sinric and got it to work with my echo dot, I was thrilled. The convenience of lying in bed and ordering alexa to turn lights and fans off and on was unmatched like never before. That was using an NodeMCU. Then I discovered the Wemos D1 board and I decided to try that and made my second alexa controlled switch (8 relays) and improved the design by putting it into a more professional looking box etc.

Rather than running extra lenghts of wire from various rooms to one common Alexa controlled switch board, i decided to replicate my 8 relays switch boxes in most rooms till I had a total of four boxes. All of them were connected to the same network using the same SSID and PWD.

There was this occasional issue with some of the boards not responding once in 4-5 days and it took recycling the power to reset the board. This is when I came across a piece of code on the net which introduced the HEARTBEATS as thus and I thought that improved the performance a bit. So now my loop included this code snippet as below:-

webSocket.loop();

if(isConnected) {
uint64_t now = millis();

  // Send heartbeat in order to avoid disconnections during ISP resetting IPs over night. Thanks @MacSass
  if((now - heartbeatTimestamp) > HEARTBEAT_INTERVAL) {
      heartbeatTimestamp = now;
      webSocket.sendTXT("H");          
  }

Then from elsewhere I came across another code which suggested making a function called setupWifi() and calling it in the loop.
This led to introducing the lines below in the loop function.

if (WiFi.status() != WL_CONNECTED)
{
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
setupWifi();
}

All in all I though I had the issues with Wemos D1 sleeping solved. But in fact it seems to have worsened. Looking at the code, I don't think there is anything there to really make it worse. But that may be my lack of experience talking.

So now I have the Alexa app and I also have the SINRIC app on my phone. When I notice the devices are not getting switched ON/OFF, I notice the device state does not change on the SINRIC app either. However Alexa seems to have no problems acknowledging to my requests with the usual "Okay".

The next thing I did while these problems were around was to try and set up IFTTT to send a text to my phone when the device state changed. That made it significantly worse.

The strange thing is the same unresponsive switches start automatically after a while. Now I am not sure if the 5 minute HEARTBEAT interval has anything to do with that.

So I am not sure if there is a limitation in connecting so may Wemos D1 modules all to the same network. Unlikely but I will still ask.

Does the webhook, IFTTT messaging and sinric have any known compatibility issues that I am not aware of?

Please help. Thank you in advance.

Hmmm,
not sure it´s a good idea to pull up an old thread for a new issue ... you might get way better feedback opening a new thread.

But: I can state that just since today I´m also getting Alexa feedback saying "the device did not respond" although it does work will. I´m suspecting there is some slowdown from sinric.pro in the Alexa response that causes this.
Alexa requires a response in a given time - and it looks like this response is coming too slow currently.

Not sure what is causing this - but I would suspect it will get fixed soon on sinric.pro backend ...

Regards - MacSass