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
230
developers/add_new_platform/index.html
Normal file
230
developers/add_new_platform/index.html
Normal file
|
@ -0,0 +1,230 @@
|
|||
<!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>Adding support for a new platform - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Hints and tips for when you're adding a new platform to Home Assistant.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/add_new_platform/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Adding support for a new platform">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/add_new_platform/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Hints and tips for when you're adding a new platform to 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="Adding support for a new platform">
|
||||
<meta name="twitter:description" content="Hints and tips for when you're adding a new platform to 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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Adding Support for a New Platform
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>Components that interact with devices are called Entity Components. They are structured in core- and platform logic. This allows the same logic to handle a light to be used by different brands.</p>
|
||||
|
||||
<p>For example, the built-in <code>switch</code> component consists of various platform in <a href="https://github.com/home-assistant/home-assistant/tree/master/homeassistant/components/switch"><code>homeassistant/components/switch/</code></a>. The file <code>__init__.py</code> contains the core logic of all platform and the <code>vendor_name.py</code> files only the relevant platform code.</p>
|
||||
|
||||
<p>If you are planning to add support for a new type of device to an existing component, you can get away with only writing platform logic. Have a look at how the component works with other platforms and create a similar file for the platform that you would like to add:</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="/developers/platform_example_sensor">Example sensor platform</a>: hello world of platforms.</li>
|
||||
<li><a href="/developers/platform_example_light">Example light platform</a>: showing best practices.</li>
|
||||
</ul>
|
||||
|
||||
<h3><a class="title-link" name="interfacing-with-devices" href="#interfacing-with-devices"></a> Interfacing with devices</h3>
|
||||
|
||||
<p>One of the rules for Home Assistant is that platform logic should never interface directly with devices but use a third-party Python 3 library to do so. This way Home Assistant is able to share code with the Python community and we can keep the project maintainable.</p>
|
||||
|
||||
<p>To integrate the third-party library you create an Entity class for your device. Entities are Home Assistant’s representation of lights, switches, sensors, etc. and are derived from the <a href="https://github.com/home-assistant/home-assistant/blob/master/homeassistant/helpers/entity.py">Entity Abstract Class</a>. This abstract class contains logic for integrating most standard features into your entities, such as visibility, entity IDs, updates, and much more.</p>
|
||||
|
||||
<h3><a class="title-link" name="requirements-and-dependencies" href="#requirements-and-dependencies"></a> Requirements and dependencies</h3>
|
||||
|
||||
<p>Platforms can specify dependencies and requirements the same way as a component does.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>REQUIREMENTS = [<span class="string"><span class="delimiter">'</span><span class="content">some-package==2.0.0</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">'</span><span class="content">some-other-package==2.5.0</span><span class="delimiter">'</span></span>]
|
||||
DEPENDENCIES = [<span class="string"><span class="delimiter">'</span><span class="content">mqtt</span><span class="delimiter">'</span></span>]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/add_new_platform.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a class='active' href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
232
developers/architecture/index.html
Normal file
232
developers/architecture/index.html
Normal file
|
@ -0,0 +1,232 @@
|
|||
<!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>Architecture - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Overview of the Home Assistant architecture.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/architecture/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Architecture">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/architecture/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Overview of the Home Assistant architecture.">
|
||||
<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="Architecture">
|
||||
<meta name="twitter:description" content="Overview of the Home Assistant architecture.">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Architecture
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>Before we dive into the Home Assistant architecture, it is important to get a clear overview of the home automation landscape as a whole. This will allow us to show how the different parts of Home Assistant fit in the picture. For a more lengthy discussion about what each part in this overview is responsible for, <a href="/blog/2014/12/26/home-control-home-automation-and-the-smart-home/">check out our blog</a>. A tl;dr version of the blog:</p>
|
||||
|
||||
<ul>
|
||||
<li>Home Control is responsible for collecting information on- and controlling devices.</li>
|
||||
<li>Home Automation triggers commands based on user configurations.</li>
|
||||
<li>Smart Home triggers commands based on previous behavior.</li>
|
||||
</ul>
|
||||
|
||||
<p class="img">
|
||||
<a href="/images/architecture/home_automation_landscape.png" name="landscape">
|
||||
<img alt="Home Automation landscape" src="/images/architecture/home_automation_landscape.png" />
|
||||
</a>
|
||||
Overview of the home automation landscape.
|
||||
</p>
|
||||
|
||||
<p>The Home Assistant core is responsible for Home Control. It has four parts to make this possible:</p>
|
||||
|
||||
<ul>
|
||||
<li>The <strong>Event Bus</strong> facilitates the firing and listening of events. This is the beating heart of Home Assistant.</li>
|
||||
<li>The <strong>State Machine</strong> keeps track of the states of things. Fires a <code>state_changed</code> event when a state has been changed.</li>
|
||||
<li>The <strong>Service Registry</strong> listens on the event bus for <code>call_service</code> events and allows other code to register services.</li>
|
||||
<li>The <strong>Timer</strong> will send a <code>time_changed</code> event every 1 second on the event bus.</li>
|
||||
</ul>
|
||||
|
||||
<p class="img">
|
||||
<a href="/images/architecture/ha_architecture.png" name="architecture">
|
||||
<img src="/images/architecture/ha_architecture.png" />
|
||||
</a>
|
||||
Overview of the Home Assistant core architecture
|
||||
</p>
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/architecture.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a class='active' href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
265
developers/architecture_components/index.html
Normal file
265
developers/architecture_components/index.html
Normal file
|
@ -0,0 +1,265 @@
|
|||
<!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>Components Architecture - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Overview of components within the Home Assistant architecture.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/architecture_components/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Components Architecture">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/architecture_components/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Overview of components within the Home Assistant architecture.">
|
||||
<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="Components Architecture">
|
||||
<meta name="twitter:description" content="Overview of components within the Home Assistant architecture.">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Components Architecture
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>Home Assistant can be extended by <strong>components</strong>. Each component is responsible for a specific domain within Home Assistant. Components can listen for or trigger events, offer services and maintain states. Components are written in Python and can do all the goodness that Python has to offer. Out of the box, Home Assistant offers a bunch of <a href="/components/">built-in components</a>.</p>
|
||||
|
||||
<p class="img">
|
||||
<img src="/images/architecture/component_interaction.png" alt="Diagram showing interaction between components and the Home Assistant core." />
|
||||
Diagram showing interaction between components and the Home Assistant core.
|
||||
</p>
|
||||
|
||||
<p>We can differentiate between two different types of components within Home Assistant.</p>
|
||||
|
||||
<h4><a class="title-link" name="components-that-interact-with-an-internet-of-things-domain" href="#components-that-interact-with-an-internet-of-things-domain"></a> Components that interact with an Internet of Things domain</h4>
|
||||
|
||||
<p>These components will track devices within a specific domain and consist of a core part and platform-specific logic. These components make their information available via the State Machine and the Event Bus. The component will also register services in the Service Registry to expose control of the devices.</p>
|
||||
|
||||
<p>For example, one of the built-in components is the <code>switch</code> component. This component is responsible for interaction with different types of switches.</p>
|
||||
|
||||
<p>A platform provides support for a particular kind/brand of device. For example, a switch could use a WeMo or Orvibo platform, and a light component might interact with the Hue or LiFX platform.</p>
|
||||
|
||||
<p>If you are planning to add support for a new platform, please check out the <a href="/developers/add_new_platform/">add new platform section</a>.</p>
|
||||
|
||||
<h4><a class="title-link" name="components-that-respond-to-events-that-happen-within-home-assistant" href="#components-that-respond-to-events-that-happen-within-home-assistant"></a> Components that respond to events that happen within Home Assistant</h4>
|
||||
|
||||
<p>These components provide small pieces of home automation logic or services that do common tasks within your house.</p>
|
||||
|
||||
<p>For example the <a href="/components/device_sun_light_trigger/"><code>device_sun_light_trigger</code> component</a> tracks the state of devices and the sun to make sure that the lights are turned on when it gets dark and there are people home. The component uses logic along the following lines:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre> In the event that device 'Paulus Nexus 5' changes to the 'Home' state:
|
||||
If the sun has set and the lights are not on:
|
||||
Turn on the lights
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre> In the event that the combined state of all tracked devices changes to 'Not Home':
|
||||
If the lights are on:
|
||||
Turn off the lights
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre> In the event of the sun setting:
|
||||
If the lights are off and the combined state of all tracked device equals 'Home':
|
||||
Turn on the lights
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>An extended example of a home automation component can be found <a href="https://github.com/home-assistant/home-assistant/blob/master/config/custom_components/example.py">here</a>.</p>
|
||||
|
||||
<h3><a class="title-link" name="the-full-picture" href="#the-full-picture"></a> The full picture</h3>
|
||||
|
||||
<p>When we put all the different pieces of Home Assistant together we see that we match pretty close to the initial sketched home automation overview. The smart home AI is not implemented yet and therefore omitted from the following picture.</p>
|
||||
|
||||
<p class="img">
|
||||
<a href="/images/architecture/ha_full_architecture.png">
|
||||
<img src="/images/architecture/ha_full_architecture.png" />
|
||||
</a>
|
||||
Overview of the full Home Assistant architecture with a couple of loaded components and platforms.
|
||||
</p>
|
||||
|
||||
<p>The platform logic for components uses 3rd party Python libraries to communicate with the devices. This is done so that we can leverage great device libraries that are out there in the Python community.</p>
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/architecture_components.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a class='active' href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
221
developers/component_deps_and_reqs/index.html
Normal file
221
developers/component_deps_and_reqs/index.html
Normal file
|
@ -0,0 +1,221 @@
|
|||
<!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>Requirements & Dependencies - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Instructions how to define requirements and dependencies.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/component_deps_and_reqs/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Requirements & Dependencies">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/component_deps_and_reqs/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Instructions how to define requirements and dependencies.">
|
||||
<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="Requirements & Dependencies">
|
||||
<meta name="twitter:description" content="Instructions how to define requirements and dependencies.">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Requirements & Dependencies
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>Home Assistant allows components and platforms to specify their dependencies and requirements using the variables <code>DEPENDENCIES</code> and <code>REQUIREMENTS</code>. Both are lists that contain strings.</p>
|
||||
|
||||
<p>Dependencies are other Home Assistant components that should be setup before the platform is loaded. An example is the MQTT sensor component, which requires an active connection to an MQTT broker. If Home Assistant is unable to load and setup the MQTT component, it will not setup the MQTT sensor component.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>DEPENDENCIES = [<span class="string"><span class="delimiter">'</span><span class="content">mqtt</span><span class="delimiter">'</span></span>]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Requirements are Python libraries that you would normally install using <code>pip</code>. If Home Assistant is unable to install the requirements or verify it is installed, the component will fail to load.</p>
|
||||
|
||||
<p>Requirements is a list of strings. Each entry is a pip compatible string. For example, the media player Cast platform depends on the Python package PyChromecast v0.6.12:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>REQUIREMENTS = [<span class="string"><span class="delimiter">'</span><span class="content">pychromecast==0.6.12</span><span class="delimiter">'</span></span>]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/component_deps_and_reqs.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a class='active' href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
237
developers/component_discovery/index.html
Normal file
237
developers/component_discovery/index.html
Normal file
|
@ -0,0 +1,237 @@
|
|||
<!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>Component Discovery - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="How to make component discovery work.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/component_discovery/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Component Discovery">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/component_discovery/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="How to make component discovery work.">
|
||||
<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="Component Discovery">
|
||||
<meta name="twitter:description" content="How to make component discovery work.">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Component Discovery
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p class="note warning">
|
||||
This option is only available to built-in components.
|
||||
</p>
|
||||
|
||||
<p>Home Assistant has a discovery service running in the background to discover new devices. Whenever a new device is discovered, an <code>SERVICE_DISCOVERED</code> event will be fired with the found service and the information. The <code>discovery</code> component has some knowledge about which components handle which type of services and will ensure those are loaded and listening before firing the <code>SERVICE_DISCOVERED</code> event.</p>
|
||||
|
||||
<h3><a class="title-link" name="add-discovery-instructions" href="#add-discovery-instructions"></a> Add discovery instructions</h3>
|
||||
|
||||
<p>Device discovery for Home Assistant has been extracted into an external library called <a href="https://github.com/home-assistant/netdisco">NetDisco</a>. This library is integrated using <a href="https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/discovery.py">the <code>discovery</code> component</a> and scans the network in intervals for uPnP and zeroconf/mDNS services.</p>
|
||||
|
||||
<p>To have your device be discovered, you will have to extend the NetDisco library to be able to find your device. This is done by adding a new discoverable. <a href="https://github.com/home-assistant/netdisco/tree/master/netdisco/discoverables">See the repository for examples of existing discoverables.</a></p>
|
||||
|
||||
<h3><a class="title-link" name="listening-to-service_discovered-events" href="#listening-to-service_discovered-events"></a> Listening to <code>SERVICE_DISCOVERED</code> events</h3>
|
||||
|
||||
<p>From your component, you will have to set up the listening for specific services. Below an example how one would listen for discovered Chromecasts:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="keyword">from</span> <span class="include">homeassistant.loader</span> <span class="keyword">import</span> <span class="include">get_component</span>
|
||||
|
||||
<span class="keyword">def</span> <span class="function">setup</span>(hass, config):
|
||||
discovery = get_component(<span class="string"><span class="delimiter">'</span><span class="content">discovery</span><span class="delimiter">'</span></span>)
|
||||
|
||||
<span class="keyword">def</span> <span class="function">chromecast_discovered</span>(service, info):
|
||||
<span class="docstring"><span class="delimiter">"""</span><span class="content"> Called when a Chromecast has been discovered. </span><span class="delimiter">"""</span></span>
|
||||
print(<span class="string"><span class="delimiter">"</span><span class="content">Discovered a new Chromecast: {}</span><span class="delimiter">"</span></span>.format(info))
|
||||
|
||||
discovery.listen(
|
||||
hass, discovery.services.GOOGLE_CAST, chromecast_discovered)
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3><a class="title-link" name="auto-loading-your-component-upon-discovery" href="#auto-loading-your-component-upon-discovery"></a> Auto-loading your component upon discovery</h3>
|
||||
|
||||
<p>The Discovery component is capable of setting up your components before firing the <code>SERVICE_DISCOVERD</code> event. To do this you will have to update the <a href="https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/discovery.py#L29"><code>SERVICE_HANDLERS</code></a> constant in <a href="https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/discovery.py">the <code>discovery</code> component</a>.</p>
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/component_discovery.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a class='active' href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
203
developers/component_events/index.html
Normal file
203
developers/component_events/index.html
Normal file
|
@ -0,0 +1,203 @@
|
|||
<!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>Handling events - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Instructions how to handle events with your component.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/component_events/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Handling events">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/component_events/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Instructions how to handle events with your component.">
|
||||
<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="Handling events">
|
||||
<meta name="twitter:description" content="Instructions how to handle events with your component.">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Handling Events
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>Home Assistant has different ways of responding to events that occur in Home Assistant. These have been organized in <a href="https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/helpers/event.py">helper methods</a>. Examples are <code>track_state_change</code>, <code>track_point_in_time</code>, <code>track_time_change</code>.</p>
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/component_events.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a class='active' href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
285
developers/component_generic_discovery/index.html
Normal file
285
developers/component_generic_discovery/index.html
Normal file
|
@ -0,0 +1,285 @@
|
|||
<!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>Generic Platform Discovery - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Using generic platform discovery.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/component_generic_discovery/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Generic Platform Discovery">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/component_generic_discovery/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Using generic platform discovery.">
|
||||
<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="Generic Platform Discovery">
|
||||
<meta name="twitter:description" content="Using generic platform discovery.">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Generic Platform Discovery
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>New controller or hub components often need to add platforms in sub-components (i.e. Lights & Switches) without additional configuration.<br />
|
||||
This can be achieved using the <code>homeassistant.components.discovery.load_platform</code> method:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="keyword">def</span> <span class="function">load_platform</span>(hass, component, platform, info=<span class="predefined-constant">None</span>, hass_config=<span class="predefined-constant">None</span>)
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>From more info on how this works, refer to the <a href="https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/discovery.py#L78">load_platform</a> method.</p>
|
||||
|
||||
<h3><a class="title-link" name="example" href="#example"></a> Example</h3>
|
||||
|
||||
<p>Say you need to implement your new MyFlashyHub that controls both Switches & Lights, you can follow these steps:</p>
|
||||
|
||||
<p>Configuration required for your new hub component:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="key">myflashyhub</span>:
|
||||
<span class="key">example</span>: <span class="string"><span class="content">setting</span></span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>The source for your component can be located in your configuration directory for now:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>~/.homeassistant/custom_components/myflashyhub.py
|
||||
~/.homeassistant/custom_components/light/myflashyhub.py
|
||||
~/.homeassistant/custom_components/switch/myflashyhub.py
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>In the hub component <code>myflashyhub.py</code> you can call your light and switch components. To pass any non-serializable information to the platforms in the sub-component, you can use a global variable.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="keyword">from</span> <span class="include">homeassistant.components.discovery</span> <span class="keyword">import</span> <span class="include">load_platform</span>
|
||||
DOMAIN = <span class="string"><span class="delimiter">'</span><span class="content">myflashyhub</span><span class="delimiter">'</span></span>
|
||||
|
||||
MFH_GLOBAL = <span class="predefined-constant">None</span>
|
||||
|
||||
<span class="keyword">def</span> <span class="function">setup</span>(hass, config):
|
||||
<span class="docstring"><span class="delimiter">"""</span><span class="content">Your controller/hub specific code.</span><span class="delimiter">"""</span></span>
|
||||
|
||||
<span class="keyword">global</span> MFH_GLOBAL
|
||||
<span class="keyword">if</span> MFH_GLOBAL <span class="keyword">is</span> <span class="predefined-constant">None</span>:
|
||||
MFH_GLOBAL = SomeObjectToInitialiseGlobal
|
||||
<span class="comment">#--- snip ---</span>
|
||||
load_platform(hass, <span class="string"><span class="delimiter">'</span><span class="content">light</span><span class="delimiter">'</span></span>, DOMAIN)
|
||||
load_platform(hass, <span class="string"><span class="delimiter">'</span><span class="content">switch</span><span class="delimiter">'</span></span>, DOMAIN, {<span class="string"><span class="delimiter">'</span><span class="content">optional</span><span class="delimiter">'</span></span>: <span class="string"><span class="delimiter">'</span><span class="content">arguments</span><span class="delimiter">'</span></span>})
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Add your custom device specific code to the <code>setup_platform</code> method in <code>light/myflashyhub.py</code> and <code>switch/myflashyhub</code>.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="keyword">import</span> <span class="include">homeassistant.components.myflashyhub</span> <span class="keyword">as</span> myflashyhub
|
||||
|
||||
<span class="comment"># 'switch' will receive discovery_info={'optional': 'arguments'} </span>
|
||||
<span class="comment"># as passed in above. 'light' will receive discovery_info=None</span>
|
||||
<span class="keyword">def</span> <span class="function">setup_platform</span>(hass, config, add_devices, discovery_info=<span class="predefined-constant">None</span>):
|
||||
<span class="docstring"><span class="delimiter">"""</span><span class="content">Your switch/light specific code.</span><span class="delimiter">"""</span></span>
|
||||
<span class="comment"># You can now use myflashyhub.MFH_GLOBAL</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>The <code>load_platform</code> method allows the platforms to be loaded with the need for any additional platform entries in your <code>configuration.yaml</code> file, which normally would have been:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="comment">#light:</span>
|
||||
<span class="comment"># platform: myflashyhub</span>
|
||||
<span class="comment">#switch:</span>
|
||||
<span class="comment"># platform: myflashyhub</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="note ">
|
||||
In the past, this was achieved by adding your component to the <code>DISCOVERY_PLATFORMS</code> in the target sub-component. Generic discovery through <code>load_platform()</code> allows you to load any sub-component, including custom components, without changing the sub-component.
|
||||
</p>
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/component_generic_discovery.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a class='active' href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
249
developers/component_initialization/index.html
Normal file
249
developers/component_initialization/index.html
Normal file
|
@ -0,0 +1,249 @@
|
|||
<!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>Initializing your components - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Instructions how to handle initialization of your component.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/component_initialization/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Initializing your components">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/component_initialization/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Instructions how to handle initialization of your component.">
|
||||
<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="Initializing your components">
|
||||
<meta name="twitter:description" content="Instructions how to handle initialization of your component.">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Initializing Your Components
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>After loading, the bootstrapper will call <code>setup(hass, config)</code> method on the component to initialize it.</p>
|
||||
|
||||
<h3><a class="title-link" name="hass-the-home-assistant-instance" href="#hass-the-home-assistant-instance"></a> hass: the Home Assistant instance</h3>
|
||||
|
||||
<p>The Home Assistant instance contains three objects to help you interact with the system.</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Object</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>hass.config</code></td>
|
||||
<td>This is the core configuration of Home Assistant exposing location, temperature preferences and config directory path. <a href="https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/core.py#L687">Details</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>hass.states</code></td>
|
||||
<td>This is the StateMachine. It allows you to set states and track when they are changed. <a href="https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/core.py#L434">See available methods</a>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>hass.bus</code></td>
|
||||
<td>This is the EventBus. It allows you to trigger and listen for events.<br /><a href="https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/core.py#L229">See available methods</a>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>hass.services</code></td>
|
||||
<td>This is the ServiceRegistry. It allows you to register services.<br /><a href="https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/core.py#L568">See available methods</a>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3><a class="title-link" name="config-user-given-configuration" href="#config-user-given-configuration"></a> config: User given configuration.</h3>
|
||||
|
||||
<p>The <code>config</code> parameter is a dictionary containing the user supplied configuration. The keys of the dictionary are the component names and the value is another dictionary with the component configuration.</p>
|
||||
|
||||
<p>If your configuration file contains the following lines:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="key">example</span>:
|
||||
<span class="key">host</span>: <span class="string"><span class="content">paulusschoutsen.nl</span></span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Then in the setup method of your component you will be able to refer to <code>config['example']['host']</code> to get the value <code>paulusschoutsen.nl</code>.</p>
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/component_initialization.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a class='active' href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
218
developers/component_loading/index.html
Normal file
218
developers/component_loading/index.html
Normal file
|
@ -0,0 +1,218 @@
|
|||
<!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>Loading your components - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Instructions how to get your component loaded by Home Assistant.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/component_loading/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Loading your components">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/component_loading/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Instructions how to get your component loaded by 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="Loading your components">
|
||||
<meta name="twitter:description" content="Instructions how to get your component loaded by 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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Loading Your Components
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>A component will be loaded on start if a section (ie. <code>light:</code>) for it exists in the config file. A component can also be loaded if another component is loaded that depends on it. When loading a component Home Assistant will check the following paths:</p>
|
||||
|
||||
<ul>
|
||||
<li><code><config directory>/custom_components/<component name></code></li>
|
||||
<li><code>homeassistant/components/<component name></code> (built-in components)</li>
|
||||
</ul>
|
||||
|
||||
<p>Once loaded, a component will only be setup if all dependencies can be loaded and are able to setup. Keep an eye on the logs to see if your component could be loaded and initialized.</p>
|
||||
|
||||
<p class="note warning">
|
||||
You can override a built-in component by having a component with the same name in your <code>config/custom_components</code> folder. This is not recommended and will probably break things!
|
||||
</p>
|
||||
|
||||
<p class="note">
|
||||
Home Assistant will use the directory that contains your config file as the directory that holds your customizations. By default this is the <code>config</code> folder in your current work directory. You can use a different folder by running Home Assistant with the –config argument: <code>python3 homeassistant --config /YOUR/CONFIG/PATH/</code>.
|
||||
</p>
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/component_loading.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a class='active' href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
215
developers/component_states/index.html
Normal file
215
developers/component_states/index.html
Normal file
|
@ -0,0 +1,215 @@
|
|||
<!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>Handling states - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Instructions how to handle states with your component.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/component_states/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Handling states">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/component_states/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Instructions how to handle states with your component.">
|
||||
<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="Handling states">
|
||||
<meta name="twitter:description" content="Instructions how to handle states with your component.">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Handling States
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>It is the responsibility of the component to maintain the states of the devices in your domain. Each device should be a single state and, if possible, a group should be provided that tracks the combined state of the devices.</p>
|
||||
|
||||
<p>A state can have several attributes that will help the frontend in displaying your state:</p>
|
||||
|
||||
<ul>
|
||||
<li><code>friendly_name</code>: this name will be used as the name of the device</li>
|
||||
<li><code>entity_picture</code>: this picture will be shown instead of the domain icon</li>
|
||||
<li><code>unit_of_measurement</code>: this will be appended to the state in the interface</li>
|
||||
<li><code>hidden</code>: This is a suggestion to the frontend on if the state should be hidden</li>
|
||||
</ul>
|
||||
|
||||
<p>These attributes are defined in <a href="https://github.com/home-assistant/home-assistant/blob/master/homeassistant/helpers/entity.py#L180">homeassistant.helpers.entity</a>.</p>
|
||||
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/component_states.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a class='active' href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
214
developers/component_visibility/index.html
Normal file
214
developers/component_visibility/index.html
Normal file
|
@ -0,0 +1,214 @@
|
|||
<!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>Handling visibility - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Instructions how to handle visibility with your component.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/component_visibility/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Handling visibility">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/component_visibility/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Instructions how to handle visibility with your component.">
|
||||
<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="Handling visibility">
|
||||
<meta name="twitter:description" content="Instructions how to handle visibility with your component.">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Handling Visibility
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>Generally, when creating a new entity for Home Assistant you will want it to be a class that inherits the <a href="https://github.com/home-assistant/home-assistant/blob/master/homeassistant/helpers/entity.py">homeassistant.helpers.entity.Entity</a> class. If this is done, visibility will be handled for you. <br />
|
||||
You can set a suggestion for your entity’s visibility by setting the <code>hidden</code> property by doing something similar to the following.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="predefined-constant">self</span>.hidden = <span class="predefined-constant">True</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>This will SUGGEST that the active frontend hides the entity. This requires that the active frontend support hidden cards (the default frontend does) and that the value of hidden be included in your attributes dictionary (see above). The Entity abstract class will take care of this for you.</p>
|
||||
|
||||
<p>Remember: The suggestion set by your component’s code will always be overwritten by user settings in the configuration.yaml file. This is why you may set hidden to be False, but the property may remain True (or vice-versa).</p>
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/component_visibility.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a class='active' href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
220
developers/creating_components/index.html
Normal file
220
developers/creating_components/index.html
Normal file
|
@ -0,0 +1,220 @@
|
|||
<!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>Creating components - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Guidelines to get you create your first component for Home Assistant.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/creating_components/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Creating components">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/creating_components/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Guidelines to get you create your first component for 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="Creating components">
|
||||
<meta name="twitter:description" content="Guidelines to get you create your first component for 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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Creating Components
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>Alright, you’re ready to make your first component. AWESOME. Don’t worry, we’ve tried hard to keep it as easy as possible.</p>
|
||||
|
||||
<h3><a class="title-link" name="example-component" href="#example-component"></a> Example component</h3>
|
||||
|
||||
<p>Add <code>hello_state:</code> to your <code>configuration.yaml</code> file and create a file <code><config_dir>/custom_components/hello_state.py</code> with the below code to test it locally.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>DOMAIN = <span class="string"><span class="delimiter">'</span><span class="content">hello_state</span><span class="delimiter">'</span></span>
|
||||
|
||||
<span class="keyword">def</span> <span class="function">setup</span>(hass, config):
|
||||
hass.states.set(<span class="string"><span class="delimiter">'</span><span class="content">hello.world</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">'</span><span class="content">Paulus</span><span class="delimiter">'</span></span>)
|
||||
|
||||
<span class="keyword">return</span> <span class="predefined-constant">True</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>For more examples, see the <a href="/cookbook/#custom-python-component-examples">Custom Python Component Examples</a> on our examples page.</p>
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/creating_components.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a class='active' href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
369
developers/credits/index.html
Normal file
369
developers/credits/index.html
Normal file
|
@ -0,0 +1,369 @@
|
|||
<!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>Credits - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Credits for the developers who contributed to Home Assistant.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/credits/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Credits">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/credits/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Credits for the developers who contributed to 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="Credits">
|
||||
<meta name="twitter:description" content="Credits for the developers who contributed to 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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Credits
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>This page contains a list of people who have contributed in one way or another to Home Assistant.</p>
|
||||
|
||||
<h3><a class="title-link" name="author" href="#author"></a> Author</h3>
|
||||
|
||||
<ul>
|
||||
<li><a href="https://github.com/balloob">Paulus Schoutsen</a></li>
|
||||
</ul>
|
||||
|
||||
<h3><a class="title-link" name="contributors" href="#contributors"></a> Contributors</h3>
|
||||
|
||||
<p>(in alphabetical order)</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="https://github.com/armills">Adam Mills</a></li>
|
||||
<li><a href="https://github.com/adrienbrault">Adrien Brault</a></li>
|
||||
<li><a href="https://github.com/shaftoe">Alexander Fortin</a></li>
|
||||
<li><a href="https://github.com/infamy">Alex Harvey</a></li>
|
||||
<li><a href="https://github.com/allanglen">Allan Glen</a></li>
|
||||
<li><a href="https://github.com/AlucardZero">AlucardZero</a></li>
|
||||
<li><a href="https://github.com/fignuts">amorsillo</a></li>
|
||||
<li><a href="https://github.com/aoakeson">Andrew</a></li>
|
||||
<li><a href="https://github.com/aceat64">Andrew LeCody</a></li>
|
||||
<li><a href="https://github.com/andylockran">Andy Loughran</a></li>
|
||||
<li><a href="https://github.com/andythigpen">andythigpen</a></li>
|
||||
<li><a href="https://github.com/aparraga">Antonio Párraga Navarro</a></li>
|
||||
<li><a href="https://github.com/Ardetus">Ardetus</a></li>
|
||||
<li><a href="https://github.com/omgapuppy">Ardi Mehist</a></li>
|
||||
<li><a href="https://github.com/arsaboo/">arsaboo</a></li>
|
||||
<li><a href="https://github.com/leoc">Arthur Leonard Andersen</a></li>
|
||||
<li><a href="https://github.com/trainman419">Austin</a></li>
|
||||
<li><a href="https://github.com/Azelphur">Azelphur</a></li>
|
||||
<li><a href="https://github.com/Bart274">Bart274</a></li>
|
||||
<li><a href="https://github.com/blackdog70">blackdog70</a></li>
|
||||
<li><a href="https://github.com/bburan">Brad Buran</a></li>
|
||||
<li><a href="https://github.com/bradsk88">Brad Johnson</a></li>
|
||||
<li><a href="https://github.com/bah2830">Brent</a></li>
|
||||
<li><a href="https://github.com/badele">Bruno Adele</a></li>
|
||||
<li><a href="https://github.com/CCOSTAN">Carlo Costanzo</a></li>
|
||||
<li><a href="https://github.com/srcLurker">Charles Spirakis</a></li>
|
||||
<li><a href="https://github.com/chrisvis">Chris Mulder</a></li>
|
||||
<li><a href="https://github.com/LinuxChristian">Christian Braedstrup</a></li>
|
||||
<li><a href="https://github.com/coteyr/">coteyr</a></li>
|
||||
<li><a href="https://github.com/dale3h">Dale Higgs</a></li>
|
||||
<li><a href="https://github.com/Cinntax">Dan Cinnamon</a></li>
|
||||
<li><a href="https://github.com/danielperna84">Daniel Perna</a></li>
|
||||
<li><a href="https://github.com/danielhiversen">Daniel Høyer Iversen</a></li>
|
||||
<li><a href="https://github.com/danieljkemp/">Daniel J. Kemp</a></li>
|
||||
<li><a href="https://github.com/usul27">Daniel Matuschek</a></li>
|
||||
<li><a href="https://github.com/kk7ds">Dan Smith</a></li>
|
||||
<li><a href="https://github.com/dansullivan86/">Dan Sullivan</a></li>
|
||||
<li><a href="https://github.com/Xorso">Daren Lord</a></li>
|
||||
<li><a href="https://github.com/FreekingDean">Dean Galvin</a></li>
|
||||
<li><a href="https://github.com/TheRealLink">Dennis Karpienski</a></li>
|
||||
<li><a href="https://github.com/devdelay">devdelay</a></li>
|
||||
<li><a href="https://github.com/Dutchy-">Edwin Smulders</a></li>
|
||||
<li><a href="https://github.com/flyte">Ellis Percival</a></li>
|
||||
<li><a href="https://github.com/xrolfex">Eric Rolf</a></li>
|
||||
<li><a href="https://github.com/ettisan">ettisan</a></li>
|
||||
<li><a href="https://github.com/fabaff">Fabian Affolter</a></li>
|
||||
<li><a href="https://github.com/xifle">Felix</a></li>
|
||||
<li><a href="https://github.com/fbradyirl">Finbarr Brady</a></li>
|
||||
<li><a href="https://github.com/flavio">Flavio Castelli</a></li>
|
||||
<li><a href="https://github.com/florianholzapfel">Florian Holzapfel</a></li>
|
||||
<li><a href="https://github.com/GadgetReactor">GadgetReactor</a></li>
|
||||
<li><a href="https://github.com/kangaroo">Geoff Norton</a></li>
|
||||
<li><a href="https://github.com/goir">goir</a></li>
|
||||
<li><a href="https://github.com/gottsman">gottsman</a></li>
|
||||
<li><a href="https://github.com/pavoni">Greg Dowling</a></li>
|
||||
<li><a href="https://github.com/gbarba">Guillem Barba</a></li>
|
||||
<li><a href="https://github.com/Gyran">Gustav Ahlberg</a></li>
|
||||
<li><a href="https://github.com/gwendalg">gwendalg</a></li>
|
||||
<li><a href="https://github.com/happyleavesaoc">happyleavesaoc</a></li>
|
||||
<li><a href="https://github.com/heathbar">Heathbar</a></li>
|
||||
<li><a href="https://github.com/hmronline">Hernán</a></li>
|
||||
<li><a href="https://github.com/HydrelioxGitHub">Hydreliox</a></li>
|
||||
<li><a href="https://github.com/ishults">Igor Shults</a></li>
|
||||
<li><a href="https://github.com/issackelly">Issac Kelly</a></li>
|
||||
<li><a href="https://github.com/jamespcole">James Cole</a></li>
|
||||
<li><a href="https://github.com/jaharkes">Jan Harkes</a></li>
|
||||
<li><a href="https://github.com/jpmossin">Jan-Preben Mossin</a></li>
|
||||
<li><a href="https://github.com/DesignFirst">Jaret Stezelberger</a></li>
|
||||
<li><a href="https://github.com/Jypy">Jean-Philippe Bouillot</a></li>
|
||||
<li><a href="https://github.com/linjef/">Jeffrey Lin</a></li>
|
||||
<li><a href="https://github.com/Qrtn">Jeffrey Tang</a></li>
|
||||
<li><a href="https://github.com/SEJeff">Jeff Schroeder</a></li>
|
||||
<li><a href="https://github.com/joelash">Joel Asher Friedman</a></li>
|
||||
<li><a href="https://github.com/joemcmonagle">Joe McMonagle</a></li>
|
||||
<li><a href="https://github.com/turbokongen">John Arild Berentsen</a></li>
|
||||
<li><a href="https://github.com/loghound">John McLaughlin</a></li>
|
||||
<li><a href="https://github.com/Jaidan">John Williams</a></li>
|
||||
<li><a href="https://github.com/maddox">Jon Maddox</a></li>
|
||||
<li><a href="https://github.com/joopert">joopert</a></li>
|
||||
<li><a href="https://github.com/joshughes">Joseph Hughes</a></li>
|
||||
<li><a href="https://github.com/eagleamon">Joseph Piron</a></li>
|
||||
<li><a href="https://github.com/JshWright/">Josh Wright</a></li>
|
||||
<li><a href="https://github.com/jd">Julien Danjou</a></li>
|
||||
<li><a href="https://github.com/justincmoy">Justin Moy</a></li>
|
||||
<li><a href="https://github.com/justyns/">Justyn Shull</a></li>
|
||||
<li><a href="https://github.com/kfgoode">Karen Goode</a></li>
|
||||
<li><a href="https://github.com/keatontaylor">Keaton Taylor</a></li>
|
||||
<li><a href="https://github.com/kennedyshead">kennedyshead</a></li>
|
||||
<li><a href="https://github.com/kixam">kixam</a></li>
|
||||
<li><a href="https://github.com/kylehendricks">Kyle Hendricks</a></li>
|
||||
<li><a href="https://github.com/lwis/">Lewis Juggins</a></li>
|
||||
<li><a href="https://github.com/LucaSoldi">Luca Soldi</a></li>
|
||||
<li><a href="https://github.com/lukas-hetzenecker">Lukas Hetzenecker</a></li>
|
||||
<li><a href="https://github.com/MagnusKnutas">Magnus Knutas</a></li>
|
||||
<li><a href="https://github.com/MakeMeASandwich">MakeMeASandwich</a></li>
|
||||
<li><a href="https://github.com/deisi">Malte Deiseroth</a></li>
|
||||
<li><a href="https://github.com/vmulpuru">Manoj</a></li>
|
||||
<li><a href="https://github.com/bimbar">Markus Peter</a></li>
|
||||
<li><a href="https://github.com/fingon">Markus Stenberg</a></li>
|
||||
<li><a href="https://github.com/MartinHjelmare">Martin Hjelmare</a></li>
|
||||
<li><a href="https://github.com/t30">Matteo Lampugnani</a></li>
|
||||
<li><a href="https://github.com/mtreinish/">Matthew Treinish</a></li>
|
||||
<li><a href="https://github.com/michaelarnauts">Michaël Arnauts</a></li>
|
||||
<li><a href="https://github.com/Zyell">Michael Gilbert</a></li>
|
||||
<li><a href="https://github.com/michaelkuty">Michael Kutý</a></li>
|
||||
<li><a href="https://github.com/milaq">Micha LaQua</a></li>
|
||||
<li><a href="https://github.com/miniconfig">miniconfig</a></li>
|
||||
<li><a href="https://github.com/molobrakos">molobrakos</a></li>
|
||||
<li><a href="https://github.com/moonshot">Moon Shot</a></li>
|
||||
<li><a href="https://github.com/partofthething">Nick Touran</a></li>
|
||||
<li><a href="https://github.com/nickwaring">Nick Waring</a></li>
|
||||
<li><a href="https://github.com/darookee">Nils Uliczka</a></li>
|
||||
<li><a href="https://github.com/nkgilley">Nolan Gilley</a></li>
|
||||
<li><a href="https://github.com/mcdeck">Oliver van Porten</a></li>
|
||||
<li><a href="https://github.com/oeysteinhansen">Øystein Hansen</a></li>
|
||||
<li><a href="https://github.com/bachp">Pascal Bach</a></li>
|
||||
<li><a href="https://github.com/pvizeli">Pascal Vizeli</a></li>
|
||||
<li><a href="https://github.com/persandstrom">Per Sandström</a></li>
|
||||
<li><a href="https://github.com/philipbl">Philip Lundrigan</a></li>
|
||||
<li><a href="https://github.com/Piratonym">Piratonym</a></li>
|
||||
<li><a href="https://github.com/mikegrb">Rev Michael Greb</a></li>
|
||||
<li><a href="https://github.com/rhooper">rhooper</a></li>
|
||||
<li><a href="https://github.com/Mosibi">Richard Arends</a></li>
|
||||
<li><a href="https://github.com/khabi">Richard Cox</a></li>
|
||||
<li><a href="https://github.com/rkabadi">rkabadi</a></li>
|
||||
<li><a href="https://github.com/robbiet480">Robbie Trencheny</a></li>
|
||||
<li><a href="https://github.com/olimpiurob">Rob Olimpiu</a></li>
|
||||
<li><a href="https://github.com/GreenTurtwig">Rowan Hine</a></li>
|
||||
<li><a href="https://github.com/rubund">rubund</a></li>
|
||||
<li><a href="https://github.com/rmkraus">Ryan Kraus</a></li>
|
||||
<li><a href="https://github.com/ryanturner">Ryan Turner</a></li>
|
||||
<li><a href="https://github.com/sander76">sander76</a></li>
|
||||
<li><a href="https://github.com/sdague">Sean Dague</a></li>
|
||||
<li><a href="https://github.com/sfam">sfam</a></li>
|
||||
<li><a href="https://github.com/stefan-jonasson">Stefan Jonasson</a></li>
|
||||
<li><a href="https://github.com/stjohnjohnson">St. John Johnson</a></li>
|
||||
<li><a href="https://github.com/TangoAlpha">TangoAlpha</a></li>
|
||||
<li><a href="https://github.com/tpatja">Teemu Patja</a></li>
|
||||
<li><a href="https://github.com/Theb-1">Theb-1</a></li>
|
||||
<li><a href="https://github.com/theolind">Theodor Lindquist</a></li>
|
||||
<li><a href="https://github.com/tilutza">tilutza</a></li>
|
||||
<li><a href="https://github.com/timharton">Tim Harton</a></li>
|
||||
<li><a href="https://github.com/toddeye">toddeye</a></li>
|
||||
<li><a href="https://github.com/tomduijf">Tom Duijf</a></li>
|
||||
<li><a href="https://github.com/trollkarlen">trollkarlen</a></li>
|
||||
<li><a href="https://github.com/vitorespindola">vitorespindola</a></li>
|
||||
<li><a href="https://github.com/wkonkel">Warren Konkel</a></li>
|
||||
<li><a href="https://github.com/w1ll1am23">William Scanlon</a></li>
|
||||
<li><a href="https://github.com/wind-rider">wind-rider</a></li>
|
||||
<li><a href="https://github.com/wokar">wokar</a></li>
|
||||
<li><a href="https://github.com/zmrow">Zac Mrowicki</a></li>
|
||||
</ul>
|
||||
|
||||
<p>This page is irregularly updated. As a base we use the Github <a href="https://github.com/home-assistant/home-assistant/graphs/contributors">contributors overview</a> of the Home Assistant git repository and the <a href="https://github.com/home-assistant/home-assistant.io/graphs/contributors">overview</a> for <a href="https://home-assistant.io">home-assistant.io</a>. If you think that you are missing, please let us know or add yourself.</p>
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/credits.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a class='active' href='/developers/credits/'>Credits </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://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>
|
212
developers/development/index.html
Normal file
212
developers/development/index.html
Normal file
|
@ -0,0 +1,212 @@
|
|||
<!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>Starting with Development - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Everything to get you started developing for Home Assistant.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/development/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Starting with Development">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/development/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Everything to get you started developing for 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="Starting with Development">
|
||||
<meta name="twitter:description" content="Everything to get you started developing for 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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Starting With Development
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>Home Assistant is built from the ground up to be easily-extensible by other developers using components. It uses <a href="https://www.python.org/">Python 3</a> for the backend and <a href="https://www.polymer-project.org/">Polymer (Web components)</a> for the frontend.</p>
|
||||
|
||||
<p>Home Assistant is open-source and MIT licensed. The source can be found here:</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="https://github.com/home-assistant/home-assistant">home-assistant</a> - Python server backend</li>
|
||||
<li><a href="https://github.com/home-assistant/home-assistant-js">home-assistant-js</a> - JavaScript backend powering the client</li>
|
||||
<li><a href="https://github.com/home-assistant/home-assistant-polymer">home-assistant-polymer</a> - Polymer UI</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.io/tree/master/source/developers/development.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a class='active' href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
232
developers/development_catching_up/index.html
Normal file
232
developers/development_catching_up/index.html
Normal file
|
@ -0,0 +1,232 @@
|
|||
<!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>Catching up with Reality - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Update your fork with the latest commit.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/development_catching_up/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Catching up with Reality">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/development_catching_up/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Update your fork with the latest commit.">
|
||||
<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="Catching up with Reality">
|
||||
<meta name="twitter:description" content="Update your fork with the latest commit.">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Catching Up With Reality
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>If you’re taking a while developing your feature and would like to catch up with what’s in the current Home Assistant <code>dev</code> branch, you can use <code>git rebase</code> to do so. This will pull the latest Home Assistant changes locally, rewind your commits, bring in the latest changes from Home Assistant and then replay all of your commits on top.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre># Run this from your feature branch
|
||||
$ git fetch upstream dev # to pull the latest changes into a local dev branch
|
||||
$ git rebase upstream/dev # to put those changes into your feature branch before your changes
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>If rebase detects conflicts, you can repeat the following process until all changes have been resolved:</p>
|
||||
|
||||
<ol>
|
||||
<li><code>git status</code> will show you the file with the conflict.</li>
|
||||
<li>Edit the file and resolving the lines between <code><<<< | >>>></code></li>
|
||||
<li>Add the modified file <code>git add <file></code> or <code>git add .</code></li>
|
||||
<li>Continue rebase <code>git rebase --continue</code></li>
|
||||
<li>Repeat until you’ve resolved all conflicts.</li>
|
||||
</ol>
|
||||
|
||||
<p>There is other workflows that is covered in detail in the <a href="https://help.github.com/articles/fork-a-repo/">Github documentation</a>. Add an additional <code>remote</code> after you clone your fork.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ git remote add upstream https://github.com/home-assistant/home-assistant.git
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>and then simply <code>git pull --rebase upstream dev</code>.</p>
|
||||
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/development_catching_up.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a class='active' href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
211
developers/development_checklist/index.html
Normal file
211
developers/development_checklist/index.html
Normal file
|
@ -0,0 +1,211 @@
|
|||
<!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>Checklist - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Overview of the requirements for an improvment for Home Assistant.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/development_checklist/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Checklist">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/development_checklist/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Overview of the requirements for an improvment for 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="Checklist">
|
||||
<meta name="twitter:description" content="Overview of the requirements for an improvment for 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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Checklist
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>After you finish your work:</p>
|
||||
|
||||
<ul>
|
||||
<li>Check that all dependencies are included via the <code>REQUIREMENTS</code> variable in your platform/component and only imported inside functions that use them.</li>
|
||||
<li>Add any new dependencies to <code>requirements_all.txt</code> if needed. Use <code>script/gen_requirements_all.py</code>.</li>
|
||||
<li>Update the <code>.coveragerc</code> file to exclude your platform if there are no tests available or your new code uses a 3rd party library for communication with the device/service/sensor.</li>
|
||||
<li>Provide some documentation for <a href="https://home-assistant.io/">home-assistant.io</a>. It’s OK to just add a docstring with configuration details (sample entry for <code>configuration.yaml</code> file and alike) to the file header as a start. Visit the <a href="/developers/website/">website documentation</a> for further information on contributing to <a href="https://github.com/home-assistant/home-assistant.io">home-assistant.io</a>.</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.io/tree/master/source/developers/development_checklist.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a class='active' href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
219
developers/development_environment/index.html
Normal file
219
developers/development_environment/index.html
Normal file
|
@ -0,0 +1,219 @@
|
|||
<!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>Setup Development Environment - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Setup your environment to start developing for Home Assistant.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/development_environment/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Setup Development Environment">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/development_environment/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Setup your environment to start developing for 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="Setup Development Environment">
|
||||
<meta name="twitter:description" content="Setup your environment to start developing for 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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Setup Development Environment
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>You will need to set up a development environment if you want to start developing a new feature or component for Home Assistant. Please follow these steps to get setup.<br />
|
||||
Visit the <a href="https://github.com/home-assistant/home-assistant">the Home Assistant repository</a> first and click fork in the top right.</p>
|
||||
|
||||
<p>We suggest that you setup a virtual environment using <a href="https://docs.python.org/3.4/library/venv.html"><code>venv</code></a> before running the setup script.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ git clone https://github.com/YOUR_GIT_USERNAME/home-assistant.git
|
||||
$ cd home-assistant
|
||||
$ git remote add upstream https://github.com/home-assistant/home-assistant.git
|
||||
$ script/setup
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<p>On Windows you can use <code>python setup.py develop</code> instead of the setup script.</p>
|
||||
|
||||
<p>After following these steps, running <code>hass</code> will invoke your local installation.</p>
|
||||
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/development_environment.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a class='active' href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
219
developers/development_submitting/index.html
Normal file
219
developers/development_submitting/index.html
Normal file
|
@ -0,0 +1,219 @@
|
|||
<!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>Submit your work - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Submit your work as Pull Request for Home Assistant.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/development_submitting/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Submit your work">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/development_submitting/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Submit your work as Pull Request for 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="Submit your work">
|
||||
<meta name="twitter:description" content="Submit your work as Pull Request for 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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Submit Your Work
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>Improvements, fixes, and new features to Home Assistant should be submitted one feature at a time using GitHub <a href="https://help.github.com/articles/using-pull-requests">Pull Requests</a>.</p>
|
||||
|
||||
<ol>
|
||||
<li>From your fork, create a new branch to hold your changes<br />
|
||||
<code>git checkout -b some-feature</code></li>
|
||||
<li>Make the changes you want, create a <a href="/developers/add_new_platform/">new platform</a>, develop a <a href="/developers/creating_components/">new component</a>, or fix <a href="https://github.com/home-assistant/home-assistant/issues">issues</a>.</li>
|
||||
<li><a href="/developers/development_testing/">Test your changes</a> and check for style violations</li>
|
||||
<li>Commit the changes if all <a href="/developers/development_checklist/">musts</a> are covered.<br />
|
||||
<code>git add .</code><br />
|
||||
<code>git commit -m "Added some-feature"</code></li>
|
||||
<li>Consider to add tests to ensure that the code works.</li>
|
||||
<li>Push your committed changes back to your fork on GitHub<br />
|
||||
<code>git push origin HEAD</code></li>
|
||||
<li>Follow <a href="https://help.github.com/articles/creating-a-pull-request/">these steps</a> to create your pull request.</li>
|
||||
<li>Check for comments and suggestions on your Pull Request and keep an eye on the <a href="https://travis-ci.org/home-assistant/home-assistant/">CI output</a>.</li>
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/development_submitting.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a class='active' href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
245
developers/development_testing/index.html
Normal file
245
developers/development_testing/index.html
Normal file
|
@ -0,0 +1,245 @@
|
|||
<!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>Testing your code - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Make sure that your code passes the checks">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/development_testing/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Testing your code">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/development_testing/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Make sure that your code passes the checks">
|
||||
<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="Testing your code">
|
||||
<meta name="twitter:description" content="Make sure that your code passes the checks">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Testing Your Code
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>Home Assistant enforces strict <a href="https://www.python.org/dev/peps/pep-0008/">PEP8 style</a> compliance on all code submitted. Every Pull Request is automatically tested with <a href="https://coveralls.io/github/home-assistant/home-assistant">Coveralls</a> and <a href="https://travis-ci.org/home-assistant/home-assistant">Travis CI</a> after it is created.</p>
|
||||
|
||||
<h3><a class="title-link" name="local-testing" href="#local-testing"></a> Local testing</h3>
|
||||
|
||||
<p>It’s highly recommanded to run <code>tox</code> before you create your Pull Request to avoid annoying fixes. Local testing requires <code>tox</code> to be installed.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ pip3 install tox
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Start the test of your code with <code>tox</code>.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ tox
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>This will run unit tests against python 3.4 and 3.5 (if both are available locally), as well as run a set of tests which validate <code>pep8</code> and <code>pylint</code> style of the code.</p>
|
||||
|
||||
<p>You can optionally run tests on only one tox target using the <code>-e</code> option to select an environment.</p>
|
||||
|
||||
<p>For instance <code>tox -e lint</code> will run the linters only, <code>tox -e py34</code> will run unit tests only on python 3.4.</p>
|
||||
|
||||
<h3><a class="title-link" name="prevent-linter-errors" href="#prevent-linter-errors"></a> Prevent Linter Errors</h3>
|
||||
|
||||
<p>You can save yourself the hassle of extra commits just to fix style errors by enabling the flake8 git commit hook. It will check your code when you attempt to commit to the repository. It will block the commit if there are any style issues, giving you a chance to fix it.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ pip3 install flake8 flake8-docstrings
|
||||
$ flake8 --install-hook
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>The flake8-docstrings extension will check docstrings according to <a href="https://www.python.org/dev/peps/pep-0257/">PEP257</a> when running flake8.</p>
|
||||
|
||||
<h3><a class="title-link" name="notes-on-pylint-and-pep8-validation" href="#notes-on-pylint-and-pep8-validation"></a> Notes on PyLint and PEP8 validation</h3>
|
||||
|
||||
<p>In case a PyLint warning cannot be avoided, add a comment to disable the PyLint check for that line. This can be done using the format <code># pylint: disable=YOUR-ERROR-NAME</code>. Example of an unavoidable PyLint warning is if you do not use the passed in datetime if you’re listening for time change.</p>
|
||||
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/development_testing.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a class='active' href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
279
developers/frontend/index.html
Normal file
279
developers/frontend/index.html
Normal file
|
@ -0,0 +1,279 @@
|
|||
<!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>Frontend development - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Tips and hints if you are starting on Home Assistant frontend development">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/frontend/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Frontend development">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/frontend/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Tips and hints if you are starting on Home Assistant frontend development">
|
||||
<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="Frontend development">
|
||||
<meta name="twitter:description" content="Tips and hints if you are starting on Home Assistant frontend development">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Frontend Development
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>Home Assistant uses <a href="https://www.polymer-project.org/">Polymer</a> for the UI and <a href="http://optimizely.github.io/nuclear-js/">NuclearJS</a> for maintaing the app state.</p>
|
||||
|
||||
<ul>
|
||||
<li>Polymer allows building encapsulated custom HTML elements.<br />
|
||||
<a href="https://github.com/home-assistant/home-assistant-polymer">Home-Assistant-Polymer source code on GitHub.</a></li>
|
||||
<li>NuclearJS is a reactive flux built with ImmutableJS data structures.<br />
|
||||
<a href="https://github.com/home-assistant/home-assistant-js">Home-Assistant-JS source code on GitHub.</a></li>
|
||||
</ul>
|
||||
|
||||
<p class="note warning">
|
||||
Do not use development mode in production. Home Assistant uses aggressive caching to improve the mobile experience. This is disabled during development so that you do not have to restart the server in between changes.
|
||||
</p>
|
||||
|
||||
<h2><a class="title-link" name="setting-up-the-environment" href="#setting-up-the-environment"></a> Setting up the environment</h2>
|
||||
|
||||
<p>Home Assistant will by default serve the compiled version of the frontend. To enable development mode for Home Assistant, update your <code>configuration.yaml</code> to have these lines:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="key">http</span>:
|
||||
<span class="key">development</span>: <span class="string"><span class="content">1</span></span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>As everything is compiled into the file <code>frontend.html</code> you do not want to work with the compiled version but with the seperate files during development.</p>
|
||||
|
||||
<p>Next step is to get the frontend code. When you clone the Home Assistant repository, the frontend repository is not cloned by default. You can setup the frontend development environment by running:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ script/setup
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2><a class="title-link" name="development" href="#development"></a> Development</h2>
|
||||
|
||||
<p>While you are developing, you need to have webpack running to have your JavaScript changes be made available.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ cd homeassistant/components/frontend/www_static/home-assistant-polymer
|
||||
$ npm run js_dev
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>The source code for the frontend can be found in two different directories:</p>
|
||||
|
||||
<ul>
|
||||
<li>UI: <code>homeassistant/components/frontend/www_static/home-assistant-polymer/src/</code></li>
|
||||
<li>Core: <code>homeassistant/components/frontend/www_static/home-assistant-polymer/node_modules/home-assistant-js/src/</code></li>
|
||||
</ul>
|
||||
|
||||
<p>After your changes have been accepted into the home-assistant-js repository, you’ll have to update Home Assistant Polymer to use the latest version of it. This can be done by updating <code>package.json</code>. Look for the line that contains home-assistant-js and update the SHA to the SHA of the last commit.</p>
|
||||
|
||||
<h1><a class="title-link" name="building-the-polymer-frontend" href="#building-the-polymer-frontend"></a> Building the Polymer frontend</h1>
|
||||
|
||||
<p>Building a new version of the frontend is as simple as running <code>script/build_frontend</code>. This fires off the following commands:</p>
|
||||
|
||||
<ul>
|
||||
<li><strong>home-assistant-polymer</strong>: Install NPM dependencies.</li>
|
||||
<li><strong>home-assistant-polymer</strong>: start frontend build.
|
||||
<ul>
|
||||
<li>Compile all used JavaScript to <code>_app_compiled.js</code>.</li>
|
||||
<li>Install Bower dependencies.</li>
|
||||
<li>Vulcanize all Webcomponents to <code>frontend.vulcan.html</code>.</li>
|
||||
<li>Minify <code>frontend.vulcan.html</code> and save it as <code>frontend.html</code>.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Copy the webcomponents polyfill <code>webcomponents-lite.min.js</code> from <strong>home-assistant-polymer</strong> to <code>components/frontend/www_static/webcomponents-lite.min.js</code>.</li>
|
||||
<li>Copy the final frontend build <code>frontend.html</code> from <strong>home-assistant-polymer</strong> to <code>components/frontend/www_static/frontend/</code>.</li>
|
||||
<li>Generate MD5 hash of <code>frontend.html</code> to signal caches to redownload the UI.</li>
|
||||
</ul>
|
||||
|
||||
<p class="img">
|
||||
<img src="/images/frontend/polymer-build-architecture.png" alt="Polymer build architecture diagram" />
|
||||
Polymer build architecture diagram
|
||||
</p>
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/frontend.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a class='active' href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
222
developers/frontend_add_card/index.html
Normal file
222
developers/frontend_add_card/index.html
Normal file
|
@ -0,0 +1,222 @@
|
|||
<!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>Adding state card - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Adding a state card to the frontend">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/frontend_add_card/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Adding state card">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/frontend_add_card/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Adding a state card to the frontend">
|
||||
<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="Adding state card">
|
||||
<meta name="twitter:description" content="Adding a state card to the frontend">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Adding State Card
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>The main interface of Home Assistant is a list of the current entities and their states. For each entity in the system, a state card will be rendered. State cards will show an icon, the name of the entity, when the state has last changed and the current state or a control to interact with it.</p>
|
||||
|
||||
<p><img src="/images/frontend/frontend-cards1.png" alt="Cards in the frontend" /></p>
|
||||
|
||||
<p>The different card types can be found <a href="https://github.com/home-assistant/home-assistant-polymer/tree/master/src/state-summary">here</a>.</p>
|
||||
|
||||
<p>Sensors, when not <a href="/components/group/">grouped</a>, are shown as so-called badges on top of the state cards.</p>
|
||||
|
||||
<p><img src="/images/frontend/frontend-badges.png" alt="Badges in the frontend" /></p>
|
||||
|
||||
<p>The different badges are located in the file <a href="https://github.com/home-assistant/home-assistant-polymer/blob/master/src/components/entity/ha-state-label-badge.js"><code>/src/components/entity/ha-state-label-badge.js</code></a>.</p>
|
||||
|
||||
<p>Adding a custom card type can be done with a few simple steps. For this example we will add a new state card for the domain <code>camera</code>:</p>
|
||||
|
||||
<ol>
|
||||
<li>Add <code>'camera'</code> to the array <code>DOMAINS_WITH_CARD</code> in the file <a href="https://github.com/home-assistant/home-assistant-polymer/blob/master/src/util/state-card-type.js#L3-L4">/util/state-card-type.js</a>.</li>
|
||||
<li>Create the files <code>state-card-camera.html</code> and <code>state-card-camera.js</code> in the folder <a href="https://github.com/home-assistant/home-assistant-polymer/tree/master/src/state-summary">/state-summary/</a>.</li>
|
||||
<li>Add <code>require('./state-card-camera')</code> to <a href="https://github.com/home-assistant/home-assistant-polymer/blob/master/src/state-summary/state-card-content.js">state-card-content.js</a>.</li>
|
||||
<li>Add <code><link rel="import" href="state-card-camera.html"></code> to <a href="https://github.com/home-assistant/home-assistant-polymer/blob/master/src/state-summary/state-card-content.html">state-card-content.html</a>.</li>
|
||||
</ol>
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/frontend_add_card.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a class='active' href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
217
developers/frontend_add_more_info/index.html
Normal file
217
developers/frontend_add_more_info/index.html
Normal file
|
@ -0,0 +1,217 @@
|
|||
<!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>Adding more info dialogs - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Adding a more info dialog to the frontend">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/frontend_add_more_info/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Adding more info dialogs">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/frontend_add_more_info/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Adding a more info dialog to the frontend">
|
||||
<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="Adding more info dialogs">
|
||||
<meta name="twitter:description" content="Adding a more info dialog to the frontend">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Adding More Info Dialogs
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>Whenever the user taps or clicks on one of the cards, a more info dialog will show. The header of this dialog will be the state card, followed by the history of this entity for the last 24 hours. Below this the more info component is rendered for that entity. The more info component can show more information or allow more ways of control.</p>
|
||||
|
||||
<p class="img" style="max-width: 400px; margin-left: auto; margin-right: auto;">
|
||||
<img src="/images/frontend/frontend-more-info-light.png" />
|
||||
The more info dialog for a light allows the user to control the color and the brightness.
|
||||
</p>
|
||||
|
||||
<p>The instructions to add a more info dialog are very similar to adding a new card type. This example will add a new more info component for the domain <code>camera</code>:</p>
|
||||
|
||||
<ol>
|
||||
<li>Add <code>'camera'</code> to the array <code>DOMAINS_WITH_MORE_INFO</code> in the file <a href="https://github.com/home-assistant/home-assistant-polymer/blob/master/src/util/state-more-info-type.js#L1">util/state-more-info-type.js</a>.</li>
|
||||
<li>Create the files <code>more-info-camera.html</code> and <code>more-info-camera.js</code> in the folder <a href="https://github.com/home-assistant/home-assistant-polymer/tree/master/src/more-infos">/more-infos</a>.</li>
|
||||
<li>Add <code>require('./more-info-camera')</code> to <a href="https://github.com/home-assistant/home-assistant-polymer/blob/master/src/more-infos/more-info-content.js">more-info-content.js</a></li>
|
||||
<li>Add <code><link rel="import" href="more-info-camera.html"></code> to <a href="https://github.com/home-assistant/home-assistant-polymer/blob/master/src/more-infos/more-info-content.html">more-info-content.html</a></li>
|
||||
</ol>
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/frontend_add_more_info.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a class='active' href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
211
developers/helpers/index.html
Normal file
211
developers/helpers/index.html
Normal file
|
@ -0,0 +1,211 @@
|
|||
<!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>Little online helpers - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="The little helpers for the development of Home Assistant.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/helpers/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Little online helpers">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/helpers/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="The little helpers for the development of 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="Little online helpers">
|
||||
<meta name="twitter:description" content="The little helpers for the development of 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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Little Online Helpers
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>There are a bunch of online services which can help you if you are developing for Home Assistant or maintaining platforms/components. Some are directly connected to Pull Requests and the repositories itself, others are only publishing details and updates in our <a href="https://gitter.im/home-assistant/home-assistant/devs">gitter.im</a> chatroom.</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="https://coveralls.io/github/home-assistant/home-assistant">Coveralls</a></li>
|
||||
<li><a href="https://travis-ci.org/home-assistant/home-assistant">Travis CI</a></li>
|
||||
<li><a href="https://gemnasium.com/github.com/home-assistant/home-assistant">gemnasium</a></li>
|
||||
<li><a href="https://www.pivotaltracker.com/n/projects/1250084">Pivotal Tracker</a></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.io/tree/master/source/developers/helpers.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class='active' href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
208
developers/index.html
Normal file
208
developers/index.html
Normal file
|
@ -0,0 +1,208 @@
|
|||
<!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>Developers - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Everything you need to know to get started with Home Assistant development.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Developers">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Everything you need to know to get started with Home Assistant development.">
|
||||
<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="Developers">
|
||||
<meta name="twitter:description" content="Everything you need to know to get started with Home Assistant development.">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Developers
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>Welcome to the Home Assistant development documentation. This is the place to learn all about how Home Assistant works and how you can extend it with support for your devices and services!</p>
|
||||
|
||||
<p class="img">
|
||||
<img src="/images/architecture/component_interaction.png" alt="Diagram showing interaction between components and the Home Assistant core." />
|
||||
Diagram showing interaction between components and the Home Assistant core.
|
||||
</p>
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/index.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a class='active' href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
236
developers/multiple_instances/index.html
Normal file
236
developers/multiple_instances/index.html
Normal file
|
@ -0,0 +1,236 @@
|
|||
<!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>Multiple Instances - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Quick primer on how multiple instances work together.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/multiple_instances/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Multiple Instances">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/multiple_instances/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Quick primer on how multiple instances work together.">
|
||||
<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="Multiple Instances">
|
||||
<meta name="twitter:description" content="Quick primer on how multiple instances work together.">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Multiple Instances
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>Home Assistant supports running multiple synchronized instances using a master-slave model. Whenever <code>events.fire</code> or <code>states.set</code> is called on the salve it will forward it to the master. The master will replicate all events and changed states to its slaves.</p>
|
||||
|
||||
<p class="img">
|
||||
<a href="/images/architecture/architecture-remote.png">
|
||||
<img src="/images/architecture/architecture-remote.png" />
|
||||
</a>
|
||||
Overview of the Home Assistant architecture for multiple devices.
|
||||
</p>
|
||||
|
||||
<p>A slave instance can be started with the following code and has the same support for components as a master instance.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="keyword">import</span> <span class="include">homeassistant.remote</span> <span class="keyword">as</span> remote
|
||||
<span class="keyword">import</span> <span class="include">homeassistant.bootstrap</span> <span class="keyword">as</span> bootstrap
|
||||
|
||||
<span class="comment"># Location of the Master API: host, password, port.</span>
|
||||
<span class="comment"># Password and port are optional.</span>
|
||||
remote_api = remote.API(<span class="string"><span class="delimiter">"</span><span class="content">127.0.0.1</span><span class="delimiter">"</span></span>, <span class="string"><span class="delimiter">"</span><span class="content">password</span><span class="delimiter">"</span></span>, <span class="integer">8124</span>)
|
||||
|
||||
<span class="comment"># Initialize slave</span>
|
||||
hass = remote.HomeAssistant(remote_api)
|
||||
|
||||
<span class="comment"># To add an interface to the slave on localhost:8123</span>
|
||||
bootstrap.setup_component(hass, <span class="string"><span class="delimiter">'</span><span class="content">frontend</span><span class="delimiter">'</span></span>)
|
||||
|
||||
hass.start()
|
||||
hass.block_till_stopped()
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="note">
|
||||
Because each slave maintains its own Service Registry it is possible to have multiple slaves respond to one service call.
|
||||
</p>
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/multiple_instances.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a class='active' href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
306
developers/platform_example_light/index.html
Normal file
306
developers/platform_example_light/index.html
Normal file
|
@ -0,0 +1,306 @@
|
|||
<!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>Example light platform - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Minimum implementation of a Home Assistant platform.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/platform_example_light/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Example light platform">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/platform_example_light/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Minimum implementation of a Home Assistant platform.">
|
||||
<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="Example light platform">
|
||||
<meta name="twitter:description" content="Minimum implementation of a Home Assistant platform.">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Example Light Platform
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>This example is for adding support for the imaginary Awesome Lights. It shows the different best practices for developing a platform.</p>
|
||||
|
||||
<p>Similar to Example Sensor Platform, Copy the code below and create it as a file in <code><config_dir>/custom_components/light/awesomelights.py</code>.</p>
|
||||
|
||||
<p>Add the following to your configuration.yaml:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="key">light</span>:
|
||||
- <span class="string"><span class="content">platform: awesomelights</span></span>
|
||||
<span class="key">host</span>: <span class="string"><span class="content">HOST_HERE</span></span>
|
||||
<span class="key">username</span>: <span class="string"><span class="content">USERNAME_HERE</span></span>
|
||||
<span class="key">password</span>: <span class="string"><span class="content">PASSWORD_HERE_OR_secrets.yaml</span></span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Note the <code>platform</code> name matches the filename for the source code.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="keyword">import</span> <span class="include">logging</span>
|
||||
|
||||
<span class="comment"># Import the device class from the component that you want to support</span>
|
||||
<span class="keyword">from</span> <span class="include">homeassistant.components.light</span> <span class="keyword">import</span> <span class="include">ATTR_BRIGHTNESS</span>, <span class="include">Light</span>
|
||||
<span class="keyword">from</span> <span class="include">homeassistant.const</span> <span class="keyword">import</span> <span class="include">CONF_HOST</span>, <span class="include">CONF_USERNAME</span>, <span class="include">CONF_PASSWORD</span>
|
||||
|
||||
<span class="comment"># Home Assistant depends on 3rd party packages for API specific code.</span>
|
||||
REQUIREMENTS = [<span class="string"><span class="delimiter">'</span><span class="content">awesome_lights==1.2.3</span><span class="delimiter">'</span></span>]
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
<span class="keyword">def</span> <span class="function">setup_platform</span>(hass, config, add_devices, discovery_info=<span class="predefined-constant">None</span>):
|
||||
<span class="docstring"><span class="delimiter">"""</span><span class="content">Initialize Awesome Light platform.</span><span class="delimiter">"""</span></span>
|
||||
<span class="keyword">import</span> <span class="include">awesomelights</span>
|
||||
|
||||
<span class="comment"># Validate passed in config</span>
|
||||
host = config.get(CONF_HOST)
|
||||
username = config.get(CONF_USERNAME)
|
||||
password = config.get(CONF_PASSWORD)
|
||||
|
||||
<span class="keyword">if</span> host <span class="keyword">is</span> <span class="predefined-constant">None</span> <span class="keyword">or</span> username <span class="keyword">is</span> <span class="predefined-constant">None</span> <span class="keyword">or</span> password <span class="keyword">is</span> <span class="predefined-constant">None</span>:
|
||||
_LOGGER.error(<span class="string"><span class="delimiter">'</span><span class="content">Invalid config. Expected %s, %s and %s</span><span class="delimiter">'</span></span>,
|
||||
CONF_HOST, CONF_USERNAME, CONF_PASSWORD)
|
||||
<span class="keyword">return</span> <span class="predefined-constant">False</span>
|
||||
|
||||
<span class="comment"># Setup connection with devices/cloud</span>
|
||||
hub = awesomelights.Hub(host, username, password)
|
||||
|
||||
<span class="comment"># Verify that passed in config works</span>
|
||||
<span class="keyword">if</span> <span class="keyword">not</span> hub.is_valid_login():
|
||||
_LOGGER.error(<span class="string"><span class="delimiter">'</span><span class="content">Could not connect to AwesomeLight hub</span><span class="delimiter">'</span></span>)
|
||||
<span class="keyword">return</span> <span class="predefined-constant">False</span>
|
||||
|
||||
<span class="comment"># Add devices</span>
|
||||
add_devices(AwesomeLight(light) <span class="keyword">for</span> light <span class="keyword">in</span> hub.lights())
|
||||
|
||||
<span class="keyword">class</span> <span class="class">AwesomeLight</span>(Light):
|
||||
<span class="docstring"><span class="delimiter">"""</span><span class="content">Represents an AwesomeLight in Home Assistant.</span><span class="delimiter">"""</span></span>
|
||||
|
||||
<span class="keyword">def</span> <span class="function">__init__</span>(<span class="predefined-constant">self</span>, light):
|
||||
<span class="docstring"><span class="delimiter">"""</span><span class="content">Initialize an AwesomeLight.</span><span class="delimiter">"""</span></span>
|
||||
<span class="predefined-constant">self</span>._light = light
|
||||
|
||||
<span class="decorator">@property</span>
|
||||
<span class="keyword">def</span> <span class="function">name</span>(<span class="predefined-constant">self</span>):
|
||||
<span class="docstring"><span class="delimiter">"""</span><span class="content">Return the display name of this light</span><span class="delimiter">"""</span></span>
|
||||
<span class="keyword">return</span> <span class="predefined-constant">self</span>._light.name
|
||||
|
||||
<span class="decorator">@property</span>
|
||||
<span class="keyword">def</span> <span class="function">brightness</span>(<span class="predefined-constant">self</span>):
|
||||
<span class="docstring"><span class="delimiter">"""</span><span class="content">Brightness of the light (an integer in the range 1-255).</span><span class="content">
|
||||
</span><span class="content">
|
||||
</span><span class="content"> This method is optional. Removing it indicates to Home Assistant</span><span class="content">
|
||||
</span><span class="content"> that brightness is not supported for this light.</span><span class="content">
|
||||
</span><span class="content"> </span><span class="delimiter">"""</span></span>
|
||||
<span class="keyword">return</span> <span class="predefined-constant">self</span>._light.brightness
|
||||
|
||||
<span class="decorator">@property</span>
|
||||
<span class="keyword">def</span> <span class="function">is_on</span>(<span class="predefined-constant">self</span>):
|
||||
<span class="docstring"><span class="delimiter">"""</span><span class="content">If light is on.</span><span class="delimiter">"""</span></span>
|
||||
<span class="keyword">return</span> <span class="predefined-constant">self</span>._light.is_on()
|
||||
|
||||
<span class="keyword">def</span> <span class="function">turn_on</span>(<span class="predefined-constant">self</span>, **kwargs):
|
||||
<span class="docstring"><span class="delimiter">"""</span><span class="content">Instruct the light to turn on.</span><span class="content">
|
||||
</span><span class="content">
|
||||
</span><span class="content"> You can skip the brightness part if your light does not support</span><span class="content">
|
||||
</span><span class="content"> brightness control.</span><span class="content">
|
||||
</span><span class="content"> </span><span class="delimiter">"""</span></span>
|
||||
<span class="predefined-constant">self</span>._light.brightness = kwargs.get(ATTR_BRIGHTNESS, <span class="integer">255</span>)
|
||||
<span class="predefined-constant">self</span>._light.turn_on()
|
||||
|
||||
<span class="keyword">def</span> <span class="function">turn_off</span>(<span class="predefined-constant">self</span>, **kwargs):
|
||||
<span class="docstring"><span class="delimiter">"""</span><span class="content">Instruct the light to turn off.</span><span class="delimiter">"""</span></span>
|
||||
<span class="predefined-constant">self</span>._light.turn_off()
|
||||
|
||||
<span class="keyword">def</span> <span class="function">update</span>(<span class="predefined-constant">self</span>):
|
||||
<span class="docstring"><span class="delimiter">"""</span><span class="content">Fetch new state data for this light.</span><span class="content">
|
||||
</span><span class="content">
|
||||
</span><span class="content"> This is the only method that should fetch new data for Home Assitant.</span><span class="content">
|
||||
</span><span class="content"> </span><span class="delimiter">"""</span></span>
|
||||
<span class="predefined-constant">self</span>._light.update()
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/platform_example_light.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a class='active' href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
244
developers/platform_example_sensor/index.html
Normal file
244
developers/platform_example_sensor/index.html
Normal file
|
@ -0,0 +1,244 @@
|
|||
<!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>Example sensor platform - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Minimum implementation of a Home Assistant platform.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/platform_example_sensor/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Example sensor platform">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/platform_example_sensor/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Minimum implementation of a Home Assistant platform.">
|
||||
<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="Example sensor platform">
|
||||
<meta name="twitter:description" content="Minimum implementation of a Home Assistant platform.">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Example Sensor Platform
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>This is a minimum implementation of a platform for the sensor component.</p>
|
||||
|
||||
<h3><a class="title-link" name="installation" href="#installation"></a> Installation</h3>
|
||||
|
||||
<p>Copy the code below and create it as a file in <code><config_dir>/custom_components/sensor/example.py</code>.</p>
|
||||
|
||||
<p>Add the following to your configuration.yaml:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="comment"># Example configuration.yaml entry</span>
|
||||
<span class="key">sensor</span>:
|
||||
<span class="key">platform</span>: <span class="string"><span class="content">example</span></span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3><a class="title-link" name="code" href="#code"></a> Code</h3>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="keyword">from</span> <span class="include">homeassistant.const</span> <span class="keyword">import</span> <span class="include">TEMP_CELSIUS</span>
|
||||
<span class="keyword">from</span> <span class="include">homeassistant.helpers.entity</span> <span class="keyword">import</span> <span class="include">Entity</span>
|
||||
|
||||
|
||||
<span class="keyword">def</span> <span class="function">setup_platform</span>(hass, config, add_devices, discovery_info=<span class="predefined-constant">None</span>):
|
||||
add_devices([ExampleSensor()])
|
||||
|
||||
|
||||
<span class="keyword">class</span> <span class="class">ExampleSensor</span>(Entity):
|
||||
<span class="decorator">@property</span>
|
||||
<span class="keyword">def</span> <span class="function">name</span>(<span class="predefined-constant">self</span>):
|
||||
<span class="keyword">return</span> <span class="string"><span class="delimiter">'</span><span class="content">Example Temperature</span><span class="delimiter">'</span></span>
|
||||
|
||||
<span class="decorator">@property</span>
|
||||
<span class="keyword">def</span> <span class="function">state</span>(<span class="predefined-constant">self</span>):
|
||||
<span class="keyword">return</span> <span class="integer">23</span>
|
||||
|
||||
<span class="decorator">@property</span>
|
||||
<span class="keyword">def</span> <span class="function">unit_of_measurement</span>(<span class="predefined-constant">self</span>):
|
||||
<span class="keyword">return</span> TEMP_CELSIUS
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/platform_example_sensor.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a class='active' href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
369
developers/python_api/index.html
Normal file
369
developers/python_api/index.html
Normal file
|
@ -0,0 +1,369 @@
|
|||
<!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>Python API - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Home Assistant Python API documentation">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/python_api/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Python API">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/python_api/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Home Assistant Python API documentation">
|
||||
<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="Python API">
|
||||
<meta name="twitter:description" content="Home Assistant Python API documentation">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Python API
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>In the package <a href="https://github.com/home-assistant/home-assistant/blob/master/homeassistant/remote.py"><code>homeassistant.remote</code></a> a Python API on top of the <a href="/developers/api/">HTTP API</a> can be found.</p>
|
||||
|
||||
<p>This page is not a full documentation it’s more a collection of some example. A simple way to get all current entities is to visit the “Set State” page in the “Developer Tools”. For the examples below just choose one from the available entries. Here the sensor <code>sensor.office_temperature</code> and the switch <code>switch.livingroom_pin_2</code> are used.</p>
|
||||
|
||||
<p>First import the module and setup the basics.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="keyword">import</span> <span class="include">homeassistant.remote</span> <span class="keyword">as</span> remote
|
||||
|
||||
api = remote.API(<span class="string"><span class="delimiter">'</span><span class="content">127.1.0.1</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">'</span><span class="content">password</span><span class="delimiter">'</span></span>)
|
||||
print(remote.validate_api(api))
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>This snippets shows how to use the <code>homeassistant.remote</code> package in another way.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="keyword">import</span> <span class="include">homeassistant.remote</span> <span class="keyword">as</span> remote
|
||||
|
||||
api = remote.API(<span class="string"><span class="delimiter">'</span><span class="content">127.1.0.1</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">'</span><span class="content">password</span><span class="delimiter">'</span></span>)
|
||||
hass = remote.HomeAssistant(api)
|
||||
hass.start()
|
||||
living_room = hass.states.get(<span class="string"><span class="delimiter">'</span><span class="content">group.living_room</span><span class="delimiter">'</span></span>)
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3><a class="title-link" name="get-details-about-services-events-and-entitites" href="#get-details-about-services-events-and-entitites"></a> Get details about services, events, and entitites</h3>
|
||||
|
||||
<p>Similar to the output in the “Developer Tools” of the frontend.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="keyword">import</span> <span class="include">homeassistant.remote</span> <span class="keyword">as</span> remote
|
||||
|
||||
api = remote.API(<span class="string"><span class="delimiter">'</span><span class="content">127.1.0.1</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">'</span><span class="content">password</span><span class="delimiter">'</span></span>)
|
||||
|
||||
print(<span class="string"><span class="delimiter">'</span><span class="content">-- Available services:</span><span class="delimiter">'</span></span>)
|
||||
services = remote.get_services(api)
|
||||
<span class="keyword">for</span> service <span class="keyword">in</span> services:
|
||||
print(service[<span class="string"><span class="delimiter">'</span><span class="content">services</span><span class="delimiter">'</span></span>])
|
||||
|
||||
print(<span class="string"><span class="delimiter">'</span><span class="char">\n</span><span class="content">-- Available event</span><span class="delimiter">'</span></span>)
|
||||
events = remote.get_event_listeners(api)
|
||||
<span class="keyword">for</span> event <span class="keyword">in</span> events:
|
||||
print(event)
|
||||
|
||||
print(<span class="string"><span class="delimiter">'</span><span class="char">\n</span><span class="content">-- Available entities</span><span class="delimiter">'</span></span>)
|
||||
entities = remote.get_states(api)
|
||||
<span class="keyword">for</span> entity <span class="keyword">in</span> entities:
|
||||
print(entity)
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3><a class="title-link" name="get-the-state-of-an-entity" href="#get-the-state-of-an-entity"></a> Get the state of an entity</h3>
|
||||
|
||||
<p>To get the details of a single entity the <code>get_state</code> method is used.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="keyword">import</span> <span class="include">homeassistant.remote</span> <span class="keyword">as</span> remote
|
||||
|
||||
api = remote.API(<span class="string"><span class="delimiter">'</span><span class="content">127.1.0.1</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">'</span><span class="content">password</span><span class="delimiter">'</span></span>)
|
||||
office_temperature = remote.get_state(api, <span class="string"><span class="delimiter">'</span><span class="content">sensor.office_temperature</span><span class="delimiter">'</span></span>)
|
||||
print(<span class="string"><span class="delimiter">'</span><span class="content">{} is {} {}.</span><span class="delimiter">'</span></span>.format(office_temperature.attributes[<span class="string"><span class="delimiter">'</span><span class="content">friendly_name</span><span class="delimiter">'</span></span>],
|
||||
office_temperature.state,
|
||||
office_temperature.attributes[<span class="string"><span class="delimiter">'</span><span class="content">unit_of_measurement</span><span class="delimiter">'</span></span>]
|
||||
)
|
||||
)
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>The output is composed out of the details which are stored for this entity.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>Office Temperature is 19 °C.
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>The exact same thing is working for a switch. The difference is that both entities have different attributes.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="keyword">import</span> <span class="include">homeassistant.remote</span> <span class="keyword">as</span> remote
|
||||
|
||||
api = remote.API(<span class="string"><span class="delimiter">'</span><span class="content">127.1.0.1</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">'</span><span class="content">password</span><span class="delimiter">'</span></span>)
|
||||
switch_livingroom = remote.get_state(api, <span class="string"><span class="delimiter">'</span><span class="content">switch.livingroom_pin_2</span><span class="delimiter">'</span></span>)
|
||||
print(<span class="string"><span class="delimiter">'</span><span class="content">{} is {}.</span><span class="delimiter">'</span></span>.format(switch_livingroom.attributes[<span class="string"><span class="delimiter">'</span><span class="content">friendly_name</span><span class="delimiter">'</span></span>],
|
||||
switch_livingroom.state
|
||||
)
|
||||
)
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3><a class="title-link" name="set-the-state-of-an-entity" href="#set-the-state-of-an-entity"></a> Set the state of an entity</h3>
|
||||
|
||||
<p>Of course, it’s possible to set the state.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="keyword">import</span> <span class="include">homeassistant.remote</span> <span class="keyword">as</span> remote
|
||||
<span class="keyword">from</span> <span class="include">homeassistant.const</span> <span class="keyword">import</span> <span class="include">STATE_ON</span>
|
||||
|
||||
api = remote.API(<span class="string"><span class="delimiter">'</span><span class="content">127.1.0.1</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">'</span><span class="content">password</span><span class="delimiter">'</span></span>)
|
||||
remote.set_state(api, <span class="string"><span class="delimiter">'</span><span class="content">sensor.office_temperature</span><span class="delimiter">'</span></span>, new_state=<span class="integer">123</span>)
|
||||
remote.set_state(api, <span class="string"><span class="delimiter">'</span><span class="content">switch.livingroom_pin_2</span><span class="delimiter">'</span></span>, new_state=STATE_ON)
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>The state will be set to those value until the next update occurs.</p>
|
||||
|
||||
<h3><a class="title-link" name="blinking-all-entites-of-a-domain" href="#blinking-all-entites-of-a-domain"></a> Blinking all entites of a domain</h3>
|
||||
|
||||
<p>If you want to turn on all entities of a domain, just a service which was retrieved by <code>get_services</code>.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="keyword">import</span> <span class="include">time</span>
|
||||
<span class="keyword">import</span> <span class="include">homeassistant.remote</span> <span class="keyword">as</span> remote
|
||||
|
||||
api = remote.API(<span class="string"><span class="delimiter">'</span><span class="content">127.1.0.1</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">'</span><span class="content">password</span><span class="delimiter">'</span></span>)
|
||||
domain = <span class="string"><span class="delimiter">'</span><span class="content">switch</span><span class="delimiter">'</span></span>
|
||||
|
||||
remote.call_service(api, domain, <span class="string"><span class="delimiter">'</span><span class="content">turn_on</span><span class="delimiter">'</span></span>)
|
||||
time.sleep(<span class="integer">10</span>)
|
||||
remote.call_service(api, domain, <span class="string"><span class="delimiter">'</span><span class="content">turn_off</span><span class="delimiter">'</span></span>)
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3><a class="title-link" name="control-a-single-entity" href="#control-a-single-entity"></a> Control a single entity</h3>
|
||||
|
||||
<p>To turn on or off a single switch. The ID of the entity is needed as attribute.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="keyword">import</span> <span class="include">time</span>
|
||||
<span class="keyword">import</span> <span class="include">homeassistant.remote</span> <span class="keyword">as</span> remote
|
||||
|
||||
api = remote.API(<span class="string"><span class="delimiter">'</span><span class="content">127.1.0.1</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">'</span><span class="content">password</span><span class="delimiter">'</span></span>)
|
||||
domain = <span class="string"><span class="delimiter">'</span><span class="content">switch</span><span class="delimiter">'</span></span>
|
||||
switch_name = <span class="string"><span class="delimiter">'</span><span class="content">switch.livingroom_pin_2</span><span class="delimiter">'</span></span>
|
||||
|
||||
remote.call_service(api, domain, <span class="string"><span class="delimiter">'</span><span class="content">turn_on</span><span class="delimiter">'</span></span>, {<span class="string"><span class="delimiter">'</span><span class="content">entity_id</span><span class="delimiter">'</span></span>: <span class="string"><span class="delimiter">'</span><span class="content">{}</span><span class="delimiter">'</span></span>.format(switch_name)})
|
||||
time.sleep(<span class="integer">5</span>)
|
||||
remote.call_service(api, domain, <span class="string"><span class="delimiter">'</span><span class="content">turn_off</span><span class="delimiter">'</span></span>, {<span class="string"><span class="delimiter">'</span><span class="content">entity_id</span><span class="delimiter">'</span></span>: <span class="string"><span class="delimiter">'</span><span class="content">{}</span><span class="delimiter">'</span></span>.format(switch_name)})
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3><a class="title-link" name="send-a-notification" href="#send-a-notification"></a> Send a notification</h3>
|
||||
|
||||
<p>The example uses the jabber notification platform to send a single message to the given recipient in the <code>configuration.yaml</code> file.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="keyword">import</span> <span class="include">homeassistant.remote</span> <span class="keyword">as</span> remote
|
||||
|
||||
api = remote.API(<span class="string"><span class="delimiter">'</span><span class="content">127.1.0.1</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">'</span><span class="content">password</span><span class="delimiter">'</span></span>)
|
||||
domain = <span class="string"><span class="delimiter">'</span><span class="content">notify</span><span class="delimiter">'</span></span>
|
||||
data = {<span class="string"><span class="delimiter">"</span><span class="content">title</span><span class="delimiter">"</span></span>:<span class="string"><span class="delimiter">"</span><span class="content">Test</span><span class="delimiter">"</span></span>, <span class="string"><span class="delimiter">"</span><span class="content">message</span><span class="delimiter">"</span></span>:<span class="string"><span class="delimiter">"</span><span class="content">A simple test message from HA.</span><span class="delimiter">"</span></span>}
|
||||
|
||||
remote.call_service(api, domain, <span class="string"><span class="delimiter">'</span><span class="content">jabber</span><span class="delimiter">'</span></span>, data)
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>For more details please check the source of <a href="https://github.com/home-assistant/home-assistant/blob/master/homeassistant/remote.py">homeassistant.remote</a>.</p>
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/python_api.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a class='active' href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
237
developers/releasing/index.html
Normal file
237
developers/releasing/index.html
Normal file
|
@ -0,0 +1,237 @@
|
|||
<!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>Releasing - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Steps involved to publish a new Home Assistant release.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/releasing/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Releasing">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/releasing/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Steps involved to publish a new Home Assistant release.">
|
||||
<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="Releasing">
|
||||
<meta name="twitter:description" content="Steps involved to publish a new Home Assistant release.">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Releasing
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>This page describes the steps for publishing a new Home Assistant release.</p>
|
||||
|
||||
<h3><a class="title-link" name="github" href="#github"></a> GitHub</h3>
|
||||
|
||||
<ol>
|
||||
<li>Create a pull request from <code>dev</code> to <code>master</code> with the upcoming release number as title.</li>
|
||||
<li>Merge <code>master</code> into <code>dev</code> to make the PR mergable. PR message contains intro, highlighting major changes, and an overview of all changes tagging each author.</li>
|
||||
<li>Update <code>homeassistant/const.py</code> with the correct version number (remove the the <code>dev</code> tag) and push that commit.</li>
|
||||
<li>Merge pull request.</li>
|
||||
<li>Then, after merged, push another update to <code>dev</code> of <code>homeassistant/const.py</code> that includes the next version with the <code>dev</code> tag. Add a meaningful commit message like “Version bump to X”. This commit acts as marker for the next release.</li>
|
||||
<li>Go to <a href="https://github.com/home-assistant/home-assistant/releases">releases</a> and tag a new release on the <code>master</code> branch. “Tag version” and “Release title” are the version number (<code>O.x</code> for major version, <code>0.x.y</code> for minor and bug fix releases). Release description is the text from PR. Press “Publish release” to finish the process.</li>
|
||||
</ol>
|
||||
|
||||
<h3><a class="title-link" name="website" href="#website"></a> Website</h3>
|
||||
|
||||
<ol>
|
||||
<li>Create a blog post in <code>next</code> and base it on the text of the PR in the main repository. Add images, additional text, links, etc. if it adds value. Tag each platform/component in message to documentation.</li>
|
||||
<li>Create missing documentation as stumbs in <code>next</code>.</li>
|
||||
<li>Update the link on the frontpage (<code>source/index.html</code>) to link to the new release blog post and version number.</li>
|
||||
<li>Create a pull request from <code>next</code> to <code>master</code> with the upcoming release number as title.</li>
|
||||
<li>Merge <code>master</code> into <code>next</code> (<code>$ git checkout next && git merge master</code>) to make the PR mergable.</li>
|
||||
<li>Merge pull request (blog post, updated frontpage, and all new documentation) to <code>master</code>.</li>
|
||||
</ol>
|
||||
|
||||
<h3><a class="title-link" name="python-package-index" href="#python-package-index"></a> Python Package Index</h3>
|
||||
|
||||
<p>Checkout the <code>master</code> branch and run <code>script/release</code> to publish the new release on <a href="https://pypi.python.org">Python Package Index</a>.</p>
|
||||
|
||||
<h3><a class="title-link" name="social-media" href="#social-media"></a> Social media</h3>
|
||||
|
||||
<ol>
|
||||
<li>Create a <a href="https://twitter.com/home_assistant">tweet</a> announcing blog post linking to release notes.</li>
|
||||
<li>Publish a link to the tweet/release blog post for the <a href="https://plus.google.com/b/110560654828510104551/communities/106562234893511202708">Google+ Community</a>.</li>
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/releasing.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
762
developers/rest_api/index.html
Normal file
762
developers/rest_api/index.html
Normal file
|
@ -0,0 +1,762 @@
|
|||
<!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>RESTful API - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Home Assistant RESTful API documentation">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/rest_api/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="RESTful API">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/rest_api/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Home Assistant RESTful API documentation">
|
||||
<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="RESTful API">
|
||||
<meta name="twitter:description" content="Home Assistant RESTful API documentation">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
RESTful API
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>Home Assistant runs a web server accessible on port 8123.</p>
|
||||
|
||||
<ul>
|
||||
<li>http://IP_ADDRESS:8123/ is an interface to control Home Assistant.</li>
|
||||
<li>http://IP_ADDRESS:8123/api/ is a Rest API.</li>
|
||||
</ul>
|
||||
|
||||
<p>The API accepts and returns only JSON encoded objects. All API calls have to be accompanied by the header <code>X-HA-Access: YOUR_PASSWORD</code> (YOUR_PASSWORD as specified in your <code>configuration.yaml</code> file in the <a href="/components/http/"><code>http:</code> section</a>).</p>
|
||||
|
||||
<p>There are multiple ways to consume the Home Assistant Rest API. One is with <code>curl</code>:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>curl -X GET \
|
||||
-H "x-ha-access: YOUR_PASSWORD" \
|
||||
-H "Content-Type: application/json" \
|
||||
http://IP_ADDRESS:8123/ENDPOINT
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Another option is to use Python and the <a href="http://docs.python-requests.org/en/latest/">Requests</a> module.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="keyword">from</span> <span class="include">requests</span> <span class="keyword">import</span> <span class="include">get</span>
|
||||
|
||||
url = <span class="string"><span class="delimiter">'</span><span class="content">http://localhost:8123/ENDPOINT</span><span class="delimiter">'</span></span>
|
||||
headers = {<span class="string"><span class="delimiter">'</span><span class="content">x-ha-access</span><span class="delimiter">'</span></span>: <span class="string"><span class="delimiter">'</span><span class="content">YOUR_PASSWORD</span><span class="delimiter">'</span></span>,
|
||||
<span class="string"><span class="delimiter">'</span><span class="content">content-type</span><span class="delimiter">'</span></span>: <span class="string"><span class="delimiter">'</span><span class="content">application/json</span><span class="delimiter">'</span></span>}
|
||||
|
||||
response = get(url, headers=headers)
|
||||
print(response.text)
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="note">
|
||||
You can append <code>?api_password=YOUR_PASSWORD</code> to any url to log in automatically.
|
||||
</p>
|
||||
|
||||
<p>Successful calls will return status code 200 or 201. Other status codes that can return are:</p>
|
||||
|
||||
<ul>
|
||||
<li>400 (Bad Request)</li>
|
||||
<li>401 (Unauthorized)</li>
|
||||
<li>404 (Not Found)</li>
|
||||
<li>405 (Method not allowed)</li>
|
||||
</ul>
|
||||
|
||||
<h3><a class="title-link" name="actions" href="#actions"></a> Actions</h3>
|
||||
|
||||
<p>The API supports the following actions:</p>
|
||||
|
||||
<h4><a class="title-link" name="get-api" href="#get-api"></a> GET /api/</h4>
|
||||
<p>Returns message if API is up and running.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">message</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">API running.</span><span class="delimiter">"</span></span>
|
||||
}
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Sample <code>curl</code> command:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ curl -X GET -H "x-ha-access: YOUR_PASSWORD" \
|
||||
-H "Content-Type: application/json" http://localhost:8123/api/
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4><a class="title-link" name="get-apiconfig" href="#get-apiconfig"></a> GET /api/config</h4>
|
||||
<p>Returns the current configuration as JSON.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">components</span><span class="delimiter">"</span></span>: [
|
||||
<span class="string"><span class="delimiter">"</span><span class="content">recorder</span><span class="delimiter">"</span></span>,
|
||||
<span class="string"><span class="delimiter">"</span><span class="content">http</span><span class="delimiter">"</span></span>,
|
||||
<span class="string"><span class="delimiter">"</span><span class="content">sensor.time_date</span><span class="delimiter">"</span></span>,
|
||||
<span class="string"><span class="delimiter">"</span><span class="content">api</span><span class="delimiter">"</span></span>,
|
||||
<span class="string"><span class="delimiter">"</span><span class="content">frontend</span><span class="delimiter">"</span></span>,
|
||||
<span class="string"><span class="delimiter">"</span><span class="content">sun</span><span class="delimiter">"</span></span>,
|
||||
<span class="string"><span class="delimiter">"</span><span class="content">logbook</span><span class="delimiter">"</span></span>,
|
||||
<span class="string"><span class="delimiter">"</span><span class="content">history</span><span class="delimiter">"</span></span>,
|
||||
<span class="string"><span class="delimiter">"</span><span class="content">group</span><span class="delimiter">"</span></span>,
|
||||
<span class="string"><span class="delimiter">"</span><span class="content">automation</span><span class="delimiter">"</span></span>
|
||||
],
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">latitude</span><span class="delimiter">"</span></span>: <span class="float">44.1234</span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">location_name</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">Home</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">longitude</span><span class="delimiter">"</span></span>: <span class="float">5.5678</span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">temperature_unit</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="char">\u00b0</span><span class="content">C</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">time_zone</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">Europe/Zurich</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">version</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">0.8.0.dev0</span><span class="delimiter">"</span></span>
|
||||
}
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Sample <code>curl</code> command:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ curl -X GET -H "x-ha-access: YOUR_PASSWORD" \
|
||||
-H "Content-Type: application/json" http://localhost:8123/api/config
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4><a class="title-link" name="get-apidiscovery_info" href="#get-apidiscovery_info"></a> GET /api/discovery_info</h4>
|
||||
<p>Returns basic information about the Home Assistant instance as JSON.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">base_url</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">http://127.0.0.1:8123</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">location_name</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">Home</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">requires_api_password</span><span class="delimiter">"</span></span>: <span class="value">true</span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">version</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">0.20.0.dev0</span><span class="delimiter">"</span></span>
|
||||
}
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Sample <code>curl</code> command:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ curl -X GET -H "x-ha-access: YOUR_PASSWORD" \
|
||||
-H "Content-Type: application/json" http://localhost:8123/api/discovery_info
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4><a class="title-link" name="get-apibootstrap" href="#get-apibootstrap"></a> GET /api/bootstrap</h4>
|
||||
<p>Returns all data needed to bootstrap Home Assistant.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">config</span><span class="delimiter">"</span></span>: {<span class="error">.</span><span class="error">.</span><span class="error">.</span>},
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">events</span><span class="delimiter">"</span></span>: [<span class="error">.</span><span class="error">.</span><span class="error">.</span>],
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">services</span><span class="delimiter">"</span></span>: [<span class="error">.</span><span class="error">.</span><span class="error">.</span>],
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">states</span><span class="delimiter">"</span></span>: [<span class="error">.</span><span class="error">.</span><span class="error">.</span>]
|
||||
}
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Sample <code>curl</code> command:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ curl -X GET -H "x-ha-access: YOUR_PASSWORD" \
|
||||
-H "Content-Type: application/json" http://localhost:8123/api/bootstrap
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4><a class="title-link" name="get-apievents" href="#get-apievents"></a> GET /api/events</h4>
|
||||
<p>Returns an array of event objects. Each event object contain event name and listener count.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>[
|
||||
{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">event</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">state_changed</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">listener_count</span><span class="delimiter">"</span></span>: <span class="integer">5</span>
|
||||
},
|
||||
{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">event</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">time_changed</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">listener_count</span><span class="delimiter">"</span></span>: <span class="integer">2</span>
|
||||
}
|
||||
]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Sample <code>curl</code> command:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ curl -X GET -H "x-ha-access: YOUR_PASSWORD" \
|
||||
-H "Content-Type: application/json" http://localhost:8123/api/events
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4><a class="title-link" name="get-apiservices" href="#get-apiservices"></a> GET /api/services</h4>
|
||||
<p>Returns an array of service objects. Each object contains the domain and which services it contains.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>[
|
||||
{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">domain</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">browser</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">services</span><span class="delimiter">"</span></span>: [
|
||||
<span class="string"><span class="delimiter">"</span><span class="content">browse_url</span><span class="delimiter">"</span></span>
|
||||
]
|
||||
},
|
||||
{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">domain</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">keyboard</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">services</span><span class="delimiter">"</span></span>: [
|
||||
<span class="string"><span class="delimiter">"</span><span class="content">volume_up</span><span class="delimiter">"</span></span>,
|
||||
<span class="string"><span class="delimiter">"</span><span class="content">volume_down</span><span class="delimiter">"</span></span>
|
||||
]
|
||||
}
|
||||
]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Sample <code>curl</code> command:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ curl -X GET -H "x-ha-access: YOUR_PASSWORD" \
|
||||
-H "Content-Type: application/json" http://localhost:8123/api/services
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4><a class="title-link" name="get-apihistory" href="#get-apihistory"></a> GET /api/history</h4>
|
||||
<p>Returns an array of state changes in the past. Each object contains further detail for the entities.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>[
|
||||
[
|
||||
{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">attributes</span><span class="delimiter">"</span></span>: {
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">friendly_name</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">Weather Temperature</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">unit_of_measurement</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="char">\u00b0</span><span class="content">C</span><span class="delimiter">"</span></span>
|
||||
},
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">entity_id</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">sensor.weather_temperature</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">last_changed</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">2016-02-06T22:15:00+00:00</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">last_updated</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">2016-02-06T22:15:00+00:00</span><span class="delimiter">"</span></span><span class="string"><span class="delimiter">"</span><span class="content">,
|
||||
</span><span class="delimiter">"</span></span><span class="error">s</span><span class="error">t</span><span class="error">a</span><span class="error">t</span><span class="error">e</span><span class="string"><span class="delimiter">"</span><span class="content">: </span><span class="delimiter">"</span></span><span class="float">-3.9</span><span class="string"><span class="delimiter">"</span><span class="content">
|
||||
},
|
||||
{
|
||||
</span><span class="delimiter">"</span></span><span class="error">a</span><span class="error">t</span><span class="error">t</span><span class="error">r</span><span class="error">i</span><span class="error">b</span><span class="error">u</span><span class="error">t</span><span class="error">e</span><span class="error">s</span><span class="string"><span class="delimiter">"</span><span class="content">: {
|
||||
</span><span class="delimiter">"</span></span><span class="error">f</span><span class="error">r</span><span class="error">i</span><span class="error">e</span><span class="error">n</span><span class="error">d</span><span class="error">l</span><span class="error">y</span><span class="error">_</span><span class="error">n</span><span class="error">a</span><span class="error">m</span><span class="error">e</span><span class="string"><span class="delimiter">"</span><span class="content">: </span><span class="delimiter">"</span></span><span class="error">W</span><span class="error">e</span><span class="error">a</span><span class="error">t</span><span class="error">h</span><span class="error">e</span><span class="error">r</span> <span class="error">T</span><span class="error">e</span><span class="error">m</span><span class="error">p</span><span class="error">e</span><span class="error">r</span><span class="error">a</span><span class="error">t</span><span class="error">u</span><span class="error">r</span><span class="error">e</span><span class="string"><span class="delimiter">"</span><span class="content">,
|
||||
</span><span class="delimiter">"</span></span><span class="error">u</span><span class="error">n</span><span class="error">i</span><span class="error">t</span><span class="error">_</span><span class="error">o</span><span class="error">f</span><span class="error">_</span><span class="error">m</span><span class="error">e</span><span class="error">a</span><span class="error">s</span><span class="error">u</span><span class="error">r</span><span class="error">e</span><span class="error">m</span><span class="error">e</span><span class="error">n</span><span class="error">t</span><span class="string"><span class="delimiter">"</span><span class="content">: </span><span class="delimiter">"</span></span><span class="error">\</span><span class="error">u</span><span class="integer">0</span><span class="integer">0</span><span class="error">b</span><span class="integer">0</span><span class="error">C</span><span class="string"><span class="delimiter">"</span><span class="content">
|
||||
},
|
||||
</span><span class="delimiter">"</span></span><span class="error">e</span><span class="error">n</span><span class="error">t</span><span class="error">i</span><span class="error">t</span><span class="error">y</span><span class="error">_</span><span class="error">i</span><span class="error">d</span><span class="string"><span class="delimiter">"</span><span class="content">: </span><span class="delimiter">"</span></span><span class="error">s</span><span class="error">e</span><span class="error">n</span><span class="error">s</span><span class="error">o</span><span class="error">r</span><span class="error">.</span><span class="error">w</span><span class="error">e</span><span class="error">a</span><span class="error">t</span><span class="error">h</span><span class="error">e</span><span class="error">r</span><span class="error">_</span><span class="error">t</span><span class="error">e</span><span class="error">m</span><span class="error">p</span><span class="error">e</span><span class="error">r</span><span class="error">a</span><span class="error">t</span><span class="error">u</span><span class="error">r</span><span class="error">e</span><span class="string"><span class="delimiter">"</span><span class="content">,
|
||||
</span><span class="delimiter">"</span></span><span class="error">l</span><span class="error">a</span><span class="error">s</span><span class="error">t</span><span class="error">_</span><span class="error">c</span><span class="error">h</span><span class="error">a</span><span class="error">n</span><span class="error">g</span><span class="error">e</span><span class="error">d</span><span class="string"><span class="delimiter">"</span><span class="content">: </span><span class="delimiter">"</span></span><span class="integer">2016</span><span class="integer">-0</span><span class="integer">2</span><span class="integer">-0</span><span class="integer">6</span><span class="error">T</span><span class="integer">22</span>:<span class="integer">15</span>:<span class="integer">0</span><span class="integer">0</span><span class="error">+</span><span class="integer">0</span><span class="integer">0</span>:<span class="integer">0</span><span class="integer">0</span><span class="string"><span class="delimiter">"</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">last_updated</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">2016-02-06T22:15:00+00:00</span><span class="delimiter">"</span></span><span class="string"><span class="delimiter">"</span><span class="content">,
|
||||
</span><span class="delimiter">"</span></span><span class="error">s</span><span class="error">t</span><span class="error">a</span><span class="error">t</span><span class="error">e</span><span class="string"><span class="delimiter">"</span><span class="content">: </span><span class="delimiter">"</span></span><span class="float">-1.9</span><span class="string"><span class="delimiter">"</span><span class="content">
|
||||
},
|
||||
]
|
||||
]
|
||||
</span></span></pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Sample <code>curl</code> commands:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ curl -X GET -H "x-ha-access: YOUR_PASSWORD" \
|
||||
-H "Content-Type: application/json" \
|
||||
http://localhost:8123/api/history/period/2016-02-06
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ curl -X GET -H "x-ha-access: YOUR_PASSWORD" \
|
||||
-H "Content-Type: application/json" \
|
||||
http://localhost:8123/api/history/period/2016-02-06?filter_entity_id=sensor.temperature
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4><a class="title-link" name="get-apistates" href="#get-apistates"></a> GET /api/states</h4>
|
||||
<p>Returns an array of state objects. Each state has the following attributes: entity_id, state, last_changed and attributes.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>[
|
||||
{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">attributes</span><span class="delimiter">"</span></span>: {},
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">entity_id</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">sun.sun</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">last_changed</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">2016-05-30T21:43:32.418320+00:00</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">state</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">below_horizon</span><span class="delimiter">"</span></span>
|
||||
},
|
||||
{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">attributes</span><span class="delimiter">"</span></span>: {},
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">entity_id</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">process.Dropbox</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">last_changed</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">22016-05-30T21:43:32.418320+00:00</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">state</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">on</span><span class="delimiter">"</span></span>
|
||||
}
|
||||
]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Sample <code>curl</code> command:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ curl -X GET -H "x-ha-access: YOUR_PASSWORD" \
|
||||
-H "Content-Type: application/json" http://localhost:8123/api/states
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4><a class="title-link" name="get-apistatesltentity_id" href="#get-apistatesltentity_id"></a> GET /api/states/<entity_id></h4>
|
||||
<p>Returns a state object for specified entity_id. Returns 404 if not found.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">attributes</span><span class="delimiter">"</span></span>:{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">azimuth</span><span class="delimiter">"</span></span>:<span class="float">336.34</span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">elevation</span><span class="delimiter">"</span></span>:<span class="float">-17.67</span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">friendly_name</span><span class="delimiter">"</span></span>:<span class="string"><span class="delimiter">"</span><span class="content">Sun</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">next_rising</span><span class="delimiter">"</span></span>:<span class="string"><span class="delimiter">"</span><span class="content">2016-05-31T03:39:14+00:00</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">next_setting</span><span class="delimiter">"</span></span>:<span class="string"><span class="delimiter">"</span><span class="content">2016-05-31T19:16:42+00:00</span><span class="delimiter">"</span></span>
|
||||
},
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">entity_id</span><span class="delimiter">"</span></span>:<span class="string"><span class="delimiter">"</span><span class="content">sun.sun</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">last_changed</span><span class="delimiter">"</span></span>:<span class="string"><span class="delimiter">"</span><span class="content">2016-05-30T21:43:29.204838+00:00</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">last_updated</span><span class="delimiter">"</span></span>:<span class="string"><span class="delimiter">"</span><span class="content">2016-05-30T21:50:30.529465+00:00</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">state</span><span class="delimiter">"</span></span>:<span class="string"><span class="delimiter">"</span><span class="content">below_horizon</span><span class="delimiter">"</span></span>
|
||||
}
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Sample <code>curl</code> command:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ curl -X GET -H "x-ha-access: YOUR_PASSWORD" \
|
||||
-H "Content-Type: application/json" \
|
||||
http://localhost:8123/api/states/sensor.kitchen_temperature
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4><a class="title-link" name="get-apierror_log" href="#get-apierror_log"></a> GET /api/error_log</h4>
|
||||
<p>Retrieve all errors logged during the current session of Home Assistant as a plaintext response.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>15-12-20 11:02:50 homeassistant.components.recorder: Found unfinished sessions
|
||||
15-12-20 11:03:03 netdisco.ssdp: Error fetching description at http://192.168.1.1:8200/rootDesc.xml
|
||||
15-12-20 11:04:36 homeassistant.components.alexa: Received unknown intent HelpIntent
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Sample <code>curl</code> command:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ curl -X GET -H "x-ha-access: YOUR_PASSWORD" \
|
||||
-H "Content-Type: application/json" \
|
||||
http://localhost:8123/api/error_log
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4><a class="title-link" name="get-apicamera_proxycameraltentity_id" href="#get-apicamera_proxycameraltentity_id"></a> GET /api/camera_proxy/camera.<entity_id></h4>
|
||||
<p>Returns the data (image) from the specified camera entity_id.</p>
|
||||
|
||||
<p>Sample <code>curl</code> command:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ curl -X GET -H "x-ha-access: YOUR_PASSWORD" \
|
||||
-H "Content-Type: application/json" \
|
||||
http://localhost:8123/api/camera_proxy/camera.my_sample_camera?time=1462653861261 -o image.jpg
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4><a class="title-link" name="post-apistatesltentity_id" href="#post-apistatesltentity_id"></a> POST /api/states/<entity_id></h4>
|
||||
<p>Updates or creates the current state of an entity.</p>
|
||||
|
||||
<p>Expects a JSON object that has at least a state attribute:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">state</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">below_horizon</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">attributes</span><span class="delimiter">"</span></span>: {
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">next_rising</span><span class="delimiter">"</span></span>:<span class="string"><span class="delimiter">"</span><span class="content">2016-05-31T03:39:14+00:00</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">next_setting</span><span class="delimiter">"</span></span>:<span class="string"><span class="delimiter">"</span><span class="content">2016-05-31T19:16:42+00:00</span><span class="delimiter">"</span></span>
|
||||
}
|
||||
}
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Return code is 200 if the entity existed, 201 if the state of a new entity was set. A location header will be returned with the url of the new resource. The response body will contain a JSON encoded State object.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">attributes</span><span class="delimiter">"</span></span>: {
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">next_rising</span><span class="delimiter">"</span></span>:<span class="string"><span class="delimiter">"</span><span class="content">2016-05-31T03:39:14+00:00</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">next_setting</span><span class="delimiter">"</span></span>:<span class="string"><span class="delimiter">"</span><span class="content">2016-05-31T19:16:42+00:00</span><span class="delimiter">"</span></span>
|
||||
},
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">entity_id</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">sun.sun</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">last_changed</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">2016-05-30T21:43:29.204838+00:00</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">last_updated</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">2016-05-30T21:47:30.533530+00:00</span><span class="delimiter">"</span></span>
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">state</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">below_horizon</span><span class="delimiter">"</span></span>
|
||||
}
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Sample <code>curl</code> command:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ curl -X POST -H "x-ha-access: YOUR_PASSWORD" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"state": "25", "attributes": {"unit_of_measurement": "°C"}}' \
|
||||
http://localhost:8123/api/states/sensor.kitchen_temperature
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4><a class="title-link" name="post-apieventsltevent_type" href="#post-apieventsltevent_type"></a> POST /api/events/<event_type></h4>
|
||||
<p>Fires an event with event_type</p>
|
||||
|
||||
<p>You can pass an optional JSON object to be used as <code>event_data</code>.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>{
|
||||
<span class="error">n</span><span class="error">e</span><span class="error">x</span><span class="error">t</span><span class="error">_</span><span class="error">r</span><span class="error">i</span><span class="error">s</span><span class="error">i</span><span class="error">n</span><span class="error">g</span><span class="string"><span class="delimiter">"</span><span class="content">:</span><span class="delimiter">"</span></span><span class="integer">2016</span><span class="integer">-0</span><span class="integer">5</span><span class="integer">-31</span><span class="error">T</span><span class="integer">0</span><span class="integer">3</span>:<span class="integer">39</span>:<span class="integer">14</span><span class="error">+</span><span class="integer">0</span><span class="integer">0</span>:<span class="integer">0</span><span class="integer">0</span><span class="string"><span class="delimiter">"</span><span class="content">,
|
||||
}
|
||||
</span></span></pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Returns a message if successful.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">message</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">Event download_file fired.</span><span class="delimiter">"</span></span>
|
||||
}
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4><a class="title-link" name="post-apiservicesltdomainltservice" href="#post-apiservicesltdomainltservice"></a> POST /api/services/<domain>/<service></h4>
|
||||
<p>Calls a service within a specific domain. Will return when the service has been executed or 10 seconds has past, whichever comes first.</p>
|
||||
|
||||
<p>You can pass an optional JSON object to be used as <code>service_data</code>.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">entity_id</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">light.Ceiling</span><span class="delimiter">"</span></span>
|
||||
}
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Returns a list of states that have changed while the service was being executed.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>[
|
||||
{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">attributes</span><span class="delimiter">"</span></span>: {},
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">entity_id</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">sun.sun</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">last_changed</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">2016-05-30T21:43:32.418320+00:00</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">state</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">below_horizon</span><span class="delimiter">"</span></span>
|
||||
},
|
||||
{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">attributes</span><span class="delimiter">"</span></span>: {},
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">entity_id</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">process.Dropbox</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">last_changed</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">22016-05-30T21:43:32.418320+00:00</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">state</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">on</span><span class="delimiter">"</span></span>
|
||||
}
|
||||
]
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Sample <code>curl</code> command:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ curl -X POST -H "x-ha-access: YOUR_PASSWORD" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"entity_id": "switch.christmas_lights", "state": "on"}' \
|
||||
http://localhost:8123/api/services/switch/turn_on
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="note">
|
||||
The result will include any changed states that changed while the service was being executed, even if their change was the result of something else happening in the system.
|
||||
</p>
|
||||
|
||||
<h4><a class="title-link" name="post-apitemplate" href="#post-apitemplate"></a> POST /api/template</h4>
|
||||
<p>Render a Home Assistant template. <a href="/topics/templating/">See template docs for more information.</a></p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">template</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">Paulus is at {{ states('device_tracker.paulus') }}!</span><span class="delimiter">"</span></span>
|
||||
}
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Returns the rendered template in plain text.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>Paulus is at work!
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Sample <code>curl</code> command:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ curl -X POST -H "x-ha-access: YOUR_PASSWORD" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"template": "It is !"}' http://localhost:8123/api/template
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4><a class="title-link" name="post-apievent_forwarding" href="#post-apievent_forwarding"></a> POST /api/event_forwarding</h4>
|
||||
<p>Setup event forwarding to another Home Assistant instance.</p>
|
||||
|
||||
<p>Requires a JSON object that represents the API to forward to.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">host</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">machine</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">api_password</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">my_super_secret_password</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">port</span><span class="delimiter">"</span></span>: <span class="integer">8880</span> <span class="error">/</span><span class="error">/</span> <span class="error">o</span><span class="error">p</span><span class="error">t</span><span class="error">i</span><span class="error">o</span><span class="error">n</span><span class="error">a</span><span class="error">l</span>
|
||||
}
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>It will return a message if event forwarding was setup successful.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">message</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">Event forwarding setup.</span><span class="delimiter">"</span></span>
|
||||
}
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4><a class="title-link" name="delete-apievent_forwarding" href="#delete-apievent_forwarding"></a> DELETE /api/event_forwarding</h4>
|
||||
<p>Cancel event forwarding to another Home Assistant instance.<br /></p>
|
||||
|
||||
<p>Requires a JSON object that represents the API to cancel forwarding to.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">host</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">machine</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">api_password</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">my_super_secret_password</span><span class="delimiter">"</span></span>,
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">port</span><span class="delimiter">"</span></span>: <span class="integer">8880</span> <span class="error">/</span><span class="error">/</span> <span class="error">o</span><span class="error">p</span><span class="error">t</span><span class="error">i</span><span class="error">o</span><span class="error">n</span><span class="error">a</span><span class="error">l</span>
|
||||
}
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>It will return a message if event forwarding was cancelled successful.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>{
|
||||
<span class="key"><span class="delimiter">"</span><span class="content">message</span><span class="delimiter">"</span></span>: <span class="string"><span class="delimiter">"</span><span class="content">Event forwarding cancelled.</span><span class="delimiter">"</span></span>
|
||||
}
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="note">
|
||||
If your client does not support <code>DELETE</code> HTTP requests you can add an optional attribute <code>_METHOD</code> and set its value to <code>DELETE</code>.
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/rest_api.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a class='active' href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
275
developers/server_sent_events/index.html
Normal file
275
developers/server_sent_events/index.html
Normal file
|
@ -0,0 +1,275 @@
|
|||
<!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>Server-sent events - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Home Assistant Server-sent events documentation">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/server_sent_events/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Server-sent events">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/server_sent_events/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Home Assistant Server-sent events documentation">
|
||||
<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="Server-sent events">
|
||||
<meta name="twitter:description" content="Home Assistant Server-sent events documentation">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Server-sent Events
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>The <a href="https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events">server-sent events</a> feature is a one-way channel from your Home Assistant server to a client which is acting as a consumer. For bi-directional communication check the <a href="/developers/rest_api/">RESTful API</a> and <a href="/developers/python_api/">Python API</a>.</p>
|
||||
|
||||
<p>The URI that is generating the data is <code>/api/stream</code>.</p>
|
||||
|
||||
<p>A requirement on the client-side is existing support for the <a href="https://developer.mozilla.org/en-US/docs/Web/API/EventSource">EventSource</a> interface.</p>
|
||||
|
||||
<p>There are various ways to access the stream. One is <code>curl</code>:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ curl -X GET -H "x-ha-access: 12345" \
|
||||
-H "Content-Type: application/json" http://localhost:8123/api/stream
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>For more comfort put the HTML snippet below in a file <code>sse.html</code> in your <code>www</code> folder of your Home Assistant configuration directory (<code>.homeassistant</code>)</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="doctype"><!DOCTYPE html></span>
|
||||
<span class="tag"><html></span>
|
||||
<span class="tag"><body></span>
|
||||
<span class="tag"><h1></span>Getting Home Assistant server events<span class="tag"></h1></span>
|
||||
<span class="tag"><div</span> <span class="attribute-name">id</span>=<span class="string"><span class="delimiter">"</span><span class="content">events</span><span class="delimiter">"</span></span><span class="tag">></span><span class="tag"></div></span>
|
||||
<span class="tag"><script</span> <span class="attribute-name">type</span>=<span class="string"><span class="delimiter">"</span><span class="content">text/javascript</span><span class="delimiter">"</span></span><span class="tag">></span>
|
||||
<span class="inline"> <span class="keyword">var</span> source = <span class="keyword">new</span> EventSource(<span class="string"><span class="delimiter">"</span><span class="content">/api/stream</span><span class="delimiter">"</span></span>);
|
||||
source.<span class="function">onmessage</span> = <span class="keyword">function</span>(event) {
|
||||
document.getElementById(<span class="string"><span class="delimiter">"</span><span class="content">events</span><span class="delimiter">"</span></span>).innerHTML += event.data + <span class="string"><span class="delimiter">"</span><span class="content"><br></span><span class="delimiter">"</span></span>;
|
||||
};</span>
|
||||
<span class="tag"></script></span>
|
||||
<span class="tag"></body></span>
|
||||
<span class="tag"></html></span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Visit <a href="http://localhost:8123/local/sse.html">http://localhost:8123/local/sse.html</a> to see the stream of events.</p>
|
||||
|
||||
<h2><a class="title-link" name="examples" href="#examples"></a> Examples</h2>
|
||||
|
||||
<p>The simplest way to consume server-sent events is <code>curl</code>.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ curl http://localhost:8123/api/stream?api_password=MYPASS
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3><a class="title-link" name="website" href="#website"></a> Website</h3>
|
||||
|
||||
<p>The <a href="https://github.com/fabaff/home-assistant-sse">home-assistant-sse</a> repository contains an more advanced example.</p>
|
||||
|
||||
<h3><a class="title-link" name="python" href="#python"></a> Python</h3>
|
||||
|
||||
<p>If you want test the server-sent events without creating a website then the Python module <a href="https://pypi.python.org/pypi/sseclient/"><code>sseclient</code> </a> can help. Install it first:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ pip3 install sseclient
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>The simplest script to consume the SSE looks like the following snipplet.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="keyword">from</span> <span class="include">sseclient</span> <span class="keyword">import</span> <span class="include">SSEClient</span>
|
||||
|
||||
messages = SSEClient(<span class="string"><span class="delimiter">'</span><span class="content">http://localhost:8123/api/stream?api_password=MYPASS</span><span class="delimiter">'</span></span>)
|
||||
<span class="keyword">for</span> msg <span class="keyword">in</span> messages:
|
||||
print(msg)
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/server_sent_events.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a class='active' href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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>
|
267
developers/website/index.html
Normal file
267
developers/website/index.html
Normal file
|
@ -0,0 +1,267 @@
|
|||
<!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>Website home-assistant.io - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="home-assistant.io web presence">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/website/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Website home-assistant.io">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/website/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="home-assistant.io web presence">
|
||||
<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="Website home-assistant.io">
|
||||
<meta name="twitter:description" content="home-assistant.io web presence">
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Website home-assistant.io
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>The website you’re reading now is the home of Home Assistant: <a href="https://home-assistant.io">https://home-assistant.io</a>. This is the place where we provide documentation and additional details about Home Assistant for end users and developers.</p>
|
||||
|
||||
<p>home-assistant.io uses the <a href="http://octopress.org/">Octopress</a> framework for <a href="http://github.com/mojombo/jekyll">Jekyll</a>. To get more details, please checkout the <a href="http://octopress.org/docs/">Octopress documentation</a>. <br />
|
||||
That means that creating a new page is simple. The pages are written in <a href="http://daringfireball.net/projects/markdown/">markdown</a>; you don’t need to care about HTML or the like.</p>
|
||||
|
||||
<p>The process for working on the website is no different from working on Home Assistant itself.</p>
|
||||
|
||||
<p>To test your changes locally, you need to install the <strong>Ruby</strong> dependencies (gems):</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="https://www.ruby-lang.org/en/documentation/installation/">Install Ruby</a> if you don’t have it already.</li>
|
||||
<li>Install <code>bundler</code>, which is a dependency manager for Ruby: <code>gem install bundler</code></li>
|
||||
<li>In your home-assistant.io root directory, run <code>bundle</code> to install the gems you need.</li>
|
||||
</ul>
|
||||
|
||||
<p>Then you can work on the documentation:</p>
|
||||
|
||||
<ul>
|
||||
<li>Fork home-assistant.io <a href="https://github.com/home-assistant/home-assistant.io">git repository</a>.</li>
|
||||
<li>Create/edit/update a page in the directory <code>source/_components/</code> for your platform/component.</li>
|
||||
<li>Test your changes to home-assistant.io locally: run <code>rake preview</code> and navigate to <a href="http://127.0.0.1:4000">http://127.0.0.1:4000</a></li>
|
||||
<li>Create a Pull Request (PR) against the <strong>next</strong> branch of home-assistant.io if your documentation is for a new feature, platform, or component.</li>
|
||||
<li>Create a Pull Request (PR) against the <strong>master</strong> branch of home-assistant.io if you fix stuff, create Cookbook entries, or expand existing documentation.</li>
|
||||
</ul>
|
||||
|
||||
<p>For a platform page, the fastest way is to make a copy of an existing page and edit it. The <a href="/components/">component overview</a> is generated automatically, so there is no need to add a link to your page.</p>
|
||||
|
||||
<h3><a class="title-link" name="code" href="#code"></a> Code</h3>
|
||||
<p>To take advantage of the built-in features of Octopress to display code snippets, just use the default markdown syntax. Please use <code>$</code> and <code>#</code> if it’s a command and to differ from output.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>Here goes the code...
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>If you want to display line numbers, add the following snippet somewhere on your page.</p>
|
||||
|
||||
<pre><code>{::options coderay_line_numbers="table" /}
|
||||
</code></pre>
|
||||
|
||||
<h3><a class="title-link" name="images-icons-and-logos" href="#images-icons-and-logos"></a> Images, icons, and logos</h3>
|
||||
<p>The images which are displayed on the pages are stored in various directories according to their purpose.</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="text-align: left">Type</th>
|
||||
<th style="text-align: left">Location</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="text-align: left">screen shots</td>
|
||||
<td style="text-align: left">source/images/screenshots</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: left">logos</td>
|
||||
<td style="text-align: left">source/images/supported_brands</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p>Not everything (product, component, etc.) has a logo. To show something for internal parts of Home Assistant we are using the <a href="https://materialdesignicons.com/">Material Design Icons</a>.</p>
|
||||
|
||||
|
||||
|
||||
</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.io/tree/master/source/developers/website.markdown'>Edit this page on GitHub</a></div>
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Development Guide</h1>
|
||||
<ul class='divided sidebar-menu'>
|
||||
<li>
|
||||
<a href='/developers/'>Introduction </a>
|
||||
<ul>
|
||||
<li><a href='/developers/architecture/'>Architecture </a></li>
|
||||
<li><a href='/developers/architecture_components/'>Components </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/development/'>Starting with Development </a>
|
||||
<ul>
|
||||
<li><a href='/developers/development_environment/'>Setting up Environment </a></li>
|
||||
<li><a href='/developers/development_submitting/'>Submit your Work </a></li>
|
||||
<li><a href='/developers/development_checklist/'>Checklist </a></li>
|
||||
<li><a href='/developers/development_testing/'>Testing </a></li>
|
||||
<li><a href='/developers/development_catching_up/'>Catching up with Reality </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/add_new_platform/'>Support a new device (as a platform) </a>
|
||||
<ul>
|
||||
<li><a href='/developers/platform_example_sensor/'>Example sensor platform </a></li>
|
||||
<li><a href='/developers/platform_example_light/'>Example light platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/developers/creating_components/'>Adding a new component </a>
|
||||
<ul>
|
||||
<li><a href='/developers/component_loading/'>Loading components </a></li>
|
||||
<li><a href='/developers/component_deps_and_reqs/'>Requirements & Dependencies </a></li>
|
||||
<li><a href='/developers/component_initialization/'>Initialization </a></li>
|
||||
<li><a href='/developers/component_events/'>Handling events </a></li>
|
||||
<li><a href='/developers/component_states/'>States </a></li>
|
||||
<li><a href='/developers/component_visibility/'>Visibility </a></li>
|
||||
<li><a href='/developers/component_generic_discovery/'>Loading Platforms </a></li>
|
||||
<li><a href='/developers/component_discovery/'>Component Discovery </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Frontend Development
|
||||
<ul>
|
||||
<li><a href='/developers/frontend/'>Setup Frontend Environment </a></li>
|
||||
<li><a href='/developers/frontend_add_card/'>Add State Card </a></li>
|
||||
<li><a href='/developers/frontend_add_more_info/'>Add More Info Dialog </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
API
|
||||
<ul>
|
||||
<li><a href='/developers/rest_api/'>RESTful API </a></li>
|
||||
<li><a href='/developers/python_api/'>Python API </a></li>
|
||||
<li><a href='/developers/server_sent_events/'>Server-sent events </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href='/developers/helpers/'>Online helpers </a></li>
|
||||
<li><a href='/developers/multiple_instances/'>Multiple Instances </a></li>
|
||||
<li><a class='active' href='/developers/website/'>Home-Assistant.io </a></li>
|
||||
<li><a href='/developers/credits/'>Credits </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://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