-
Notifications
You must be signed in to change notification settings - Fork 195
How to make the state returned to Alexa from another gpio pin. #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Don't think it's possible
I am not sure what are you trying to do. Check whether sinric.com can
support
…On Wed, Apr 25, 2018 at 12:12 PM Ynot1 ***@***.***> wrote:
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#48>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHIM5kFsD7FdbqElGeVhq1SP81UqT-z8ks5tsAXVgaJpZM4Tiyf2>
.
|
#include <ESP8266WiFi.h> // prototypes //on/off callbacks // Change this before you flash boolean wifiConnected = false; UpnpBroadcastResponder upnpBroadcastResponder; Switch *garagedooropen = NULL; bool isgarageDoorOpenOn = false; const int garageDoorRelay = 0; // GPIO0 pin. void setup() Serial.begin(9600); Serial.println("Booting..."); //flash fast a few times to indicate CPU is booting Serial.println("Delaying a bit..."); // Initialise wifi connection if(wifiConnected){ //flash slow a few times to indicate wifi connected OK
}
Serial.println("Making GPIO2 into an INPUT"); // used to detect garage door current state
} void loop() if (GarageDoorState == HIGH) { PrevGarageDoorState = GarageDoorState; // remember prev state for next pass if(wifiConnected){
} bool garageDoorOpenOn() {
} bool garageDoorOpenOff() { // nothing ever calls this....
} bool garageDoorCloseOn() {
} bool garageDoorCloseOff() { // nothing ever calls this.... digitalWrite(garageDoorRelay, LOW); // turn off relay isgarageDoorCloseOn = false; // connect to wifi – returns true if successful or false if not WiFi.mode(WIFI_STA); // Wait for connection if (state){ return state; |
Cant use sinric, its not released in NZ. But its not the skill i am having an issue with, its the values returned to Alexa in the ESP-2866 code. I want to return the state of GPIO2 (which i have read into the booleen variable "GarageDoorState") to Alexa so it appears as the smart switch state. "I am not sure what are you trying to do. Check whether sinric.com can |
Anything is possible given time and perseverance!
I had to hack switch.cpp about to do it, but Alexa is now getting her state of my garage door from the door position switch itself, not from the relaystate variable that tracks if the last command was an On or off.
I had to expose the garage door state to switch.cpp via an extern bool declaration ( GarageDoorState is defined in the main.ino) and then fire that Boolean state into the getbinarystate logic ( I just overwrote switchstatus)
This is really crude, but as I only have two controls on that ESP-01 (door open and door close) having the same door state sent back for both of them makes sense. It wouldn't work if you wanted to have several different inputs pins reporting for different functions.
While I was about it, I changed the door state to be read from the rx pin instead of GPIO2 - now the ESP-01 can startup reliably with the garage door either open or shut. Previously, it would hang if it started with the door open.
…Sent from my iPad
On 25/04/2018, at 5:35 PM, Aruna Tennakoon ***@***.***> wrote:
Don't think it's possible
I am not sure what are you trying to do. Check whether sinric.com can
support
On Wed, Apr 25, 2018 at 12:12 PM Ynot1 ***@***.***> wrote:
> ―
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <#48>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AHIM5kFsD7FdbqElGeVhq1SP81UqT-z8ks5tsAXVgaJpZM4Tiyf2>
> .
>
―
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Uh oh!
There was an error while loading. Please reload this page.
Lots of success with this code today after changing the persistent_uuid line in switch.cpp as pointed out by others. That's really helpful guys, thanks.
My Alexa Plus is discovering the devices without any additional skills, and controlling the resulting relays just fine.
My use case is a garage door control, that wants 1 sec pulses to either open or close the door. I have modified the code in this repo to read a gpio input pin on the esp2866 that is connected to a switch so I know the state of the door. Simple then to gate the Alexa on and off commands via that garageDoorState Boolean to only produce a close pulse when the door is open and vice versa.
The only problem with this, is that Alexa doesn't know the actual state of the door, only the state of the door control relays , and as they are always short pulses, when I look at the belkin smart switch device display in Alexas list of devices, it's always off.
Where in the code could I make changes such that the state of the door is returned to Alexa instead of the state of the door controls? I would like to see those smart switch displays in Alexa say "on" when the door is open. (This could be really useful if I ever want to know remotely if I have left the door open)
I can see regular " got binary state request" messages in the serial monitor which is probably where I need to make changes, but I lack the understanding of exactly how...
Apart from the tweak above, and removing most of the debug messages to make life quieter, I haven't touched the library files (yet).
The text was updated successfully, but these errors were encountered: