Comments (6)
I came across the same problem.
From the sixth switch Alexa will not find a new device. Also, Alexa does not find a previously known switch when asked to "switch one on".
Has anyone defined more than 5 switches successfully? If so, how?
from arduino-esp8266-alexa-multiple-wemo-switch.
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.
from arduino-esp8266-alexa-multiple-wemo-switch.
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;
}
from arduino-esp8266-alexa-multiple-wemo-switch.
from arduino-esp8266-alexa-multiple-wemo-switch.
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".
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?
from arduino-esp8266-alexa-multiple-wemo-switch.
from arduino-esp8266-alexa-multiple-wemo-switch.
Related Issues (20)
- How do you integrate mqtt for home assistant?
- Alexa and Synric Not Binding
- Echo Dot Gen 3 Compability HOT 13
- WiFiUDP.h: No such file or directory
- Analog values? HOT 2
- Help with multiple RCSwtich.h devices?
- How to change invocation word? Instead of " turn on" HOT 2
- No such file or directory HOT 2
- Connection problem between ESP3266 and alexa on amazon Echo HOT 6
- Not an Issue But a question HOT 5
- 3-way switch
- I can't use your Alexa skill for this project. When I ask Alexa to discover I get the following. HOT 5
- I am working on my NodeMCU v2 ESP 12-E module but every so often I get an Exception and the NodeMCU crashes. The stack is attached below HOT 1
- how to resolve this issue
- Add a push button to manually turn on/off the lights HOT 2
- Emulated wemos devices unresponsive in Alexa HOT 1
- Could not Compile the code
- Update status to Alexa HOT 1
- can i change invocation phrase? HOT 2
- Question on Alexa status HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduino-esp8266-alexa-multiple-wemo-switch.