horihiro / esp8266-google-home-notifier

MIT License
103 stars 23 forks source link

Failed to Connect to Google Home Mini #38

Closed ateker01 closed 3 years ago

ateker01 commented 3 years ago

Using the Simple for esp8266/32 sketch (SimpleUsage) example, I am trying to have 8266 to make a "hello world" announcement on my google mini home and it works just fine,

When I try to call this as a function I receive the failed to connect error as shown below;

21:58:26.194 -> . 21:58:26.194 -> connected. 21:58:26.194 -> IP address: 192.168.1.93 21:58:26.194 -> connecting to Google Home... 21:58:27.211 -> found Google Home(192.168.1.79:8009) 21:58:27.326 -> Failed to Connect to 192.168.1.79:8009. 21:58:27.326 -> *WM: freeing allocated params!

Both 8266 and the google home mini are connected to the same WiFi. I can play music on the google home mini through google home app so I know google home mini is connected

Anyone any idea why this is still failing?

Below is the information about the google home mini

System firmware version: 250118 Cast firmware version: 1.54.250118 IP Address: 192.168.1.79

And below is my method;

void GoogleHomeInterraction(){

GoogleHomeNotifier ghn; /// tried both within the method and outside of the method

WiFi.mode(WIFI_STA); WiFi.begin();

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 speaker";

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."); }

ateker01 commented 3 years ago

Just noticed that I am using too much RAM/HEAP. When I cleared up some of the variables, the functionality started to work.