Add simple example for renaming

This commit is contained in:
Fabian Affolter 2016-07-14 09:35:26 +02:00
parent c3ea06828f
commit 4ba93ae2f1
No known key found for this signature in database
GPG Key ID: DDF3D6F44AAB1336

View File

@ -56,7 +56,20 @@ sensor:
unit_of_measurement: '°'
```
### {% linkable_title Multi line example with an if test (and warnings disabled)%}
### {% linkable_title Renaming sensor output %}
If you don't like the wording of a sensor output then the template sensor can help too. Processes monitored by the [System Monitor sensor](/components/sensor.systemmonitor/) show `on` or `off` if they are running or not. This example shows how the output of a monitored `glances` process can be renamed.
```yaml
sensor:
platform: template
sensors:
glances:
value_template: '{% if is_state("sensor.process_glances", "off") %}not running{% else %}running{% endif %}'
friendly_name: 'Glances'
```
### {% linkable_title Multiline example with an if test (and warnings disabled) %}
This example shows a multiple line template with and if test. It looks at a sensing switch and shows on/off in the frontend. It disables warnings to avoid log messages where the switch it depends on isn't loaded yet.
@ -79,6 +92,7 @@ sensor:
warnings: Off
```
(please note the blank line to close the multi-line template)
### {% linkable_title Change the unit of measurment %}
@ -98,3 +112,4 @@ sensor:
friendly_name: 'Transmission Up Speed'
unit_of_measurement: 'kB/s'
```