Synchronize timers between Google Home and Home Assistant

This quick recipe will show you how to import and display timers and alarms from your Google Home devices into Home Assistant.
Google Assistant / Home Assistant timer

I do not use Google Home for many home automations, but there are a few actions that it does really well. I have a Google Home Mini smart speaker in the kitchen and use it primarily to set cooking timers using my voice. Since the Mini has no display, the only way to check for the remaining time is to ask the question and wait for the answer. Fortunately, there is a way to synchronize timers between Google Home and Home Assistant and display everything in your Lovelace dashboard UI.

Google Home integration

First, you will need to add Google Home integration to your Home Assistant. There is no native component that could do this, so you will have to install the Home Assistant Google Home custom component from HACS. This integration is very popular and should be already pre-configured in HACS, so you just need to search for it.

When you have finished the installation and restarted your Home Assistant, go to Configuration > Devices & Services and add a new Google Home integration. You will need to connect to your Google account that can control your home. For security reasons, I would highly recommend not using your default Google account with all of your emails and calendars. It is safer to create a new Google account, add it to your Google Home and then connect it to Home Assistant. You should also generate an “app password” instead of using your default account password (see more info here).

Once everything connects, the integration will create a number of entities for each of your Google Home devices. Typically these include volume control, alarm sensor, device info, do not disturb switch, and timer sensor. You can now start a timer on your Google Home device and have it synchronized to the Home Assistant entity. The default update interval is 180 seconds, so you might have to wait for a few minutes.

Example Google Home timer sensor

As you can see above, the sensor will expose the end time in state and a lot of additional information in attributes.

Lovelace card

Although you can use any of the default Home Assistant cards to display the timer information, I would recommend using a custom Lovelace Timer Bar card (install it again via HACS). It does a good job of integrating Google Home timers and showing a live countdown bar.

Lovelace Timer Bar card

You will need to create a template sensor first. This will expose a new entity (in my case the new entity is called sensor.kitchen_timer) that you will use in the Lovelace Timer Bar card. Please note that this will only work for the first timer. You can create additional sensors for multiple timers per google entity by changing timers [0] to timers [1], timers [2], etc. (more info).

template:
  - sensor:
       - name: "Kitchen Timer"
         unique_id: kitchen_timer
         icon: mdi:timer
         state: >
           {% set entity = 'sensor.google_home_mini_timers' %}
           {% if state_attr(entity,'timers')|lower not in ['','[]','unknown','unavailable','none'] %}
             {% set status = state_attr(entity,'timers')[0].status %}
             {% if status == 'set' %} active
             {% elif status == 'paused' %} paused
             {% elif status == 'waiting' %} waiting
             {% else %} idle
             {% endif %}
           {% endif %}          
         attributes:
           duration: >
             {% set entity = 'sensor.google_home_mini_timers' %}
             {% if state_attr(entity,'timers')|lower not in ['','[]','unknown','unavailable','none'] %}
               {{ state_attr(entity,'timers')[0].duration }}
             {% endif %}            
           end_time: >
             {% set entity = 'sensor.google_home_mini_timers' %}
             {% if state_attr(entity,'timers')|lower not in ['','[]','unknown','unavailable','none'] %}
               {{ state_attr(entity,'timers')[0].local_time_iso }}
             {% endif %}            
           integration: google_home  

Additional ideas

You can also use this integration to generate notifications – please refer to this tutorial. Feel free to share additional ideas in the comments below. For more Home Assistant recipes, please visit our archive.

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Article
Channels DVR

Channels DVR: The best solution to IPTV streaming

Next Article

Universal TV control with Home Assistant

We use cookies to improve your experience on our site and to show you relevant advertising. To find out more, please refer to our privacy policy.