horihiro / esp8266-google-home-notifier

MIT License
103 stars 23 forks source link

Doorbell button press #3

Closed computerfreek274 closed 5 years ago

computerfreek274 commented 6 years ago

I have it working with this Code here.

I would just like to add all my google home's in. So this way it send's it to all devices.

Code I am using is.

include

include // https://github.com/thomasfredericks/Bounce2

include // https://github.com/horihiro/esp8266-google-home-notifier

                                      // https://github.com/horihiro/esp8266-google-tts

define BUTTON_PIN D2 // D2/GPIO4

const char ssid = "xxx"; const char password = "xxx";

Bounce debouncer = Bounce(); GoogleHomeNotifier ghn;

void setup() {

// Setup the button with an internal pull-up : pinMode(BUTTON_PIN,INPUT_PULLUP);

// After setting up the button, setup the Bounce instance : debouncer.attach(BUTTON_PIN); debouncer.interval(5); // interval in ms

Serial.begin(115200); Serial.println(""); Serial.print("connecting to Wi-Fi"); WiFi.mode(WIFI_STA); WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) { delay(250); Serial.print("."); } Serial.println(""); Serial.println("connected."); Serial.print("IP address: "); Serial.println(WiFi.localIP()); //Print the local IP

const char displayName[] = "Devin"; /// Change this, must match the name of Google Home

Serial.println("connecting to Google Home..."); if (ghn.device(displayName, "en") != true) { Serial.println(ghn.getLastError()); return; } Serial.print("found Google Home("); Serial.print(ghn.getIPAddress()); Serial.print(":"); Serial.print(ghn.getPort()); Serial.println(")"); }

void loop() { debouncer.update(); if ( debouncer.fell() ) { if (ghn.notify("Someone is at the door!") != true) { Serial.println(ghn.getLastError()); return; } } }

horihiro commented 6 years ago

What you want to do is to notify to some google homes, isn't it?

This library doesn't support to notify to multiple google homes. Maybe, drastic design change is needed to support it.

# I think you can do that if you prepare as many ESPs as Google Home and each Google Homes have different name.

computerfreek274 commented 6 years ago

What about if I just Define another GoogleHomeNotifier for each google home. I have it setup and wired to a doorbell now. I will try it that way if I can get the code right. So far it has been working great for a doorbell no need for ifttt or any other outside server. Just connected for my wifi and done.

horihiro commented 6 years ago

Is what you want to know the way to notify to multiple google-homes concurrently?

Maybe it's not impossible by current internal design.

I don't have a plan to support it because I don't have such an environment(I have only one google-home).

horihiro commented 5 years ago

could I close this issue?

horihiro commented 5 years ago

close

horihiro commented 5 years ago

close