245 lines
15 KiB
HTML
245 lines
15 KiB
HTML
<!doctype html>
|
||
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
|
||
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
|
||
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
|
||
<!--[if gt IE 8]><!--> <html> <!--<![endif]-->
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||
<title>Google Calendar Event - Home Assistant</title>
|
||
<meta name="author" content="Home Assistant">
|
||
<meta name="description" content="Instructions how to use Google Calendars in Home Assistant.">
|
||
<meta name="viewport" content="width=device-width">
|
||
<link rel="canonical" href="https://home-assistant.io/components/calendar.google/">
|
||
<meta property="fb:app_id" content="338291289691179">
|
||
<meta property="og:title" content="Google Calendar Event">
|
||
<meta property="og:site_name" content="Home Assistant">
|
||
<meta property="og:url" content="https://home-assistant.io/components/calendar.google/">
|
||
<meta property="og:type" content="article">
|
||
<meta property="og:description" content="Instructions how to use Google Calendars in Home Assistant.">
|
||
<meta property="og:image" content="https://home-assistant.io/images/default-social.png">
|
||
<meta name="twitter:card" content="summary_large_image">
|
||
<meta name="twitter:site" content="@home_assistant">
|
||
<meta name="twitter:title" content="Google Calendar Event">
|
||
<meta name="twitter:description" content="Instructions how to use Google Calendars in Home Assistant.">
|
||
<meta name="twitter:image" content="https://home-assistant.io/images/default-social.png">
|
||
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet">
|
||
<link href="/atom.xml" rel="alternate" title="Home Assistant" type="application/atom+xml">
|
||
<link rel='shortcut icon' href='/images/favicon.ico' />
|
||
<link rel='icon' type='image/png' href='/images/favicon-192x192.png' sizes='192x192' />
|
||
</head>
|
||
<body >
|
||
<header>
|
||
<div class="grid-wrapper">
|
||
<div class="grid">
|
||
<div class="grid__item three-tenths lap-two-sixths palm-one-whole ha-title">
|
||
<a href="/" class="site-title">
|
||
<img width='40' src='/demo/favicon-192x192.png'>
|
||
<span>Home Assistant</span>
|
||
</a>
|
||
</div>
|
||
<div class="grid__item seven-tenths lap-four-sixths palm-one-whole">
|
||
<nav>
|
||
<input type="checkbox" id="toggle">
|
||
<label for="toggle" class="toggle" data-open="Main Menu" data-close="Close Menu"></label>
|
||
<ul class="menu pull-right">
|
||
<li><a href="/getting-started/">Getting started</a></li>
|
||
<li><a href="/components/">Components</a></li>
|
||
<li><a href="/docs/">Docs</a></li>
|
||
<li><a href="/cookbook/">Examples</a></li>
|
||
<li><a href="/developers/">Developers</a></li>
|
||
<li><a href="/blog/">Blog</a></li>
|
||
<li><a href="/help/">Need help?</a></li>
|
||
</ul>
|
||
</nav>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</header>
|
||
<div class="grid-wrapper">
|
||
<div class="grid grid-center">
|
||
<div class="grid__item two-thirds lap-one-whole palm-one-whole">
|
||
<article class="page">
|
||
<header>
|
||
<h1 class="title indent">
|
||
Google Calendar Event
|
||
</h1>
|
||
</header>
|
||
<hr class="divider">
|
||
<p>This platform allows you to connect to your <a href="https://calendar.google.com">Google Calendars</a> and generate binary sensors. The sensors created can trigger based on any event on the calendar or only for matching events. When you first setup this component it will generate a new configuration file <em>google_calendars.yaml</em> that will contain information about all of the calendars you can see.</p>
|
||
<h3><a class="title-link" name="prerequisites" href="#prerequisites"></a> Prerequisites</h3>
|
||
<p>Generate a Client ID and Client Secret on <a href="https://console.developers.google.com/start/api?id=calendar">Google Developers Console</a>.</p>
|
||
<ol>
|
||
<li>Follow the wizard using the following information.</li>
|
||
<li>When it gets to the point of asking <em>Which API are you using?</em> just click cancel.</li>
|
||
<li>Click on the tab ‘OAuth consent screen’.</li>
|
||
<li>Set ‘Product name shown to users’ to anything you want. We suggest Home-Assistant.</li>
|
||
<li>Save this page. You don’t have to fill out anything else there.</li>
|
||
<li>Click ‘Create credentials’ -> OAuth client ID.</li>
|
||
<li>Set the Application type to ‘Other’ and give this credential set a name then click Create.</li>
|
||
<li>Save the client ID and secret as you will need to put these in your configuration.yaml file.</li>
|
||
</ol>
|
||
<h3><a class="title-link" name="basic-setup" href="#basic-setup"></a> Basic Setup</h3>
|
||
<p>To integrate Google Calendar in Home Assistant, add the following section to your <code class="highlighter-rouge">configuration.yaml</code> file:</p>
|
||
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="c1"># Example configuration.yaml entry</span>
|
||
<span class="s">google</span><span class="pi">:</span>
|
||
<span class="s">client_id</span><span class="pi">:</span> <span class="nv">*Value_created_from_steps_above</span><span class="err">*</span>
|
||
<span class="s">client_secret</span><span class="pi">:</span> <span class="nv">*Value_created_from_steps_above</span><span class="err">*</span>
|
||
</code></pre>
|
||
</div>
|
||
<p>Configuration variables:</p>
|
||
<ul>
|
||
<li><strong>client_id</strong> (<em>Required</em>): Use the value you generated in the Prerequisites stage.</li>
|
||
<li><strong>client_secret</strong> (<em>Required</em>): Use the value you generated in the Prerequisites stage.</li>
|
||
<li><strong>track_new_calendar</strong> (<em>Optional</em>): Will automatically generate a binary sensor when a new calendar is detected. The system scans for new calendars on startup. By default this is set to <code class="highlighter-rouge">True</code>.</li>
|
||
</ul>
|
||
<p>The next steps will require you to have Home Assistant running.</p>
|
||
<p>After you have it running complete the Google authentication that pops up. It will give you a URL and a code to enter. This will grant your Home Assistant service access to all the Google Calendars that the account you authenticate with can read. This is a Read-Only view of these calendars.</p>
|
||
<h3><a class="title-link" name="calendar-configuration" href="#calendar-configuration"></a> Calendar Configuration</h3>
|
||
<p>Editing <code class="highlighter-rouge">google_calendars.yaml</code></p>
|
||
<p>A basic entry for a single calendar looks like:</p>
|
||
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="pi">-</span> <span class="s">cal_id</span><span class="pi">:</span> <span class="s2">"</span><span class="s">***************************@group.calendar.google.com"</span>
|
||
<span class="s">entities</span><span class="pi">:</span>
|
||
<span class="pi">-</span> <span class="s">device_id</span><span class="pi">:</span> <span class="s">test_everything</span>
|
||
<span class="s">name</span><span class="pi">:</span> <span class="s">Give me everything</span>
|
||
<span class="s">track</span><span class="pi">:</span> <span class="s">true</span>
|
||
<span class="pi">-</span> <span class="s">cal_id</span><span class="pi">:</span> <span class="s2">"</span><span class="s">***************************@group.calendar.google.com"</span>
|
||
<span class="s">entities</span><span class="pi">:</span>
|
||
<span class="pi">-</span> <span class="s">device_id</span><span class="pi">:</span> <span class="s">test_important</span>
|
||
<span class="s">name</span><span class="pi">:</span> <span class="s">Important Stuff</span>
|
||
<span class="s">track</span><span class="pi">:</span> <span class="s">true</span>
|
||
<span class="s">search</span><span class="pi">:</span> <span class="s2">"</span><span class="s">#Important"</span>
|
||
<span class="s">offset</span><span class="pi">:</span> <span class="s2">"</span><span class="s">!!"</span>
|
||
<span class="pi">-</span> <span class="s">device_id</span><span class="pi">:</span> <span class="s">test_unimportant</span>
|
||
<span class="s">name</span><span class="pi">:</span> <span class="s">UnImportant Stuff</span>
|
||
<span class="s">track</span><span class="pi">:</span> <span class="s">true</span>
|
||
<span class="s">search</span><span class="pi">:</span> <span class="s2">"</span><span class="s">#UnImportant"</span>
|
||
</code></pre>
|
||
</div>
|
||
<p>Variables:</p>
|
||
<ul>
|
||
<li>
|
||
<p><strong>cal_id</strong>: The Google generated unique id for this calendar. <strong>DO NOT CHANGE</strong></p>
|
||
</li>
|
||
<li>
|
||
<p><strong>entities</strong>: Yes, you can have multiple sensors for a calendar!</p>
|
||
<ul>
|
||
<li>
|
||
<p><strong>device_id</strong>: (<em>Required</em>): The name that all your automations/scripts will use to reference this device.</p>
|
||
</li>
|
||
<li>
|
||
<p><strong>name</strong>: (<em>Required</em>): What is the name of your sensor that you’ll see in the frontend.</p>
|
||
</li>
|
||
<li>
|
||
<p><strong>track</strong>: (<em>Required</em>): Should we create a sensor <code class="highlighter-rouge">True</code> or ignore it <code class="highlighter-rouge">False</code>?</p>
|
||
</li>
|
||
<li>
|
||
<p><strong>search</strong>: (<em>Optional</em>): If set will only trigger for matched events.</p>
|
||
</li>
|
||
<li>
|
||
<p><strong>offset</strong>: (<em>Optional</em>): A set of characters that precede a number in the event title for designating a pre-trigger state change on the sensor. (Default: <code class="highlighter-rouge">!!</code>)</p>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<p>From this we will end up with the binary sensors <code class="highlighter-rouge">calendar.test_unimportant</code> and <code class="highlighter-rouge">calendar.test_important</code> which will toggle themselves on/off based on events on the same calendar that match the search value set for each. You’ll also have a sensor <code class="highlighter-rouge">calendar.test_everything</code> that will not filter events out and always show the next event available.</p>
|
||
<p>But what if you only wanted it to toggle based on all events? Just leave out the <em>search</em> parameter.</p>
|
||
<p><strong>Note</strong>: If you use a <code class="highlighter-rouge">#</code> sign for <code class="highlighter-rouge">search</code> then wrap the whole search term in quotes. Otherwise everything following the hash sign would be considered a YAML comment.</p>
|
||
<h3><a class="title-link" name="sensor-attributes" href="#sensor-attributes"></a> Sensor attributes</h3>
|
||
<ul>
|
||
<li>
|
||
<p><strong>offset_reached</strong>: If set in the event title and parsed out will be <code class="highlighter-rouge">on</code>/<code class="highlighter-rouge">off</code> once the offset in the title in minutes is reached. So the title <code class="highlighter-rouge">Very important meeting #Important !!-10</code> would trigger this attribute to be <code class="highlighter-rouge">on</code> 10 minutes before the event starts.</p>
|
||
</li>
|
||
<li>
|
||
<p><strong>all_day</strong>: <code class="highlighter-rouge">True</code>/<code class="highlighter-rouge">False</code> if this is an all day event. Will be <code class="highlighter-rouge">False</code> if there is no event found.</p>
|
||
</li>
|
||
<li>
|
||
<p><strong>message</strong>: The event title with the <code class="highlighter-rouge">search</code> and <code class="highlighter-rouge">offset</code> values extracted. So in the above example for <strong>offset_reached</strong> the <strong>message</strong> would be set to <code class="highlighter-rouge">Very important meeting</code></p>
|
||
</li>
|
||
<li>
|
||
<p><strong>description</strong>: The event description.</p>
|
||
</li>
|
||
<li>
|
||
<p><strong>location</strong>: The event Location.</p>
|
||
</li>
|
||
<li>
|
||
<p><strong>start_time</strong>: Start time of event.</p>
|
||
</li>
|
||
<li>
|
||
<p><strong>end_time</strong>: End time of event.</p>
|
||
</li>
|
||
</ul>
|
||
</article>
|
||
</div>
|
||
<aside id="sidebar" class="grid__item one-third lap-one-whole palm-one-whole">
|
||
<div class="grid">
|
||
<section class="aside-module grid__item one-whole lap-one-half">
|
||
<div class='edit-github'><a href='https://github.com/home-assistant/home-assistant.github.io/tree/current/source/_components/calendar.google.markdown'>Edit this page on GitHub</a></div>
|
||
<div class='brand-logo-container section'>
|
||
<img src='/images/supported_brands/google_calendar.png' />
|
||
</div>
|
||
<div class='section'>
|
||
IoT class<sup><a href='/blog/2016/02/12/classifying-the-internet-of-things/#classifiers'><i class="icon-info-sign"></i></a></sup>: Cloud Polling
|
||
</div>
|
||
<div class='section'>
|
||
Introduced in release: 0.33
|
||
</div>
|
||
<div class='section'>
|
||
This is a platform for
|
||
<a href='/components/calendar/'>the Calendar component</a>.
|
||
</div>
|
||
<div class='section'>
|
||
<h1 class='title delta'>Related components</h1>
|
||
<ul class='divided'>
|
||
<li><a href='/components/tts.google/'>
|
||
Google Text-to-Speech
|
||
</a></li>
|
||
</ul>
|
||
</div>
|
||
<div class='section'>
|
||
<h1 class="title delta">Category Calendar</h1>
|
||
<ul class='divided'>
|
||
<li>
|
||
Google Calendar Event
|
||
</li>
|
||
<li>
|
||
<a href='/components/sensor.time_date/'>Time & Date</a>
|
||
</li>
|
||
<li>
|
||
<a href='/components/sensor.worldclock/'>Worldclock</a>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</aside>
|
||
</div>
|
||
</div>
|
||
<footer>
|
||
<div class="grid-wrapper">
|
||
<div class="grid">
|
||
<div class="grid__item">
|
||
<div class="copyright">
|
||
<a rel="me" href='https://twitter.com/home_assistant'><i class="icon-twitter"></i></a>
|
||
<a rel="me" href='https://facebook.com/homeassistantio'><i class="icon-facebook"></i></a>
|
||
<a rel="me" href='https://plus.google.com/110560654828510104551'><i class="icon-google-plus"></i></a>
|
||
<a rel="me" href='https://github.com/home-assistant/home-assistant'><i class="icon-github"></i></a>
|
||
<div class="credit">
|
||
Contact us at <a href='mailto:hello@home-assistant.io'>hello@home-assistant.io</a> (no support!).<br>
|
||
Website powered by <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>.<br />
|
||
Hosted by <a href='https://pages.github.com/'>GitHub</a> and served by <a href='https://cloudflare.com'>CloudFlare</a>.
|
||
</div>
|
||
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">home-assistant.io</span> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License</a>.
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</footer>
|
||
<script>
|
||
var _gaq=[['_setAccount','UA-57927901-1'],['_trackPageview']];
|
||
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
|
||
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
|
||
s.parentNode.insertBefore(g,s)}(document,'script'));
|
||
</script>
|
||
</body>
|
||
</html>
|