mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-16 05:46:52 +00:00
Add simple example for renaming
This commit is contained in:
parent
c3ea06828f
commit
4ba93ae2f1
@ -56,7 +56,20 @@ sensor:
|
|||||||
unit_of_measurement: '°'
|
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.
|
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
|
warnings: Off
|
||||||
```
|
```
|
||||||
|
|
||||||
(please note the blank line to close the multi-line template)
|
(please note the blank line to close the multi-line template)
|
||||||
|
|
||||||
### {% linkable_title Change the unit of measurment %}
|
### {% linkable_title Change the unit of measurment %}
|
||||||
@ -98,3 +112,4 @@ sensor:
|
|||||||
friendly_name: 'Transmission Up Speed'
|
friendly_name: 'Transmission Up Speed'
|
||||||
unit_of_measurement: 'kB/s'
|
unit_of_measurement: 'kB/s'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user