mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-21 16:27:19 +00:00
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:
parent
8e4f825ab7
commit
48084ee55e
@ -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 %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user