Site updated at 2018-02-26 01:02:56 UTC
This commit is contained in:
parent
41c5c550a6
commit
ac7487404f
816 changed files with 14568 additions and 2170 deletions
|
@ -104,6 +104,10 @@ from other entities.</p>
|
|||
<dd>
|
||||
<p class="desc"><span class="type">(<span class="string">string</span>)</span><span class="required">(Optional)</span><span class="description">Name to use in the frontend.</span></p>
|
||||
</dd>
|
||||
<dt><a class="title-link" name="friendly_name_template" href="#friendly_name_template"></a> friendly_name_template</dt>
|
||||
<dd>
|
||||
<p class="desc"><span class="type">(<span class="template"><a href="/docs/configuration/templating/">template</a></span>)</span><span class="required">(Optional)</span><span class="description">Defines a template for the name to be used in the frontend (this overrides friendly_name).</span></p>
|
||||
</dd>
|
||||
<dt><a class="title-link" name="entity_id" href="#entity_id"></a> entity_id</dt>
|
||||
<dd>
|
||||
<p class="desc"><span class="type">(<span class="string, list">string | list</span>)</span><span class="required">(Optional)</span><span class="description">A list of entity IDs so the sensor only reacts to state changes of these entities. This can be used if the automatic analysis fails to find all relevant entities.</span></p>
|
||||
|
@ -267,6 +271,39 @@ unit of measurement doesn’t fit your needs.</p>
|
|||
<span class="no">{% endif %}</span>
|
||||
</code></pre>
|
||||
</div>
|
||||
<h3><a class="title-link" name="change-the-friendly-name-used-in-the-frontend" href="#change-the-friendly-name-used-in-the-frontend"></a> Change the Friendly Name Used in the Frontend</h3>
|
||||
<p>This example shows how to change the <code class="highlighter-rouge">friendly_name</code> based on a date.
|
||||
Explanation: we add a multiple of 86400 seconds (= 1 day) to the current unix timestamp to get a future date.</p>
|
||||
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">sensor</span><span class="pi">:</span>
|
||||
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
|
||||
<span class="s">sensors</span><span class="pi">:</span>
|
||||
<span class="s">forecast_1_day_ahead</span><span class="pi">:</span>
|
||||
<span class="s">friendly_name_template</span><span class="pi">:</span> <span class="pi">>-</span>
|
||||
<span class="no">{%- set date = as_timestamp(now()) + (1 * 86400 ) -%}</span>
|
||||
<span class="no">{{ date|timestamp_custom("Tomorrow (%-m/%-d)") }}</span>
|
||||
<span class="no">value_template: "{{ sensor.darksky_weather_forecast_1 }}"</span>
|
||||
<span class="s">forecast_2_days_ahead</span><span class="pi">:</span>
|
||||
<span class="s">friendly_name_template</span><span class="pi">:</span> <span class="pi">>-</span>
|
||||
<span class="no">{%- set date = as_timestamp(now()) + (2 * 86400 ) -%}</span>
|
||||
<span class="no">{{ date|timestamp_custom("%A (%-m/%-d)") }}</span>
|
||||
<span class="no">value_template: "{{ sensor.darksky_weather_forecast_2 }}"</span>
|
||||
</code></pre>
|
||||
</div>
|
||||
<p>This example shows how to change the <code class="highlighter-rouge">friendly_name</code> based on a state.</p>
|
||||
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">sensor</span><span class="pi">:</span>
|
||||
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
|
||||
<span class="s">sensors</span><span class="pi">:</span>
|
||||
<span class="s">net_power</span><span class="pi">:</span>
|
||||
<span class="s">friendly_name_template</span><span class="pi">:</span> <span class="pi">>-</span>
|
||||
<span class="no">{% if states('sensor.power_consumption')|float < 0 %}</span>
|
||||
<span class="no">Power Consumption</span>
|
||||
<span class="no">{% else %}</span>
|
||||
<span class="no">Power Production</span>
|
||||
<span class="no">{% end %}</span>
|
||||
<span class="no">value_template: "{{ states('sensor.power_consumption') }}"</span>
|
||||
<span class="no">unit_of_measurement: 'kW'</span>
|
||||
</code></pre>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
<aside id="sidebar" class="grid__item one-third lap-one-whole palm-one-whole">
|
||||
|
@ -339,6 +376,9 @@ unit of measurement doesn’t fit your needs.</p>
|
|||
<li>
|
||||
<a href='/components/sensor.bme680/'>BME680 Sensor</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/components/sensor.bmw_connected_drive/'>BMW connected drive</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/components/sensor.bbox/'>Bbox Sensor</a>
|
||||
</li>
|
||||
|
@ -414,6 +454,12 @@ unit of measurement doesn’t fit your needs.</p>
|
|||
<li>
|
||||
<a href='/components/sensor.file/'>File Sensor</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/components/sensor.filesize/'>File size sensor</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/components/sensor.folder/'>Folder sensor</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/components/sensor.gpsd/'>GPSD</a>
|
||||
</li>
|
||||
|
@ -579,9 +625,18 @@ unit of measurement doesn’t fit your needs.</p>
|
|||
<li>
|
||||
<a href='/components/sensor.sleepiq/'>SleepIQ Sensor</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/components/sensor.smappee/'>Smappee Sensor</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/components/sensor.sonarr/'>Sonarr Sensor</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/components/sensor.spotcrime/'>Spot Crime</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/components/sensor.startca/'>Start.ca</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/components/sensor.statistics/'>Statistics Sensor</a>
|
||||
</li>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue