Site updated at 2016-07-24 17:39:50 UTC
This commit is contained in:
parent
2d9a218a1b
commit
29118ce15d
1007 changed files with 168343 additions and 140 deletions
294
topics/events/index.html
Normal file
294
topics/events/index.html
Normal file
|
@ -0,0 +1,294 @@
|
|||
<!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>Events - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Describes all there is to know about events in Home Assistant.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/topics/events/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Events">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/topics/events/">
|
||||
<meta property="og:type" content="article">
|
||||
<meta property="og:description" content="Describes all there is to know about events 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="Events">
|
||||
<meta name="twitter:description" content="Describes all there is to know about events 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='/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">
|
||||
|
||||
|
||||
<div class='edit-github'><a href='https://github.com/home-assistant/home-assistant.io/tree/master/source/_topics/events.markdown'>Edit this page on GitHub</a></div>
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Events
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>The core of Home Assistant is the event bus. The event bus allows any component to fire or listen for events. It is the core of everything. For example, any state change will be announced on the event bus as a <code>state_changed</code> event containing the previous and the new state of an entity.</p>
|
||||
|
||||
<p>Home Assistant contains a few built-in events that are used to coordinate between various components.</p>
|
||||
|
||||
<h3><a class="title-link" name="event-homeassistant_start" href="#event-homeassistant_start"></a> Event <code>homeassistant_start</code></h3>
|
||||
<p>Event <code>homeassistant_start</code> is fired when all components from the configuration have been intitialized. This is the event that will start the timer firing off <code>time_changed</code> events.</p>
|
||||
|
||||
<h3><a class="title-link" name="event-homeassistant_stop" href="#event-homeassistant_stop"></a> Event <code>homeassistant_stop</code></h3>
|
||||
<p>Event <code>homeassistant_stop</code> is fired when Home Assistant is shutting down. It should be used to close any open connection or release any resources.</p>
|
||||
|
||||
<h3><a class="title-link" name="event-state_changed" href="#event-state_changed"></a> Event <code>state_changed</code></h3>
|
||||
<p>Event <code>state_changed</code> is fired when a state changes. Both <code>old_state</code> and <code>new_state</code> are state objects. <a href="/topics/state_object/">Documentation about state objects.</a></p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Field</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>entity_id</code></td>
|
||||
<td>Entity ID of the changed entity. Example: <code>light.kitchen</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>old_state</code></td>
|
||||
<td>The previous state of the entity before it changed. This field is ommitted if the entity is new.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>new_state</code></td>
|
||||
<td>The new state of the entity. This field is ommitted if the entity is removed from the state machine.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3><a class="title-link" name="event-time_changed" href="#event-time_changed"></a> Event <code>time_changed</code></h3>
|
||||
<p>Event <code>time_changed</code> is fired every second by the timer and contains the current time.</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Field</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>now</code></td>
|
||||
<td>A <a href="https://docs.python.org/3.4/library/datetime.html#datetime.datetime">datetime object</a> containing the current time in UTC.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3><a class="title-link" name="event-service_registered" href="#event-service_registered"></a> Event <code>service_registered</code></h3>
|
||||
<p>Event <code>service_registered</code> is fired when a new service has been registered within Home Assistant.</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Field</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>domain</code></td>
|
||||
<td>Domain of the service. Example: <code>light</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>service</code></td>
|
||||
<td>The service to call. Example: <code>turn_on</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3><a class="title-link" name="event-call_service" href="#event-call_service"></a> Event <code>call_service</code></h3>
|
||||
<p>Event <code>call_service</code> is fired to call a service.</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Field</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>domain</code></td>
|
||||
<td>Domain of the service. Example: <code>light</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>service</code></td>
|
||||
<td>The service to call. Example: <code>turn_on</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>service_data</code></td>
|
||||
<td>Dictionary with the service call parameters. Example: <code>{ 'brightness': 120 }</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>service_call_id</code></td>
|
||||
<td>String with a unique call id. Example: <code>23123-4</code>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3><a class="title-link" name="event-service_executed" href="#event-service_executed"></a> Event <code>service_executed</code></h3>
|
||||
<p>Event <code>service_executed</code> is fired by the service handler to indicate the service is done.</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Field</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>service_call_id</code></td>
|
||||
<td>String with the unique call id of the service call that was executed. Example: <code>23123-4</code>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3><a class="title-link" name="event-platform_discovered" href="#event-platform_discovered"></a> Event <code>platform_discovered</code></h3>
|
||||
<p>Event <code>platform_discovered</code> is fired when a new platform has been discovered by the discovery component.</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Field</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>service</code></td>
|
||||
<td>The service that is discovered. Example: <code>zwave</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>discovered</code></td>
|
||||
<td>Information that is discovered. Can be a dict, tuple etc. Example: <code>(192.168.1.10, 8889)</code>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3><a class="title-link" name="event-component_loaded" href="#event-component_loaded"></a> Event <code>component_loaded</code></h3>
|
||||
<p>Event <code>component_loaded</code> is fired when a new component has been loaded and initialized.</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Field</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>component</code></td>
|
||||
<td>Domain of the component that has just been initialized. Example: <code>light</code>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</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://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>.<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>
|
||||
</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>
|
Loading…
Add table
Add a link
Reference in a new issue