Site updated at 2018-01-05 04:58:25 UTC
This commit is contained in:
parent
93c7f7ae56
commit
fd28feb4f9
27 changed files with 78 additions and 75 deletions
|
@ -78,21 +78,22 @@
|
|||
<p class="note">
|
||||
Not all existing platforms follow the requirements in this checklist. This cannot be used as a reason to not follow them!
|
||||
</p>
|
||||
<h3><a class="title-link" name="requirements" href="#requirements"></a> Requirements</h3>
|
||||
<h3><a class="title-link" name="1-requirements" href="#1-requirements"></a> 1. Requirements</h3>
|
||||
<ol>
|
||||
<li>Requirement version pinned: <code class="highlighter-rouge">REQUIREMENTS = ['phue==0.8.1']</code></li>
|
||||
<li>We no longer want requirements hosted on GitHub. Please upload to PyPi.</li>
|
||||
<li>Requirements should only be imported inside functions. This is necessary because requirements are installed on the fly.</li>
|
||||
</ol>
|
||||
<h3><a class="title-link" name="configuration" href="#configuration"></a> Configuration</h3>
|
||||
<h3><a class="title-link" name="2-configuration" href="#2-configuration"></a> 2. Configuration</h3>
|
||||
<ol>
|
||||
<li>Voluptuous schema present for config validation</li>
|
||||
<li>Default parameters specified in voluptuous schema, not in <code class="highlighter-rouge">setup(…)</code></li>
|
||||
<li>Schema using as many generic config keys as possible from <code class="highlighter-rouge">homeassistant.const</code></li>
|
||||
<li>If having platforms, have a <code class="highlighter-rouge">PLATFORM_SCHEMA</code>, otherwise <code class="highlighter-rouge">CONFIG_SCHEMA</code>.</li>
|
||||
<li>If <code class="highlighter-rouge">PLATFORM_SCHEMA</code>, import base from <code class="highlighter-rouge">homeassistant.helpers.config_validation</code></li>
|
||||
<li>If your component has platforms, define a <code class="highlighter-rouge">PLATFORM_SCHEMA</code> instead of a <code class="highlighter-rouge">CONFIG_SCHEMA</code>.</li>
|
||||
<li>If using a <code class="highlighter-rouge">PLATFORM_SCHEMA</code> to be used with <code class="highlighter-rouge">EntityComponent</code>, import base from <code class="highlighter-rouge">homeassistant.helpers.config_validation</code></li>
|
||||
<li>Never depend on users adding things to <code class="highlighter-rouge">customize</code> to configure behavior inside your component.</li>
|
||||
</ol>
|
||||
<h3><a class="title-link" name="componentplatform-communication" href="#componentplatform-communication"></a> Component/platform communication</h3>
|
||||
<h3><a class="title-link" name="3-componentplatform-communication" href="#3-componentplatform-communication"></a> 3. Component/platform communication</h3>
|
||||
<ol>
|
||||
<li>If you need to share global data with platforms, use the dictionary <code class="highlighter-rouge">hass.data</code>. <code class="highlighter-rouge">hass.data[DATA_XY]</code> while <code class="highlighter-rouge">XY</code> is the component is preferred over <code class="highlighter-rouge">hass.data[DOMAIN]</code>.</li>
|
||||
<li>If the component fetches data that causes it’s related platform entities to update, you can notify them using the dispatcher code in <code class="highlighter-rouge">homeassistant.helpers.dispatcher</code>.</li>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue