c++esp8266google-homehome-automationhome-assistant

How do I send a command to Google Home with an ESP8266?


I have been looking for a way to send commands to my google home by pressing a button connected to an ESP8266. What I am trying to do is have my Google home turn off / on my Smart lights by pressing a button rather than saying the command.

I have some generic Wi-Fi controlled smart lights that are connected to my Google Home and I control them with the basic on/off commands (turn them on I say "OK Google, turn on my lights." and for off "OK Google, turn off my lights."). I would like to be able to press a physical button and have the ESP8266 push the command to my Google Home and have it execute it. Essentially a light switch that uses code to toggle the lights on and off rather than cutting the power, or go into an app, or say a verbal command.

I would prefer it not to use IFTTT but if that is necessary I will oblige to doing so. I have seen countless people send commands TO an ESP8266 FROM a google home, but I have never seen it accomplish way around besides 1 GitHub post showing that you can send voice commands using his Library called Google Home Notifier. While this does work for having my Google say something I don't know how (if even possible) to use it to have Google receive and execute a command.

As I stated earlier I don't know if this is even possible. I believe there is some way to do this I just don't know-how. I would really appreciate any help that can be given or a point in the right direction on how to accomplish this.


Solution

  • Why do you even want to use your Google Home ?

    What if you connect your ESP8266 to home-assistant, and trigger an automation when the button is pressed ? This automation could turn off the lights, or call a Google API if that's what you want

    N.B: I guessed you have a home assistant setup because of the tags in your question. If that's not the case, please edit