EcoRenovator

EcoRenovator (https://ecorenovator.org/forum/index.php)
-   Appliances & Gadgets (https://ecorenovator.org/forum/forumdisplay.php?f=21)
-   -   Echo, Office light On. (https://ecorenovator.org/forum/showthread.php?t=6259)

Xringer 12-31-17 04:46 PM

Echo, Office light On.
 
1 Attachment(s)
The Amazon Echo Dot is a pretty neat voice interface.
I use it to control some cheap RF remote control sockets for a few lights in the house.

A while back, I saw a new module that I liked..
https://www.ebay.com/itm/Latest-mini...d/222624406008

https://i.ebayimg.com/images/g/Vr0AA...N71/s-l500.jpg

I watched this video, to learn how to use it..
https://youtu.be/j8rier8fYVk
I have a 4-relay board connected (it works)!

My plan is to operate the garage doors on our detached garage..
My wife will just have to say, "Echo, Open Sesame" etc. & the internet does the work.. :)

Xringer 01-01-18 09:36 AM

Alexa 'Routine'
 
In the USA, Alexa has added a Routine feature.
(Only works with Alexa app, not on Windows [online Alexa] yet).

https://www.howtogeek.com/332042/how...vices-at-once/

Here's the Routine that I'm working on for the RAV4 garage door.
The Since ON puts out a '1' and OFF puts out a '0', I have to use inverted logic.

I want to hold the NO relay2 contact closed for about 1.5 seconds. So, I say "Echo, Open Carport".
Routine will turn ON the relay with 'Turn Off relay2', run a time-waste: Alexa says "Farewell", then opens the NO relay with 'Turn on relay2'.
I can change what Alexa says, for a longer delay if needed.

Anyways, I discovered that it's easy to change the (Simulated Wemo switches) switch mode (off/on) while adding that operation to the Routine.
One other thing I really like, if I make a mistake and the Actions are not in the correct order, I can just hold-click and drag them where I want them..

http://ecorenovator.org/forum/attach...1&d=1514819821

Xringer 01-01-18 09:59 AM

My IDE edited sketch
 
This will give you an idea of how the module code (sketch) works.
The Serial.printf lines will send text back to your PC, so you can see what the program is doing (use the IDE Serial Monitor, in Tools).
Once installed in the garage, those lines won't be needed..


/************************************************** ********************************
* Code for controlling multiple devices connected to one NodeMCU using Amazon Echo
*
* Written by Sid for Sid's E Classroom.. Edited 1/1/2018 by Rich
*
* https://www.youtube.com/c/SidsEClassroom
************************************************** *******************************/
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include "fauxmoESP.h"

#define WIFI_SSID "*******"//change your Wifi name
#define WIFI_PASS "*******"//Change your Wifi Password
#define SERIAL_BAUDRATE 115200

fauxmoESP fauxmo;
//declare switching pins
//Change pins according to your NodeMCU pinouts
#define Relay1 D1
#define Relay2 D2
#define Relay3 D3
#define Relay4 D4
// -----------------------------------------------------------------------------
// Wifi Setup
// -----------------------------------------------------------------------------

void wifiSetup() {

// Set WIFI module to STA mode
WiFi.mode(WIFI_STA);

// Connect
Serial.printf("[WIFI] Connecting to %s ", WIFI_SSID);
WiFi.begin(WIFI_SSID, WIFI_PASS);

// Wait
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(100);
}
Serial.println();

// Connected!
Serial.printf("[WIFI] STATION Mode, SSID: %s, IP address: %s\n", WiFi.SSID().c_str(), WiFi.localIP().toString().c_str());
}
// -----------------------------------------------------------------------------
// Device Callback
// -----------------------------------------------------------------------------
void callback(uint8_t device_id, const char * device_name, bool state) {
Serial.print("Device "); Serial.print(device_name);
Serial.print(" state: ");
if (state) {
Serial.println("ON");
} else {
Serial.println("OFF");
}
//Switching action on detection of device name
if ( (strcmp(device_name, "Relay1") == 0) ) {
// adjust the relay immediately!
if (state) {
digitalWrite(Relay1, HIGH);
} else {
digitalWrite(Relay1, LOW);
}
}
if ( (strcmp(device_name, "Relay4") == 0) ) {
// adjust the relay immediately!
if (state) {
digitalWrite(Relay4, HIGH);
} else {
digitalWrite(Relay4, LOW);
}
}
if ( (strcmp(device_name, "Relay2") == 0) ) {
// adjust the relay immediately!
if (state) {
digitalWrite(Relay2, HIGH);
} else {
digitalWrite(Relay2, LOW);
}
}
if ( (strcmp(device_name, "Relay3") == 0) ) {
// adjust the relay immediately!
if (state) {
digitalWrite(Relay3, HIGH);
} else {
digitalWrite(Relay3, LOW);
}
}
}

void setup() {
//Initialize pins to Low on device start.. This WAS low, edited to High. :p
pinMode(Relay1, OUTPUT);
digitalWrite(Relay1, HIGH);
pinMode(Relay2, OUTPUT);
digitalWrite(Relay2, HIGH);
pinMode(Relay3, OUTPUT);
digitalWrite(Relay3, HIGH);
pinMode(Relay4, OUTPUT);
digitalWrite(Relay4, HIGH);

// Init serial port and clean garbage
Serial.begin(SERIAL_BAUDRATE);
Serial.println("FauxMo demo sketch");
Serial.println("After connection, ask Alexa/Echo to 'turn <devicename> on' or 'off'");

// Wifi
wifiSetup();

// Device Names for Simulated Wemo switches
fauxmo.addDevice("Relay3");
fauxmo.addDevice("Relay1");
fauxmo.addDevice("Relay2");
fauxmo.addDevice("Relay4");
fauxmo.onMessage(callback);
}

void loop() {
fauxmo.handle();
}

~~~~
Sketch uses 252385 bytes (24%) of program storage space. Maximum is 1044464 bytes.
Global variables use 34960 bytes (42%) of dynamic memory, leaving 46960 bytes for local variables. Maximum is 81920 bytes.

Xringer 01-10-18 08:53 AM

installed and working
 
1 Attachment(s)
I have the new garage door opener gadget installed and working.
There were some problems with the relay. It seemed to be sticking 'Closed'..
Not sure about this, but I believe the WiFi command may have been coming too fast for the little CPU.:confused:
Using the speech output as a delay seemed a little erratic. The speech delay may have caused the 'stuck relay' bug..
So, I moved the speech output near the bottom of the Routine stack, as a completion signal.

For a time delay, I switched on & off the unused relay 4. It seems to work fine now.
At the bottom of the Routine scrip, I added one last 'Open' function, for safety.

My wife was smiling this morning when she used our code words to open the garage.
We decided not to use "Alexa Open Garage Door", since I like to watch YouTube videos that sometimes tend to command Alexa to open things.. :o

(If the on-off commands seem strange, that's due to the relay requirement of a '0', to close their NO contacts. Negative Logic).

Xringer 01-17-18 06:42 PM

I had some kind of timing problem with the garage door 'sketch' (above) and had to edit out
anything that seemed like it would slow down execution.
I think those serial outputs for monitoring Flow, may have been slowing things down. It's smaller now and seems to be working flawlessly with Alexa (and Echo)..
Not sure about my wife's Boston-speak, but I don't think 'door' is pronounced 'dough-ahh'. :p
That ESP8266 module is inside a water resistant box, hardwired into the garage doors (for now)..

I just had to order a couple more ESP modules and found a nice 'sketch' for sending information from the module, using email or SMS..
It works pretty well. I'm using the example sketch for now.
Not sure where I'll use this, but maybe something to add-on to the security system,
or the smoke & CO detectors.. Maybe even basement flood detectors.?.
$3.69 isn't bad for what it can do..


https://github.com/connornishijima/AlertMe

"Did you know your ESP8266 could send Email and SMS without any special hardware or paid services like Twilio?

With AlertMe, your ESP8266 project can:

Email you when an external sensor triggers, such as a button press, tilt, vibration, or any other sensor/interrupt combo you can think of!
Text you when a motion sensor detects something it shouldn't!
Quickly connect to any WiFi network, with hotspot configuration of your notification settings!
Send Email through the provider of your choice via SMTP! (*Only Gmail tested so far)
Send SMS through your cell phone carrier's SMS-to-Email portal! (Over 200 worldwide carriers supported)
"

pinballlooking 01-17-18 07:59 PM

Cool work.

I have a bunch of insteon home automation. It works with a gateway with Alexa.
We use it to turn on and off lights every day. I have a dot turn on my bathroom light before I get up every day. That starts my hot water loop so by the time I get to wash my hands the hot water is there waiting on me.

I use it 10 or more times a day.

Xringer 01-17-18 10:08 PM

Nice.. I would love some hot water in the bathroom sink.. It's 4 minutes of 48F water before it starts warming up!!

We have been having intermittent problems getting the garage doors to open.. We have car-type remotes inside the house, that work the first try, about 70% of the time..

This ESP gadget + Alexia garage door hookup is working at 90% for my wife, and 100% for me..

I have another ESP8266 on order and also have some RCWL-0516 RADAR sensors on the way.. :D

pinballlooking 01-17-18 10:43 PM

1 Attachment(s)
I like your project better.
I cheated I recently bought this. I just need to take some time and install it.
It works remote with free phone apps.

http://ecorenovator.org/forum/attach...1&d=1516250567

https://www.chamberlain.com/garage-d...E&gclsrc=aw.ds

Xringer 01-18-18 12:05 PM

I like the idea of being able to run stuff, even when the internet isn't available.
That's the strong point of those programmable devices.. Peer-to-peer..
That GDO seems a little like one of those all-in-one devices (like some printers) when one of the important
functions dies, it triggers some buyers remorse..
Remember the DVD-VHS combo units? The VHS always died first. :( I have one in basement storage)..

Xringer 03-24-18 12:23 PM

My little ESP8266 out in the garage was failing to open the garage door sometimes..
Whenever there was a pause in Alexa's execution acknowledgment, the door failed to go up..

It rarely failed, but when it did fail a few weeks ago, I checked the network and didn't see the ESP8266!
It wasn't connected. I used a phone app to check the wifi signal level at the box..
It was around -70 db.. Which is pretty weak, considering the ESP8266 antenna is very tiny..

The "box" is a standard old water resistant plastic electrical outlet box..
I removed the plastic cover plate (with it's rubber gasket) and noticed it was pretty thick.
I installed a coroplas (plastic cardboard) cover. It seemed to have worked..
Because of the way the ESP8266's antenna is sitting right near the cover,
I believe the thicker plastic cover was de-tuning the antenna and making it drop the wifi router..
Especially with the strong wifi signal next door, on the same channel..
I have also moved my router up to a higher channel, which has a little less traffic..

Using Alexa with the ESP8266 to open the garage doors is now working at 100%. No failures.
(Unless someone sneezes while you are saying the command)!:eek:


All times are GMT -5. The time now is 12:28 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Ad Management by RedTyger