Solution to track your google home alarms and timers and trigger different home assistant events

Home Assistant integration is right now functional. Only alarms are implemented, but further integration is planned. Take a look at my Github Repo.

1 Like

The development is in a good stage. I’ve implemented an entity for automating next alarm actions. This is, for example, opening the blinds 5 minutes before waking up, or turning on the coffee machine.

Take a look at the Github repo, or download the package directly.

Edit: Having read some concerns about the storage of the Google’s credentials, it’s getting baked an update which stores just an authorisation token, and not the full credentials.

Installation instructions

First of all, download the version 0.0.3 (the last one right now) with wget, for example, at the custom_components directory of your Home Assistant configuration folder (e.g. ~/.homeassistant/custom_components):

wget -O ~/.homeassistant/custom_components/googlehome.zip https://github.com/ArnyminerZ/HomeAssistant-GoogleHome/releases/download/ha-0.0.3/googlehome.zip

After that, create a googlehome directory, and decompress the file inside it:

cd ~/.homeassistant/custom_components
mkdir googlehome
unzip googlehome.zip -d googlehome

Now the hard work is done, just restart your Home Assistant instance, and configure your device.

Configuring a device

Configuring your Google Home is really easy, and can be done from the UI.
Simply go to your integrations page at Home Assistant (e.g. 192.168.1.1:8123/config/integrations), select the Add Integration button, and if you have installed the integration correctly, an integration called Google Home should appear; select it.
The following window should open:

auth

You should fill the fields with your Google’s username, and your password. This second one can be:

  1. Your Google’s Account password (if you don’t have 2FA enabled)
  2. An app password (if you have 2FA enabled). It can be generated from
    Google’s website.

Now it’s time to configure your device. First, access the Google Home app on your phone, and search for the desired
device, enter its configuration, and at the bottom of the page, the IP of the device should appear. Now, fill as
follows:

device

On IP Address, put the found address, on Name, the name you have set to your device in the Google Home app. In GET
path, choose one of the following:

  • next_alarm: The value of the entity will be the timestamp (UNIX) of the next alarm at the device.

Conclusion

There’s still a lot of work to do, and right now only the “next alarm” feature is ready, but I’m optimistic, and with some hard work, this could be functional in little time.

Contribution Needed (TODO)

  • Logo
  • Service for calling features like reboot.
  • More options for automation.
5 Likes

This is great! I’ll give it a shot and see how it goes. :smiley:

Update 2: Read up on where to place the ‘custom_components’-dir (under config), and now I see the same behaviour as islamek.

Was just testing to see if I can make it work, I got the integration called Google Home, but after clicking it the “Please wait while the integration is being installed” popup shows and just stays there.

Same issue here… I’m on the latest version of Home Assistant OS. This is what I’m seeing in the logs:

