Amazon Echo ESP8266 control, with natural speech commands

Then I have no idea. Maybe start by isolating the offending trigger. Alternate commenting out the lines:

  • timer.setInterval(100, ButtonCheck);
  • Blynk.run();
    and
  • wemoManager.serverLoop();

to see where the offending signals are coming from.

I use echo dot, sonoff basic with nodemcu fimware. Upload code its fine. Alexa find new device.
Now, can you tell me what is the name of the device that is how to turn it on/off over alexa ??

The second question, which I need to change in the code, is to turn off the state when I plug the electricity lamp.

After uploading the code I did not get the AP and the network configuration, despite the fact that the blynk application works?
Is there something weird, since there is no auth and passw in the code anywhere. ?? The question is how the sonoff connected to my network without this data in the code ??

The code uses Wifi Manager to allow you to input the SSID and password. If your NodeMCU has previously connected to your wireless network (by having code uploaded that contains the correct credentials) it will remember these details and attempt to connect using them. If it can’t connect then Wifi Manager will go into access point mode to allow you to input valid credentials.

Pete.

He was connected to the network but with the Sonoff Fimvare, with Nodemcu fimvare and this code for the first time. Perhaps the router was remembered by the Mac address. But that’s strange to me. By the way, it works through alexa. My mistake, I did not read the instructions properly.
I still have to figure out, how to make the lamp state off when I plug it in electric socket.
And it would be great if it could be open / close instead of on / off

Pete is correct. A quirk of the ESP8266 (and all of its derivatives) is that it remembers your wifi credentials independent of any code you upload to it.

If you want the device to start in the OFF state, just comment out these two lines in setup:
Blynk.virtualWrite(VPIN, HIGH);
Blynk.syncVirtual(VPIN);

As for what to call the device with Alexa, you can call it whatever you like. That’s the beauty of it. Simply go into the Alexa app on your phone or tablet, and under “Smart Home”, click on “Create Group.” The word “group” is a bit of a misnomer, since a group might contain just one device. Anyway, name the group whatever you want to (lamp, tv, living room, etc), and under the group heading, tick the box next to each of the devices that you want to control with that group name. For example, you might name your group “bedroom lamp.” Now just tick the device that’s connected to your bedroom lamp, and when you ask Alexa to “turn on the bedroom lamp,” and she will. You might create another group called “all the lights,” and tick the boxes for every device in your home that’s connected to a light. Then, when you’re headed to bed, you just ask Alexa to “turn off all the lights,” and every light in the house turns off.

The great thing about this is that you can create all sorts of groups, and you get to choose the language you use. The only limitation is that you have to use the words ON and OFF to define the state.

Another tip:

If you’re going to use a lot of these devices, you can simplify their identification within the Alexa app by giving them unique names in the Arduino code. I used “SonOfWemo” in the examples above, but you can change that to any names you like.

SonOfWemo was just a little pun, alluding to the fact that the device was the “offspring” of the Belkin Wemo, and built on Sonoff hardware.

I already have commented
Blynk.virtualWrite (VPIN, HIGH);
Blynk.syncVirtual (vpin);
But the condition of the lamp is ON
Thx.

Oh, you’d also have to comment out the line:

digitalWrite(RelayPin, HIGH); // Turn relay ON when unit is powered on

I did not succeed, the ON lamp state again, I tried to change
Boolean LampState = 1; Instead of 0
But nothing again.

I also noticed that LED on a SONOFF never works.
It does not bother me, but maybe help in this case

@mediax Try the code from the January 19 post.

1 Like

Yes, the first code works great. I’m sorry I was bored, I thought they were the same.
I will also save another code for use on light coming from an electrical box. Although I have not understood well enough to connect the wires.
But slowly, maybe I can find a way.

Chrome, you’ve been talking about electric shutters. Do you have any code for that?
This code is not good for that.

My electric rollers are connected in a way: one wire is live, and the other two are for opening and closing.

