Added round to battery precentage (#2309)

Sometimes the battery will be show as a long string like: 28.99999999996%..
By adding "|round" this will be shown as 29%
This commit is contained in:
Ludeeus 2017-03-20 20:09:34 +01:00 committed by Fabian Affolter
parent 8e4f825ab7
commit 48084ee55e

View File

@ -22,7 +22,7 @@ sensor:
unit_of_measurement: '%' unit_of_measurement: '%'
value_template: >- value_template: >-
{% raw %}{%- if states.device_tracker.iphone.attributes.battery %} {% raw %}{%- if states.device_tracker.iphone.attributes.battery %}
{{ states.device_tracker.iphone.attributes.battery }} {{ states.device_tracker.iphone.attributes.battery|round }}
{% else %} {% else %}
{{ states.sensor.battery_iphone.state }} {{ states.sensor.battery_iphone.state }}
{%- endif %}{% endraw %} {%- endif %}{% endraw %}