2021-02-13 21:34:11 ERROR (SyncWorker_6) [homeassistant.util.package] Unable to install package grpcio-tools: ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ysur6iq4/grpcio-tools/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ysur6iq4/grpcio-tools/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-yq1mef3f
         cwd: /tmp/pip-install-ysur6iq4/grpcio-tools/
    Complete output (11 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-ysur6iq4/grpcio-tools/setup.py", line 151, in <module>
        if check_linker_need_libatomic():
      File "/tmp/pip-install-ysur6iq4/grpcio-tools/setup.py", line 80, in check_linker_need_libatomic
        cpp_test = subprocess.Popen([cxx, '-x', 'c++', '-std=c++11', '-'],
      File "/usr/local/lib/python3.8/subprocess.py", line 854, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "/usr/local/lib/python3.8/subprocess.py", line 1702, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: 'c++'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 20.2.4; however, version 21.0.1 is available.
You should consider upgrading via the '/usr/local/bin/python3 -m pip install --upgrade pip' command.
2021-02-13 21:34:11 ERROR (MainThread) [aiohttp.server] Error handling request
1 Like

Hey all.
Just a little update on the progress.

Starting with the great news, the three of us, together with @DurgNomis-drol and @ArnyminerZ have joined forces to work on this together. We have pretty high ambitions on the integration, but it requires quite a bit of work before it works.

You can follow our progress or share some insights/ideas in our shared repo, however, it is still under active development. We are both refactoring and working on underlying python glocaltokens package as well as HACS integration that will enable lots of great Google Home features within Home Assistant.
If you are a developer - we would be happy you join us! :boom:

P.S. We’ll post some updates here, when there is something to play/test with.

8 Likes

Looking forward to trying this out

Hey hey :boom:

Soooo, after a few weeks of hard work, there is something finally out that can be tested and hopefully found useful :slight_smile:
Big thanks to all who contributed for putting much effort into making it work. :rocket:

Please see Google Home custom integration that implements a solution to track google home alarms and timers in a neat manner.
Also, check a UI custom card that @DurgNomis-drol has been working on to show timers in a beautiful way.

Drop a github :star: if you find it useful and please help to contribute with issues/PRs to make it even better.

Edit: If you encounter any unexpected behavior please open the corresponding issue in github

7 Likes

Wow! This is exactly what I was looking for! I have installed it trough HACS. Added the integration with an app password. But I do not see the sensors appearing in the entities. I presumed that the devices are discovered automagicly. Is there any way I can debug this on my setup? Or a possibility to add the devices manually?

Edit: Found something! In de HA core log:

2021-03-17 09:50:19 ERROR (MainThread) [custom_components.google_home] Unexpected error fetching sensor data: 'fire_time' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 151, in async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 139, in _async_update_data return await self.update_method() File "/config/custom_components/google_home/api.py", line 180, in update_google_devices_information coordinator_data = await gather( File "/config/custom_components/google_home/api.py", line 150, in get_alarms_and_timers device.set_timers(resp.get(JSON_TIMER)) File "/config/custom_components/google_home/models.py", line 52, in set_timers self._timers = [ File "/config/custom_components/google_home/models.py", line 55, in <listcomp> fire_time=timer[FIRE_TIME],

Ok. The issue was that there was an active timer on one of my devices. When I have removed the timer and restarten my instance the entities showed up.

1 Like

How do you get to the Add google home device page?
I have the authentication done but no devices show up

All I’m getting is authentication failed even though I’m using the right email and app password.

This I found in my logs:

Logger: glocaltokens.client
Source: /usr/local/lib/python3.8/site-packages/glocaltokens/client.py:169
First occurred: 17:36:51 (6 occurrences)

Hey folks. Installed this last night and it worked flawlessly. Some time today the devices went to “unavailable”.

Log:
Logger: pychromecast.socket_client
Source: /usr/local/lib/python3.8/site-packages/pychromecast/socket_client.py:658 
First occurred: 3:20:23 (3 occurrences) 
Last logged: 13:34:36

[Bedroom Mini - HomeMink(192.168.xx.xx):xxxx] Heartbeat timeout, resetting connection

Edit.
Sorry I’m an idiot. I hadn’t verified the email link confirming the app password. Normal service has resumed.

@gijsje @nckslater

Please try this integration instead. I believe that @ArnyminerZ integration does not work any more because of some underlying changes, but i am not sure.

We will soon push a new release that should contain a lot of bug fixes. Until then when install through HACS, please choose master.

Same error

Logger: custom_components.google_home
Source: custom_components/google_home/config_flow.py:97
Integration: Google Home (documentation, issues)
First occurred: 7:52:08 (3 occurrences)
Last logged: 7:52:43

And

Logger: glocaltokens.client
Source: /usr/local/lib/python3.8/site-packages/glocaltokens/client.py:169
First occurred: 7:52:08 (3 occurrences)
Last logged: 7:52:43

[!] Could not get master token.

Can you please open an issue over at github so we can track it there :smile:

1 Like

I have the same error on Hassbian (Home Assistant Core), but fine with Hass.io (Home Assistant).

Hi,
i am very new to HA, need some help.
do you have an example how to setup the google_home sensor ‘sensor.kitchen_timers’ ?
Thanks

type: ‘custom:googletimers-card’
entity: sensor.kitchen_timers
alarms_entity: sensor.kitchen_alarms
title: Kitchen

Just choose the manual card at the button of the card picker in lovelace and paste the code from the example in there. Where entity is the name of the entity that contains the timers. Or see this link for an example.

Example

type: 'custom:googletimers-card'
entity: sensor.kokken_timers
title: Køkken