Site updated at 2016-07-30 20:22:19 UTC
This commit is contained in:
parent
d2d5ef4fdc
commit
d5dc0ccb1d
362 changed files with 5165 additions and 1607 deletions
|
@ -177,6 +177,7 @@ DEPENDENCIES = [<span class="string"><span class="delimiter">'</span><span class
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -179,6 +179,7 @@
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -212,6 +212,7 @@ Diagram showing interaction between components and the Home Assistant core.
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -168,6 +168,7 @@
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -184,6 +184,7 @@ This option is only available to built-in components.
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -150,6 +150,7 @@
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -232,6 +232,7 @@ In the past, this was achieved by adding your component to the <code>DISCOVERY_P
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -196,6 +196,7 @@
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -165,6 +165,7 @@ Home Assistant will use the directory that contains your config file as the dire
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -162,6 +162,7 @@
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -161,6 +161,7 @@ You can set a suggestion for your entity’s visibility by setting the <code>hid
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -167,6 +167,7 @@
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -126,6 +126,7 @@
|
|||
<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/cbulock">Cameron Bulock</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>
|
||||
|
@ -133,13 +134,15 @@
|
|||
<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/danielperna84">Daniel Perna</a></li>
|
||||
<li><a href="https://github.com/zeroDenial">Daniel Zozin</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/abcminiuser">Dean Camera</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>
|
||||
|
@ -148,10 +151,13 @@
|
|||
<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/fabianhjr">Fabian Heredia Montiel</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/fotoetienne">fotoetienne</a></li>
|
||||
<li><a href="https://github.com/PetitCircuitLab">Fredrik Haglund</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>
|
||||
|
@ -177,6 +183,7 @@
|
|||
<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/jwl17330536">John Lindley</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>
|
||||
|
@ -190,13 +197,13 @@
|
|||
<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/kireyeu">kireyeu</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>
|
||||
|
@ -211,11 +218,14 @@
|
|||
<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/n8henrie">Nathan Henrie</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/ngraziano">Nicolas Graziano</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/open-homeautomation">open-homeautomation</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>
|
||||
|
@ -234,6 +244,8 @@
|
|||
<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/schneefux">schneefux</a></li>
|
||||
<li><a href="https://github.com/americanwookie">Scott O’Neil</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>
|
||||
|
@ -248,6 +260,7 @@
|
|||
<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/vladonemo">vladonemo</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>
|
||||
|
@ -316,6 +329,7 @@
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -159,6 +159,7 @@
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -179,6 +179,7 @@ $ git rebase upstream/dev # to put those changes into your feature branch before
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -158,6 +158,7 @@
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -166,6 +166,7 @@ $ script/setup
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -166,6 +166,7 @@
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -192,6 +192,7 @@ $ flake8 --install-hook
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -125,7 +125,7 @@ Do not use development mode in production. Home Assistant uses aggressive cachin
|
|||
|
||||
<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>
|
||||
<p>While you are developing, you need to have Rollup 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
|
||||
|
@ -134,15 +134,14 @@ $ npm run js_dev
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<p>The source code for the frontend can be found in two different directories:</p>
|
||||
<p>The source code for the frontend can be found in three 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>
|
||||
<li>Core: <code>homeassistant/components/frontend/www_static/home-assistant-polymer/home-assistant-js/src/</code></li>
|
||||
<li>Panels: <code>homeassistant/components/frontend/www_static/home-assistant-polymer/panels/</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>
|
||||
|
@ -151,22 +150,17 @@ $ npm run js_dev
|
|||
<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>Compile all used JavaScript.</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>
|
||||
<li>Vulcanize and minify the core and panel sources to build dir.</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>
|
||||
<li>Copy the final frontend build <code>frontend.html</code> and panel sources from <strong>home-assistant-polymer</strong> to <code>components/frontend/www_static/frontend/</code>.</li>
|
||||
<li>Generate MD5 hashes of core and panel sources.</li>
|
||||
<li>Create gzip versions of all the sources.</li>
|
||||
</ul>
|
||||
|
||||
<p class="img">
|
||||
<img src="/images/frontend/polymer-build-architecture.png" alt="Polymer build architecture diagram" />
|
||||
Polymer build architecture diagram
|
||||
</p>
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
|
@ -226,6 +220,7 @@ Polymer build architecture diagram
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -99,14 +99,13 @@
|
|||
|
||||
<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>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.html"><code>/src/components/entity/ha-state-label-badge.html</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>'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/hass-util.html#L11">/util/hass-util.html</a>.</li>
|
||||
<li>Create the files <code>state-card-camera.html</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><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>
|
||||
|
||||
|
@ -169,6 +168,7 @@
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -99,9 +99,8 @@
|
|||
<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>'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/hass-util.html#L24">util/hass-util.html</a>.</li>
|
||||
<li>Create the files <code>more-info-camera.html</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><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>
|
||||
|
||||
|
@ -164,6 +163,7 @@
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
293
developers/frontend_creating_custom_panels/index.html
Normal file
293
developers/frontend_creating_custom_panels/index.html
Normal file
|
@ -0,0 +1,293 @@
|
|||
<!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 custom panels - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Introduction to create custom panels for Home Assistant.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/developers/frontend_creating_custom_panels/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Creating custom panels">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/developers/frontend_creating_custom_panels/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Introduction to create custom panels 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 custom panels">
|
||||
<meta name="twitter:description" content="Introduction to create custom panels 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 Custom Panels
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>Any component has the possibility to add a panel to the frontend. Panels will be rendered full screen and have real-time access to the Home Assistant object via JavaScript. Examples of this in the app are map, logbook and history.</p>
|
||||
|
||||
<p>Adding a custom panel to your component is easy. For this example we’re assuming your component is in <code>hello_panel.py</code>. Start by converting your panel to a folder. Create a folder called <code>hello_panel</code> and move <code>hello_panel.py</code> to <code>hello_panel/__init__.py</code>. In that same folder, create a file <code>panel.html</code>.</p>
|
||||
|
||||
<p>Your component should register the panel. The minimum required code for your component is:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="docstring"><span class="delimiter">"""</span><span class="content">A minimal custom panel example.</span><span class="delimiter">"""</span></span>
|
||||
<span class="keyword">import</span> <span class="include">os</span>
|
||||
|
||||
<span class="keyword">from</span> <span class="include">homeassistant.components.frontend</span> <span class="keyword">import</span> <span class="include">register_panel</span>
|
||||
|
||||
DOMAIN = <span class="string"><span class="delimiter">'</span><span class="content">hello_panel</span><span class="delimiter">'</span></span>
|
||||
DEPENDENCIES = [<span class="string"><span class="delimiter">'</span><span class="content">frontend</span><span class="delimiter">'</span></span>]
|
||||
|
||||
PANEL_PATH = os.path.join(os.path.dirname(__file__), <span class="string"><span class="delimiter">'</span><span class="content">panel.html</span><span class="delimiter">'</span></span>)
|
||||
|
||||
|
||||
<span class="keyword">def</span> <span class="function">setup</span>(hass, config):
|
||||
<span class="docstring"><span class="delimiter">"""</span><span class="content">Initialize a minimal custom panel.</span><span class="delimiter">"""</span></span>
|
||||
register_panel(hass, <span class="string"><span class="delimiter">'</span><span class="content">hello</span><span class="delimiter">'</span></span>, PANEL_PATH, title=<span class="string"><span class="delimiter">'</span><span class="content">Hello World</span><span class="delimiter">'</span></span>,
|
||||
icon=<span class="string"><span class="delimiter">'</span><span class="content">mdi:appnet</span><span class="delimiter">'</span></span>, config=config.get(DOMAIN, {}))
|
||||
<span class="keyword">return</span> <span class="predefined-constant">True</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>The <code>panel.html</code> contains the needed building blocks to create the elements inside the view.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><dom-module id=<span class="string"><span class="delimiter">'</span><span class="content">ha-panel-hello</span><span class="delimiter">'</span></span>>
|
||||
<span class="tag"><template></span>
|
||||
<span class="tag"><style></span>
|
||||
<span class="inline"> <span class="tag">p</span> {
|
||||
<span class="key">font-weight</span>: <span class="value">bold</span>;
|
||||
}</span>
|
||||
<span class="tag"></style></span>
|
||||
<span class="tag"><p></span>Hello {{who}}. Greetings from Home Assistant.<span class="tag"></p></span>
|
||||
<span class="tag"></template></span>
|
||||
<<span class="regexp"><span class="delimiter">/</span><span class="content">dom-module>
|
||||
|
||||
<</span><span class="delimiter">/</span></span>script>
|
||||
Polymer({
|
||||
<span class="key">is</span>: <span class="string"><span class="delimiter">'</span><span class="content">ha-panel-hello</span><span class="delimiter">'</span></span>,
|
||||
<span class="key">properties</span>: {
|
||||
<span class="comment">// Home Assistant object</span>
|
||||
<span class="key">hass</span>: {
|
||||
<span class="key">type</span>: Object,
|
||||
},
|
||||
<span class="comment">// If should render in narrow mode</span>
|
||||
<span class="key">narrow</span>: {
|
||||
<span class="key">type</span>: Boolean,
|
||||
<span class="key">value</span>: <span class="predefined-constant">false</span>,
|
||||
},
|
||||
<span class="comment">// If sidebar is currently shown</span>
|
||||
<span class="key">showMenu</span>: {
|
||||
<span class="key">type</span>: Boolean,
|
||||
<span class="key">value</span>: <span class="predefined-constant">false</span>,
|
||||
},
|
||||
<span class="comment">// Home Assistant panel info</span>
|
||||
<span class="comment">// panel.config contains config passed to register_panel serverside</span>
|
||||
<span class="key">panel</span>: {
|
||||
<span class="key">type</span>: Object,
|
||||
},
|
||||
<span class="key">who</span>: {
|
||||
<span class="key">type</span>: String,
|
||||
<span class="key">computed</span>: <span class="string"><span class="delimiter">'</span><span class="content">computeWho(panel)</span><span class="delimiter">'</span></span>,
|
||||
}
|
||||
},
|
||||
|
||||
<span class="function">computeWho</span>: <span class="keyword">function</span> (panel) {
|
||||
<span class="keyword">return</span> panel && panel.config && panel.config.who ? panel.config.who : <span class="string"><span class="delimiter">'</span><span class="content">World</span><span class="delimiter">'</span></span>;
|
||||
},
|
||||
});
|
||||
<<span class="regexp"><span class="delimiter">/</span><span class="content">script>
|
||||
</span></span></pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Create an entry for the new panel in your <code>configuration.yaml</code> file:</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="key">hello_panel</span>:
|
||||
<span class="key">who</span>: <span class="string"><span class="content">'You'</span></span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>For more examples, see the <a href="/cookbook#custom-panel-examples">Custom panel 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/frontend_creating_custom_panels.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>
|
||||
<li><a class='active' href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </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://facebook.com/homeassistantio'><i class="icon-facebook"></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>
|
|
@ -158,6 +158,7 @@
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -155,6 +155,7 @@ Diagram showing interaction between components and the Home Assistant core.
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
<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>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 slave 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">
|
||||
|
@ -183,6 +183,7 @@ Because each slave maintains its own Service Registry it is possible to have mul
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -254,6 +254,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -197,6 +197,7 @@
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -117,6 +117,20 @@ living_room = hass.states.get(<span class="string"><span class="delimiter">'</sp
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<h3><a class="title-link" name="get-configuration" href="#get-configuration"></a> Get configuration</h3>
|
||||
|
||||
<p>Get the current configuration of a Home Asssitant 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
|
||||
|
||||
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.get_config(api))
|
||||
</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>
|
||||
|
@ -239,6 +253,32 @@ remote.call_service(api, domain, <span class="string"><span class="delimiter">'<
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<h3><a class="title-link" name="specify-a-timeout" href="#specify-a-timeout"></a> Specify a timeout</h3>
|
||||
|
||||
<p>The default timeout for an API call with <code>call_service</code> is 5 seconds. Service<br />
|
||||
taking longer than this to return will raise<br />
|
||||
<code>homeassistant.exceptions.HomeAssistantError: Timeout</code> unless provided with a<br />
|
||||
longer timeout.</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">host</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>
|
||||
|
||||
<span class="comment"># Assuming switch.timeout_switch takes 10 seconds to return</span>
|
||||
switch_name = <span class="string"><span class="delimiter">'</span><span class="content">switch.timeout_switch</span><span class="delimiter">'</span></span>
|
||||
|
||||
<span class="comment"># Raises homeassistant.exceptions.HomeAssistantError: Timeout when talking to</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>: switch_name})
|
||||
|
||||
<span class="comment"># Runs withous exception</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>: switch_name},
|
||||
timeout=<span class="integer">11</span>)
|
||||
</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>
|
||||
|
@ -316,6 +356,7 @@ remote.call_service(api, domain, <span class="string"><span class="delimiter">'<
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -184,6 +184,7 @@
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -709,6 +709,7 @@ If your client does not support <code>DELETE</code> HTTP requests you can add an
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -222,6 +222,7 @@ messages = SSEClient(<span class="string"><span class="delimiter">'</span><span
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -214,6 +214,7 @@ That means that creating a new page is simple. The pages are written in <a href=
|
|||
<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>
|
||||
<li><a href='/developers/frontend_creating_custom_panels/'>Add Custom Panels </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue