mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-23 09:17:06 +00:00
Add example for converting units
This commit is contained in:
parent
bb89689d08
commit
5e265d324c
@ -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'
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user