Add example for converting units

This commit is contained in:
Fabian Affolter 2016-04-07 22:41:09 +02:00
parent bb89689d08
commit 5e265d324c

View File

@ -77,4 +77,20 @@ sensor:
```
(please note the blank line to close the multi-line template)
### {% linkable_title Change the unit of measurment %}
With a template sensor it's easy to convert given values into others if the unit of measurement don't fit your needs.
```yaml
sensor:
platform: template
sensors:
transmission_down_speed_kbps:
value_template: {% raw %}'{{ states.sensor.transmission_down_speed.state | multiply(1024) }}'{% endraw %}
friendly_name: 'Transmission Down Speed'
unit_of_measurement: 'kB/s'
transmission_up_speed_kbps:
value_template: {% raw %}'{{ states.sensor.transmission_up_speed.state | multiply(1024) }}'{% endraw %}
friendly_name: 'Transmission Up Speed'
unit_of_measurement: 'kB/s'
```