How to easily get master key for google home integration in home assistant in windows
This is a copy of a guide made by AlfredEAlf on the home assistant community or forum website
https://community.home-assistant.io/t/add-google-home-account-issue/624495/12
Direct link to the post https://community.home-assistant.io/t/add-google-home-account-issue/624495/12
the reason im posting this is for others to easily find a solution, as it was hard for me and i read alot of other people having a hard time getting the master key, further, there were some guides out there from the developer himself, but they were not easy, and alot of people complained that they were not working.
og top of that i read some misleading guides or information that was not true. or at least not aware of this easy method.
PLESAE NOTE. i made a dumb mistake on this simple guide, because i did not read the output fully.
when the terminal spits out your master key, it gives you two codes. please be mindful of wich one you try to use. but it is clearly labled, what code you need. as it tells you what code is the master key. i think the other one was a private key or some sort.
I have solved this problem. I am posting my solution in hope that no-one else has to repeat my journey.
To get the Google Master Token, I installed the Windows Docker and in the Terminal window, ran the command:
docker run --rm -it breph/ha-google-home_get-token
After entering my email address and App password, a 233 character master token was produced.
Important
If you use 2FA for google, your primary Google password will not work, so you will need to generate an app password to make this work. See Create and manage your app passwords 3
Chances are that if you cut and paste your master token into HA, authentication will probably fail with an “Master token invalid” error. In my case, this is because the token is so long that when you cut and paste, you will pick up one or more carriage return characters.
Not the most elegant way to deal with this, I first pasted the token into Microsoft word so that I could see and remove the carriage return characters.
I then copied the token from word and put it into an excel spreadsheet. I created a formula to check the length of the token, like =LEN(A1), where the token was in cell A1. This confirmed that the length was 233 characters.
I then cut and pasted the token into HA Google Home Cofiguration dialogue and it authenticated correctly.
There are a few moving parts here that need to be dealt with and you need to get them all correct for this to work.
https://github.com/leikoilja/ha-google-home