Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
50 lines (40 sloc) 1.14 KB
#include <WiFi.h>
#include <esp8266-google-home-notifier.h>
const char* ssid = "<REPLASE_YOUR_WIFI_SSID>";
const char* password = "<REPLASE_YOUR_WIFI_PASSWORD>";
GoogleHomeNotifier ghn;
void setup() {
// put your setup code here, to run once:
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[] = "Family Room";
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(")");
if (ghn.notify("Hello, World!") != true) {
Serial.println(ghn.getLastError());
return;
}
Serial.println("Done.");
}
void loop() {
// put your main code here, to run repeatedly:
}
You can’t perform that action at this time.