We should code with the interlocking function. So only one relay can work at a specified time, if another relay is working then the first must be switched off.

Similar to the Sonoff 4channel with interlocking function, only we need 2 chanell reley (for example, sonoff dual)

So that one relay could use to open and the other to close.

Just gonna leave this here…

1 Like

HI All,
I have my ESP8266 connected on the WiFi and the Blynk sees it available and can control it no problems, but I can t enable the AMAZON Wemo skill to discover the device, and the Wemo APP requires MAC adress and WiFi credentials…
Does this mean that the NEW Wemo skill blocks me from using the Fake Wemo kit… Alexa cant discover the Wemo device without the NEW skill enabled. Any known workaround? any help would be much apreciated.
Regards
Hercules

I’ve never had to enable a Wemo skill (new or old) to control these devices with Alexa. Both Wemo and Hue control are built into the Alexa ecosystem. Just go int the Alexa app’s smart home menu, select “devices,” and click “discover.” That should find all the fake Wemos.

As for the stock Wemo app, you don’t need it.

Hey @chrome1000,

I was trying out your code but I am trying to use multiple switches. I am using a NodeMcu and I am facing a problem with the physical button sync in the multiple switches case could you help me out if you have tried anything of this sort?

I’m not quite sure what you’re attempting. Are you saying that you want the physical switch of one device to turn several other devices off or on?

Or do you have a single NodeMCU controlling several relays?

In either case, what is it that you WANT the physical switch to do?

@chrome1000
Sorry for confusing you but ya I have a single NodeMcu controlling multiple switches. I got it working just had to replicate it multiple times. now I need a suggestion from you. So the setup I have has 4 Hardware switches(Spring Switches) which are connected to the Node MCU and the NodeMCU is also connected to the Relays which are intern connected to the appliances. This whole system works when we have internet connectivity. can there be anyway by which in main loop we could have a logic (While) which would check if we have internet connectivity and if not it would execute the code in the while loop, inside that while loop, we could have button check logic which would let us get the relays working even if we don’t have internet connectivity.

Response to comments about mains power as per @chrome1000. I live in Australia which uses 240VAC. I very recently bought several Sonoff switches, which switch the mains live wire directly. I have been messing around with wiring things for for 240 VAC for 60 years! There is no way I would try to switch a mains line with these - the terminals are just too close together. They do not meet safety standards. I have met this problem with Chinese products before - a lot of AC-DC converters, for example, are rated for 110V/240V. May be just OK for 110V, but not 240V. Wired carefully, they may be OK for a short while, but with time you will get a , flash, a loud bang and smoke! Sonoff’s should be used to switch something like 12V or 24V which in turn switches a properly rated 240V relay.
Having made that comment, as an aged newbie, maybe someone can help with a more general query about Blynk projects. I have been comfortable for years with VB6, but have not programmed usefully in C. My task is to operate a remote heating switch using a mobile phone app. At the switch, there is 3G signal, but no wifi. Thus I bought the Sonoff G1 switch which purportedly can be operated by the 3G link dialed up from the remote smartphone. My phone runs Android 4.4.4. I have spent frustrating days trying to get the app EWeLink registered and have almost given up. That’s why I took a look at Blynk. Can Blynk do that? I don’t want fancy voice activation - just to press a button on a phone app from 10 km away. Or can someone suggest an alternate app to EWeLink or even if they have managed to get that running on an older Android phone with Kitkat or lower? Hope to hear from you.

@carlsnilsson Blynk is fine with Android 4.x and I also have lots of 3G WiFi routers here so it’s incorrect to say to have 3G but no WiFi.

I’ll take a look at the Sonoff G1.

As far as I can see there is no “dial up” feature for the G1. It looks likes it’s permanently running on a GSM network. Data throughput via Blynk is very low so you could use a 3G router and an ESP as an alternative to the G1. Otherwise you would need to hack the G1 firmware to accept Blynk.