home-assistant / home-assistant/iOS

Values in complications not displayed correctly

Open
#2,436 2 comments 0 reactions 0 assignees View on GitHub
bug ios
Dominant language
Swift
Stars
2.4k
Forks
520
Avg merge
7h 27m
Merged PRs (30d)
264

Description

**iOS device model, version and app version**
Model Name: iPhone 12 Pro
Software Version: 17.1
App version: 2023.7 (2023.471)

**Home Assistant Core Version**
2023.10.5

**Describe the bug**
Some values in Watch complications are not displayed correctly. Seems to be related to rounding/epsilon error, but there is no workaround.
Using round or format functions will not do anything, because the value will always be converted to float.

Example values and how they are displayed:
9.8 -> 9.8000…1
8.8 -> 8.8000…1
9.3 -> 9.3000…1
9.2 -> 9.1999…9
Or use any sensor that outputs a value like above

**To Reproduce**
1) Go to Apple Watch settings in Home Assistant iOS App
2) Add a new complication (for example image circular)
3) select a template (for example open gauge text)
4) copy/paste in any field:
{% set value = 9.8 %}
{{ value }}
5) the output will show as 9.8000000…1

Or try with format:
{% set value = 9.8 %}
{{ '%.2f' | format(value) }}
Outputs same as 5)

**Expected behavior**
Rounding error should not be visible or the use of format function should be possible.

**Screenshots**
![IMG_6012](https://github.com/home-assistant/iOS/assets/79875327/379404aa-4721-4386-9826-5e34c556a4ed)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.