Site updated at 2017-07-02 20:59:34 UTC
This commit is contained in:
parent
8ad1dcd91e
commit
3844b6ed4e
84 changed files with 216 additions and 193 deletions
|
@ -174,6 +174,13 @@ The component will only write a log message. Keep in mind for later that you hav
|
|||
<p class="img">
|
||||
<img src="/images/screenshots/create-component01.png" />
|
||||
</p>
|
||||
<p>In order to expose attributes of your component, you will need to define a method called <code class="highlighter-rouge">state_attributes</code> which will return a dictionary of attributes:</p>
|
||||
<div class="highlighter-rouge"><pre class="highlight"><code><span class="k">@property</span>
|
||||
<span class="n">def</span> <span class="n">state_attributes</span><span class="p">(</span><span class="n">self</span><span class="p">)</span><span class="o">:</span>
|
||||
<span class="s">"""Return the attributes of the entity."""</span>
|
||||
<span class="k">return</span> <span class="n">self</span><span class="p">.</span><span class="n">_attributes</span>
|
||||
</code></pre>
|
||||
</div>
|
||||
<p>To get your component included in the Home Assistant releases, follow the steps described in the <a href="https://home-assistant.io/developers/#submitting-improvements">Submitting improvements</a> section. Basically you only need to move your component in the <code class="highlighter-rouge">homeassistant/component/</code> directory of your fork and create a Pull Request.</p>
|
||||
</article>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue