Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By Bill Weis
#72839 I have a sketch that I use to turn on one of four relays (timed for 3 seconds). If I compile and upload that sketch, then perform a Discover Devices, the switches show up in the Smart Home - Devices page on the Amazon\Alexa webpage. Following the discovery, each of the relays turn on for the 3 second timed interval and then as long as those switches don't go offline to the Amazon app, all is good. (With the exception that anytime you go to the Amazon\Alexa ->Smart Home ->Devices webpage, or refresh that page, or hit another Discover on that page, the relays will once again cycle on for 3 seconds then off, regardless of the status of the switches <offline vs online don't matter>)

I am curious why simply going to the Amazon Devices webpage will trigger another cycling of the relays. Here is what I see in the serial port log. Has anyone seen this and come up with a solution?

request:"1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>1</BinaryState></u:GetBinaryState></s:Body></s:Envelope>
Got Turn on request
Switch 1 turn on ...########## Responding to /upnp/control/basicevent1 ... ##########
"1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>1</BinaryState></u:GetBinaryState></s:Body></s:Envelope>

Here is a portion of the sketch
void headOn() {
Serial.print("Switch 1 turn on ...");
// digitalWrite(relayPin1, LOW); //relay on
pinMode(relayPin1, OUTPUT); //Open Drain
;delay(3000); //wait for milliseconds 1000ms = 1 second
// digitalWrite(relayPin1, HIGH); //relay off
pinMode(relayPin1, INPUT); //Open Drain
}