Site updated at 2016-08-13 19:22:59 UTC
This commit is contained in:
parent
b043f25a3b
commit
f5b903f5ec
347 changed files with 6259 additions and 2708 deletions
|
@ -142,7 +142,9 @@
|
|||
<li><div class="fb-like" data-href="https://www.facebook.com/homeassistantio/" data-layout="standard" data-action="like" data-size="small" data-show-faces="true" data-share="false"></div></li>
|
||||
</ul>
|
||||
</section>
|
||||
<div id="fb-root"></div>
|
||||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.async=true;js.src='//platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
|
||||
<script>(function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(d.getElementById(id)){return;}js=d.createElement(s);js.id=id;js.async=true;js.src="//connect.facebook.net/en_US/all.js#appId=338291289691179&xfbml=1";fjs.parentNode.insertBefore(js,fjs);}(document,'script','facebook-jssdk'));</script>
|
||||
|
||||
|
||||
<section class="sharing aside-module grid__item one-whole lap-one-half">
|
||||
|
@ -167,24 +169,17 @@
|
|||
</section>
|
||||
|
||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||
<script>
|
||||
window.fbAsyncInit = function() {
|
||||
FB.init({appId: '338291289691179', xfbml: true, version: 'v2.2'});
|
||||
};
|
||||
|
||||
(function(d, s, id){
|
||||
var js, fjs = d.getElementsByTagName(s)[0];
|
||||
if (d.getElementById(id)) {return;}
|
||||
js = d.createElement(s); js.id = id; js.async = true;
|
||||
js.src = "//connect.facebook.net/en_US/sdk.js";
|
||||
fjs.parentNode.insertBefore(js, fjs);
|
||||
}(document, 'script', 'facebook-jssdk'));
|
||||
</script>
|
||||
<section id="recent-posts" class="aside-module grid__item one-whole lap-one-half">
|
||||
<h1 class="title delta">Recent Posts</h1>
|
||||
<ul class="divided">
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2016/08/13/foursquare-fast-com-ffmpeg-gpsd/">0.26: Foursquare, Fast.com, FFMPEG and GPSD</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2016/08/07/optimizing-the-home-assistant-mobile-web-app/">Optimizing the Home Assistant mobile web app</a>
|
||||
</li>
|
||||
|
@ -208,12 +203,6 @@
|
|||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2016/07/23/internet-of-things-data-exploration-with-jupyter-notebooks/">IoT Data Exploration with Jupyter Notebooks</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
|
|
|
@ -124,17 +124,17 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<h3><a class="title-link" name="python-keyring" href="#python-keyring"></a> Python Keyring</h3>
|
||||
<h3><a class="title-link" name="storing-passwords-in-a-keyring-managed-by-your-os" href="#storing-passwords-in-a-keyring-managed-by-your-os"></a> Storing passwords in a keyring managed by your OS</h3>
|
||||
|
||||
<p>Using <a href="http://pythonhosted.org/keyring/">Keyring</a> is an alternative way to <code>secrets.yaml</code> but requires that <code>keyring</code> is installed (incl. its command-line tools). This can be done with:</p>
|
||||
<p>Using <a href="http://pythonhosted.org/keyring/">Keyring</a> is an alternative way to <code>secrets.yaml</code>. They can be managed from the command line via the keyring script.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ pip3 install keyring
|
||||
<div class="code"><pre>$ hass --script keyring --help
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Replace your password or API key with <code>!secret</code> and an identifier in <code>configuration.yaml</code> file.</p>
|
||||
<p>To store a password in keyring, replace your password or API key with <code>!secret</code> and an identifier in <code>configuration.yaml</code> file.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre><span class="key">http</span>:
|
||||
|
@ -143,28 +143,10 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<p>Create an entry in your keyring. The service (SERVICE) is <code>homeassistant</code> and the identifier is the USERNAME in the keyring context.</p>
|
||||
<p>Create an entry in your keyring.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ keyring set homeassistant http_password
|
||||
Password for 'http_password' in 'homeassistant':
|
||||
Please set a password for your new keyring:
|
||||
Please confirm the password:
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>If the command-line tool <code>keyring</code> is not available, launch <code>python3</code> and do the process manually.</p>
|
||||
|
||||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>>>> <span class="keyword">import</span> <span class="include">keyring</span>
|
||||
>>> keyring.set_password(<span class="string"><span class="delimiter">"</span><span class="content">homeassistant</span><span class="delimiter">"</span></span>, <span class="string"><span class="delimiter">"</span><span class="content">http_password</span><span class="delimiter">"</span></span>, <span class="string"><span class="delimiter">"</span><span class="content">12345</span><span class="delimiter">"</span></span>)
|
||||
Please <span class="predefined">set</span> a password <span class="keyword">for</span> your new keyring:
|
||||
Please confirm the password:
|
||||
>>> keyring.get_password(<span class="string"><span class="delimiter">"</span><span class="content">homeassistant</span><span class="delimiter">"</span></span>, <span class="string"><span class="delimiter">"</span><span class="content">http_password</span><span class="delimiter">"</span></span>)
|
||||
<span class="string"><span class="delimiter">'</span><span class="content">12345</span><span class="delimiter">'</span></span>
|
||||
>>> keyring.get_keyring()
|
||||
<EncryptedKeyring at /home/your_user/.local/share/python_keyring/crypted_pass.cfg>
|
||||
<div class="code"><pre>$ hass --script keyring set http_password
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -174,7 +156,7 @@ Please confirm the password:
|
|||
<div class="highlighter-coderay"><div class="CodeRay">
|
||||
<div class="code"><pre>$ hass
|
||||
Config directory: /home/fab/.homeassistant
|
||||
Please enter password for encrypted keyring:
|
||||
Please enter password for encrypted keyring:
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -184,7 +166,6 @@ Please enter password for encrypted keyring:
|
|||
</p>
|
||||
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
|
|
|
@ -108,8 +108,8 @@
|
|||
<span class="comment"># Location required to calculate the time the sun rises and sets</span>
|
||||
<span class="key">latitude</span>: <span class="string"><span class="content">37</span></span>
|
||||
<span class="key">longitude</span>: <span class="string"><span class="content">-121</span></span>
|
||||
<span class="comment"># C for Celsius, F for Fahrenheit</span>
|
||||
<span class="key">temperature_unit</span>: <span class="string"><span class="content">F</span></span>
|
||||
<span class="comment"># 'metric' for Metric, 'imperial' for Imperial</span>
|
||||
<span class="key">unit_system</span>: <span class="string"><span class="content">imperial</span></span>
|
||||
<span class="comment"># Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones</span>
|
||||
<span class="key">time_zone</span>: <span class="string"><span class="content">America/Los_Angeles</span></span>
|
||||
<span class="key">customize</span>: <span class="type">!include</span> <span class="string"><span class="content">customize.yaml</span></span>
|
||||
|
|
|
@ -102,12 +102,12 @@
|
|||
|
||||
<ul>
|
||||
<li>Formatting outgoing messages in, for example, the <a href="/components/notify/">notify</a> and <a href="/components/alexa/">alexa</a> components.</li>
|
||||
<li>Process incoming data from sources that provide raw data, like <a href="/components/mqtt/">MQTT</a>, <a href="/components/sensor.rest/">Rest sensor</a> or the <a href="/components/sensor.command_line/">command line sensor</a>.</li>
|
||||
<li>Process incoming data from sources that provide raw data, like <a href="/components/mqtt/">MQTT</a>, <a href="/components/sensor.rest/">REST sensor</a>, or the <a href="/components/sensor.command_line/">command line sensor</a>.</li>
|
||||
</ul>
|
||||
|
||||
<h2><a class="title-link" name="building-templates" href="#building-templates"></a> Building templates</h2>
|
||||
|
||||
<p>Templating in Home Assistant is powered by the Jinja2 templating engine. This means that we are using their syntax and make some custom Home Assistant variables available to templates during rendering. We will not go over the basics of the syntax, as Jinja2 does a lot better job at this in their <a href="http://jinja.pocoo.org/docs/dev/templates/">Jinja2 documentation</a>.</p>
|
||||
<p>Templating in Home Assistant is powered by the <a href="http://jinja.pocoo.org/">Jinja2</a> templating engine. This means that we are using their syntax and make some custom Home Assistant variables available to templates during rendering. We will not go over the basics of the syntax, as Jinja2 does a lot better job at this in their <a href="http://jinja.pocoo.org/docs/dev/templates/">Jinja2 documentation</a>.</p>
|
||||
|
||||
<p class="note">
|
||||
The frontend has a template editor developer tool to help develop and debug templates.
|
||||
|
@ -131,6 +131,14 @@ The frontend has a template editor developer tool to help develop and debug temp
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<p><a href="http://jinja.pocoo.org/">Jinja2</a> supports a width variety of operations:</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="http://jinja.pocoo.org/docs/dev/templates/#math">Mathematical operation</a></li>
|
||||
<li><a href="http://jinja.pocoo.org/docs/dev/templates/#comparisons">Comparisons</a></li>
|
||||
<li><a href="http://jinja.pocoo.org/docs/dev/templates/#logic">Logic</a></li>
|
||||
</ul>
|
||||
|
||||
<h2><a class="title-link" name="home-assistant-template-extensions" href="#home-assistant-template-extensions"></a> Home Assistant template extensions</h2>
|
||||
|
||||
<p>Home Assistant adds extensions to allow templates to access all of the current states:</p>
|
||||
|
@ -149,7 +157,6 @@ The frontend has a template editor developer tool to help develop and debug temp
|
|||
<li><code>closest()</code> will find the closest entity.</li>
|
||||
<li><code>relative_time(timestamp)</code> will format the date time as relative time vs now (ie 7 seconds)</li>
|
||||
<li><code>float</code> will format the output as float.</li>
|
||||
<li>Filter <code>multiply(x)</code> will convert the input to a number and multiply it with <code>x</code>.</li>
|
||||
<li>Filter <code>round(x)</code> will convert the input to a number and round it to <code>x</code> decimals.</li>
|
||||
<li>Filter <code>timestamp_local</code> will convert an UNIX timestamp to local time/data.</li>
|
||||
<li>Filter <code>timestamp_utc</code> will convert an UNIX timestamp to UTC time/data.</li>
|
||||
|
@ -199,7 +206,9 @@ The frontend has a template editor developer tool to help develop and debug temp
|
|||
Paulus is at {{ states('device_tracker.paulus')) }}.
|
||||
{% endif %}
|
||||
|
||||
{{ states.sensor.temperature | multiply(10) | round(2) }}
|
||||
{{ states.sensor.temperature | float + 1 }}
|
||||
|
||||
{{ states.sensor.temperature | float * 10 | round(2) }}
|
||||
|
||||
{% if states('sensor.temperature') | float > 20 %}
|
||||
It is warm!
|
||||
|
@ -300,9 +309,9 @@ Closest to an entity: {{ closest(states.zone.school, 'group.children') }}
|
|||
# Format output
|
||||
{{ "%+.1f" | value_json }}
|
||||
|
||||
# Calculations
|
||||
{{ value_json | multiply(1024) }}
|
||||
{{ value_json.used | multiply(0.0001) | round(0) }}
|
||||
# Math
|
||||
{{ value_json | float * 1024 }}
|
||||
{{ float(value_json) * (2**10) }}
|
||||
|
||||
# Timestamps
|
||||
{{ value_json.tst | timestamp_local }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue