![]() ![]() ![]() |
|
Previously known as psycik
Home Assistant: Gigabyte AMD A8 Brix, Home Assistant with Aeotech ZWave Controller, Raspberry PI, Wemos D1 Mini, Zwave, Shelly Humidity and Temperature sensors
Media:Chromecast v2, ATV4 4k, ATV4, HDHomeRun Dual
Server Host Plex Server 3x3TB, 4x4TB using MergerFS, Samsung 850 evo 512 GB SSD, Proxmox Server with 1xW10, 2xUbuntu 22.04 LTS, Backblaze Backups, usenetprime.com fastmail.com Sharesies Trakt.TV Sharesight
I have also been on the hunt for a way to use Alexa and my smartphone to open my garage.
I found this and are waiting for it to arrive.
https://aurahome.wixsite.com/aura/product-page/garage-door-opener-circuit-board
This place appears to be different from the Australian company https://www.aurahome.com/ as it is shipped out china and only has 2 products
This device was US$29.95 and states it can do this in-conjunction with the eWeLink app and IFFT
I shall have a play anyway.
My question however, is I have just got a new Dominator Garage door opener (Motor). The old opener had 2 simple terminals on the exterior to connect a wired switch to (momentary contact). On the new opener these are buried on the circuit board. I have found a reference to the terminal block connections in the manual, but they are very vague as to how to connect it. I suppose they want you to buy their $300 Smartphone/hub product.
Terminal Block.
24V PWR is used to power devices such as:
- PE (Input) for photo electric beam for safety and Auto-Close function.
- LGT (Input) allow hard wired external trigger for the opener’s courtesy light.
- O/S/C INPUT is used for the connection of a wired switch (momentary contact). This switch
can then be used to open, stop or close the door. Install the wall switch in a location where
the switch is out of reach of children and the garage door is visible.
So am I switching 24v on to the O/S/C terminals to trigger this? HELL NO!
Worked it out. 0V and OSC are the trigger terminals. FYI for anyone with a Dominator GDO9 Enduro opener
Terminals
V+| SB1| 0V |SB2| 0V| OSC |AUX
X X
SORTED
Thanks in advance
jonherries:snowfly:I've done this using a wemos d1 mini, relay shield, and reed door sensor. All up probably less than $20, with a little plastic case, and usb power cable.
Wemos d1 mini programmed directly via arduino ide, few lines of code.
Relay is normally open, connected to the same terminals on garage opener that our hard wired switch is connected.
To open or close door, just pulse the relay for 1 second (just like simulating pressing the hard wired button), to close circuit for 1 second.Reed switch tells me if door is open or closed.
You can find similar approach here: https://automatedhome.party/2017/01/06/wifi-garage-door-controller-using-a-wemos-d1-mini/
And a similar geekzone post here: https://www.geekzone.co.nz/forums.asp?forumid=141&topicid=198633
So, had a go at this approach myself and having trouble with triggering the relay (sensor works). Have tested that closing the pins on the door triggers the motor. Have then tried manually posting to the mqtt topic. Have yet to solder the relay shield but reluctant to if it is faulty. Is there a simple way to trigger or test the relay itself - guessing adding some sort of voltage on the expected pin? If so how much?
Jon
#include //ESP8266 Core WiFi Library (you most likely already have this in your sketch)
#include //Local DNS Server used for redirecting all requests to the configuration portal
#include //Local WebServer used to serve the configuration portal
#include //https://github.com/tzapu/WiFiManager WiFi Configuration Magic
#include //MQTT
#include
#include
////**********START CUSTOM PARAMS******************//
//Define parameters for the http firmware update
const char* host = "GarageESP";
const char* update_path = "/WebFirmwareUpgrade";
const char* update_username = "admin";
const char* update_password = "YourPassWordHere";
//Define the pins
//#define RELAY_PIN 5
//#define DOOR_PIN 4
const int relayPin = D1;
const int doorPin = D2;
//Define MQTT Params. If you don't need to
#define mqtt_server "MQTT Broker IP Address"
#define door_topic "garage/door"
#define button_topic "garage/button"
const char* mqtt_user = "mqtt_user";
const char* mqtt_pass = "mqtt_pass";
//************END CUSTOM PARAMS********************//
//This can be used to output the date the code was compiled
const char compile_date[] = __DATE__ " " __TIME__;
//Setup the web server for http OTA updates.
ESP8266WebServer httpServer(80);
ESP8266HTTPUpdateServer httpUpdater;
WiFiClient espClient;
//Initialize MQTT
PubSubClient client(espClient);
//Setup Variables
String switch1;
String strTopic;
String strPayload;
char* door_state = "UNDEFINED";
char* last_state = "";
//Wifi Manager will try to connect to the saved AP. If that fails, it will start up as an AP
//which you can connect to and setup the wifi
WiFiManager wifiManager;
long lastMsg = 0;
void setup() {
//Set Relay(output) and Door(input) pins
pinMode(relayPin, OUTPUT);
//pinMode(relayPin, LOW);
pinMode(doorPin, INPUT);
Serial.begin(115200);
//Set the wifi config portal to only show for 3 minutes, then continue.
wifiManager.setConfigPortalTimeout(180);
wifiManager.autoConnect(host);
//sets up the mqtt server, and sets callback() as the function that gets called
//when a subscribed topic has data
client.setServer(mqtt_server, 1883);
client.setCallback(callback); //callback is the function that gets called for a topic sub
//setup http firmware update page.
MDNS.begin(host);
httpUpdater.setup(&httpServer, update_path, update_username, update_password);
httpServer.begin();
MDNS.addService("http", "tcp", 80);
Serial.printf("HTTPUpdateServer ready! Open http://%s.local%s in your browser and login with username '%s' and your password\n", host, update_path, update_username);
}
void loop() {
//If MQTT client can't connect to broker, then reconnect
if (!client.connected()) {
reconnect();
}
checkDoorState();
client.loop(); //the mqtt function that processes MQTT messages
httpServer.handleClient(); //handles requests for the firmware update page
}
void callback(char* topic, byte* payload, unsigned int length) {
//if the 'garage/button' topic has a payload "OPEN", then 'click' the relay
payload[length] = '\0';
strTopic = String((char*)topic);
if (strTopic == button_topic)
{
switch1 = String((char*)payload);
if (switch1 == "OPEN")
{
//'click' the relay
Serial.println("ON");
digitalWrite(relayPin, HIGH);
delay(600);
digitalWrite(relayPin, LOW);
}
}
}
void checkDoorState() {
//Checks if the door state has changed, and MQTT pub the change
last_state = door_state; //get previous state of door
if (digitalRead(doorPin) == 0) // get new state of door
door_state = "OPENED";
else if (digitalRead(doorPin) == 1)
door_state = "CLOSED";
if (last_state != door_state) { // if the state has changed then publish the change
client.publish(door_topic, door_state);
Serial.println(door_state);
}
//pub every minute, regardless of a change. - UPDATED TO 3 seconds
long now = millis();
if (now - lastMsg > 3000) {
lastMsg = now;
client.publish(door_topic, door_state);
}
}
void reconnect() {
//Reconnect to Wifi and to MQTT. If Wifi is already connected, then autoconnect doesn't do anything.
wifiManager.autoConnect(host);
Serial.print("Attempting MQTT connection...");
if (client.connect(host, mqtt_user, mqtt_pass)) {
Serial.println("connected");
client.subscribe("garage/#");
} else {
Serial.print("failed, rc=");
Serial.print(client.state());
Serial.println(" try again in 5 seconds");
// Wait 5 seconds before retrying
delay(5000);
}
}
Follow up - have the serial monitor connected, and publishing to the MQTT topic using the following command:
mosquitto_pub -m "Open" -t garage/button
It shows up on the topic, but can't see it appear on the serial port...
So not even getting as far as the Serial Monitor...
Jon
Previously known as psycik
Home Assistant: Gigabyte AMD A8 Brix, Home Assistant with Aeotech ZWave Controller, Raspberry PI, Wemos D1 Mini, Zwave, Shelly Humidity and Temperature sensors
Media:Chromecast v2, ATV4 4k, ATV4, HDHomeRun Dual
Server Host Plex Server 3x3TB, 4x4TB using MergerFS, Samsung 850 evo 512 GB SSD, Proxmox Server with 1xW10, 2xUbuntu 22.04 LTS, Backblaze Backups, usenetprime.com fastmail.com Sharesies Trakt.TV Sharesight
davidcole: Does it get into the callback at all? You have no logging in there to tell.
Also your code is looking for “OPEN” and your message payload for mqtt is “Open”
That change to upper case worked. Still isn't catching the relay though... Wonder if it is because I am using a Wemos Mini Pro?
Jon
andrewNZ: Open the blink example sketch, change all 3 instances of LED_BUILTIN to 5, upload it.
If the relay doesn't toggle there is a wiring problem/oversight.
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(5, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(5, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(5, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Had another wemos so took the relay put both together on a separate breadboard, compiled this sketch and plugged it in - didn't trigger the relay either. Have now ordered four more relays from Aliexpress...
Jon
andrewNZ: Have you tried connecting the relay directly to 3.3v and Gnd to see if it switches?
No, will try that in the morning - presumably it should be 5V rather than 3.3V though?
This is the relay - it is the one linked from the Wemos site so should work - is stacked per my image from the previous page.
Jon
|
![]() ![]() ![]() |