-
Notifications
You must be signed in to change notification settings - Fork 197
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
Alexa won't find more than 5 switches... #52
Comments
I came across the same problem. |
I am also struggling for same, If any one have solution please help us. I am giving less preference to Sinric as i dont want to control power from internet(security reason) I have seen after adding 5+ switches script start crashing(reboot nodemcu) and in VS 2017 i seen error stating some code trying to access cpu private info(in nodemcu). If you want i can share error. |
Here is my sketch, which works at least up to 5 switches. #include <ESP8266WiFi.h> // prototypes //on/off callbacks // Change this before you flash const int relayPin1 = 5; // D1 Pin boolean wifiConnected = false; UpnpBroadcastResponder upnpBroadcastResponder; Switch *Va = NULL; bool isVaOn = false; void setup() // Setup Relay // Initialise wifi connection if (wifiConnected) {
} void loop()
} bool VaOn() { bool VaOff() { bool VbOn() { bool VbOff() { bool VcOn() { bool VcOff() { bool VdOn() { bool VdOff() { bool VeOn() { bool VeOff() { bool VfOn() { bool VfOff() { // connect to wifi – returns true if successful or false if not WiFi.mode(WIFI_STA); // Wait for connection if (state) { return state; |
Hi,
I tried your given code but this code also searched for 4 device not more then that. Is it possible for you to check ping request for your nodemcu is breaking or not while in discovery mode.
And one more thing when you add more device 6th device your nodemcu will reboot every after some time.
From: Egon <[email protected]>
Sent: Friday, August 10, 2018 8:52 AM
To: kakopappa/arduino-esp8266-alexa-multiple-wemo-switch <[email protected]>
Cc: santosh09142 <[email protected]>; Comment <[email protected]>
Subject: Re: [kakopappa/arduino-esp8266-alexa-multiple-wemo-switch] Alexa won't find more than 5 switches... (#52)
Here is my sketch, which works at least up to 5 switches.
At the 6th switch (Vf) nothing works.
Maybe someone finds an error in the sketch?
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <WiFiUdp.h>
#include
#include "switch.h"
#include "UpnpBroadcastResponder.h"
#include "CallbackFunction.h"
// prototypes
boolean connectWifi();
//on/off callbacks
bool VaOn();
bool VaOff();
bool VbOn();
bool VbOff();
bool VcOn();
bool VcOff();
bool VdOn();
bool VdOff();
bool VeOn();
bool VeOff();
bool VfOn();
bool VfOff();
// Change this before you flash
const char* ssid = "xxxxxxxx";
const char* password = "yyyyyyyyy";
const int relayPin1 = 5; // D1 Pin
const int relayPin2 = 4; // D2 Pin
const int relayPin3 = 0; // D3 Pin
const int relayPin4 = 2; // D4 Pin
const int relayPin5 = 14; // D5 Pin
const int relayPin6 = 12; // D6 Pin
boolean wifiConnected = false;
UpnpBroadcastResponder upnpBroadcastResponder;
Switch *Va = NULL;
Switch *Vb = NULL;
Switch *Vc = NULL;
Switch *Vd = NULL;
Switch *Ve = NULL;
Switch *Vf = NULL;
bool isVaOn = false;
bool isVbOn = false;
bool isVcOn = false;
bool isVdOn = false;
bool isVeOn = false;
bool isVfOn = false;
void setup()
{
Serial.begin(9600);
// Setup Relay
pinMode(relayPin1, OUTPUT);
pinMode(relayPin2, OUTPUT);
pinMode(relayPin3, OUTPUT);
pinMode(relayPin4, OUTPUT);
pinMode(relayPin5, OUTPUT);
pinMode(relayPin6, OUTPUT);
// Initialise wifi connection
wifiConnected = connectWifi();
if (wifiConnected) {
upnpBroadcastResponder.beginUdpMulticast();
// Define your switches here. Max 10
Va = new Switch("eins", 80, VaOn, VaOff);
Vb = new Switch("zwei", 81, VbOn, VbOff);
Vc = new Switch("drei", 82, VcOn, VcOff);
Vd = new Switch("vier", 83, VdOn, VdOff);
Ve = new Switch("fünf", 84, VeOn, VeOff);
Vf = new Switch("sechs", 85, VfOn, VfOff);
Serial.println("Adding switches upnp broadcast responder");
upnpBroadcastResponder.addDevice(*Va);
upnpBroadcastResponder.addDevice(*Vb);
upnpBroadcastResponder.addDevice(*Vc);
upnpBroadcastResponder.addDevice(*Vd);
upnpBroadcastResponder.addDevice(*Ve);
upnpBroadcastResponder.addDevice(*Vf);
}
// 18.07.2018 Erweiterung durch Egon - Urzustand herstellen.
digitalWrite(relayPin1, LOW); // turn off relay with voltage LOW
digitalWrite(relayPin2, LOW); // turn off relay with voltage LOW
digitalWrite(relayPin3, LOW); // turn off relay with voltage LOW
digitalWrite(relayPin4, LOW); // turn off relay with voltage LOW
digitalWrite(relayPin5, LOW); // turn off relay with voltage LOW
digitalWrite(relayPin6, LOW); // turn off relay with voltage LOW
}
void loop()
{
if (wifiConnected) {
upnpBroadcastResponder.serverLoop();
Va->serverLoop();
Vb->serverLoop();
Vc->serverLoop();
Vd->serverLoop();
Ve->serverLoop();
Vf->serverLoop();
}
}
bool VaOn() {
Serial.println("Switch 1 turn on ...");
digitalWrite(relayPin1, HIGH); // turn on relay with voltage HIGH
isVaOn = true;
return isVaOn;
}
bool VaOff() {
Serial.println("Switch 1 turn off ...");
digitalWrite(relayPin1, LOW); // turn off relay with voltage LOW
isVaOn = false;
return isVaOn;
}
bool VbOn() {
Serial.println("Switch 2 turn on ...");
digitalWrite(relayPin2, HIGH); // turn on relay with voltage HIGH
isVbOn = true;
return isVbOn;
}
bool VbOff() {
Serial.println("Switch 2 turn off ...");
digitalWrite(relayPin2, LOW); // turn off relay with voltage LOW
isVbOn = false;
return isVbOn;
}
bool VcOn() {
Serial.println("Switch 3 turn on ...");
digitalWrite(relayPin3, HIGH); // turn on relay with voltage HIGH
isVcOn = true;
return isVcOn;
}
bool VcOff() {
Serial.println("Switch 3 turn off ...");
digitalWrite(relayPin3, LOW); // turn off relay with voltage LOW
isVcOn = false;
return isVcOn;
}
bool VdOn() {
Serial.println("Switch 4 turn on ...");
digitalWrite(relayPin4, HIGH); // turn on relay with voltage HIGH
isVdOn = true;
return isVdOn;
}
bool VdOff() {
Serial.println("Switch 4 turn off ...");
digitalWrite(relayPin4, LOW); // turn off relay with voltage LOW
isVdOn = false;
return isVdOn;
}
bool VeOn() {
Serial.println("Switch 5 turn on ...");
digitalWrite(relayPin5, HIGH); // turn on relay with voltage HIGH
isVeOn = true;
return isVeOn;
}
bool VeOff() {
Serial.println("Switch 5 turn off ...");
digitalWrite(relayPin5, LOW); // turn off relay with voltage LOW
isVeOn = false;
return isVeOn;
}
bool VfOn() {
Serial.println("Switch 6 turn on ...");
digitalWrite(relayPin6, HIGH); // turn on relay with voltage HIGH
isVfOn = true;
return isVfOn;
}
bool VfOff() {
Serial.println("Switch 6 turn off ...");
digitalWrite(relayPin6, LOW); // turn off relay with voltage LOW
isVfOn = false;
return isVfOn;
}
// connect to wifi – returns true if successful or false if not
boolean connectWifi() {
boolean state = true;
int i = 0;
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
Serial.println("");
Serial.println("Connecting to WiFi");
// Wait for connection
Serial.print("Connecting ...");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
if (i > 10) {
state = false;
break;
}
i++;
}
if (state) {
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
}
else {
Serial.println("");
Serial.println("Connection failed.");
}
return state;
}
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#52 (comment)> , or mute the thread <https://github.com/notifications/unsubscribe-auth/Aj_2zzQLecDjHbvge-V-lBzIZlfqqAJQks5uPPxcgaJpZM4VGkaX> . <https://github.com/notifications/beacon/Aj_2z4yBp2OALO0BvV4MfwdJZxfsaeikks5uPPxcgaJpZM4VGkaX.gif>
|
The basis of this sketch is the code of kakopappa "https://github.com/kakopappa/arduino-esp8266-alexa-multiple-wemo-switch". |
I found the same issue - discovery of new Alexa devices becomes more unreliable as more switches are added to the multiple-wemo code. 4 was my sweet spot.
Might be a timing issue related to the small 45 sec or 1 minute period that Alexa spends searching for new devices - there is A LOT of traffic on the debug screen for most of that period with 4 switches enabled.
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Egon <[email protected]>
Sent: Sunday, August 12, 2018 1:11 PM
To: kakopappa/arduino-esp8266-alexa-multiple-wemo-switch
Cc: Ynot1; Author
Subject: Re: [kakopappa/arduino-esp8266-alexa-multiple-wemo-switch] Alexa won't find more than 5 switches... (#52)
The basis of this sketch is the code of kakopappa "https://github.com/kakopappa/arduino-esp8266-alexa-multiple-wemo-switch".
I only expanded it by defining the outputs. In the above sketch, if all lines addressing the sixth output "Vf" are cleared, the 5-output sketch runs very reliably.
It may be that Alexa does not recognize all 5 outputs at the first scan. However, a second search leads to the desired result and all 5 switches have been found.
I suspect the bug that no more than 5 switches work flawlessly, somewhere in kakopappa's programs. I think we have to wait until the programmer has time to take care of the matter. He indicated this on 18 July 2018 at "#54<#54>".
santosh09142: I understand you so much that you did not get more than 5 switches to run. Why do you suppose that from the sixth switch, the modemcu would always reboot after a while?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#52 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AksU2oF9kaEwbbSwG3EjSmfcgUmo0nVKks5uP4CngaJpZM4VGkaX>.
|
If I define more than 5 switches, Alexa randomly fails to discover some of them. All the switches I have defined work fine idenpendanty, but discovery of all of them is a problem. The code says "max 10" - what limit is this, and have I hit it early?
The text was updated successfully, but these errors were encountered: