Description:
Gladys allows the retrieval of numerous numerical values from devices: energy consumption, power, temperature, distance, volume, amounts, etc.
Currently, the display format of these values is mainly determined by Gladys. In some cases, the number of displayed decimal places or the unit used does not match the desired level of precision or readability.
For example, a value of 12,345 € may be displayed as 12,35 €, whereas three decimal places may be necessary (for the fuel price integration of @prohand, this would be very useful).
Need
Allow the user to customize the display format of a value, without modifying the value actually stored by Gladys.
Two parameters could be proposed:
- Number of displayed decimal places
- automatic
- 0
- 1
- 2
- 3
- 4, etc.
- Display unit
- keep the original unit
- select a compatible unit when relevant
Examples
A value:
12,3456 €
could be displayed as:
12,35 €12,346 €12,3456 €
Consumption:
1250 Wh
could be displayed as:
1250 Wh1,25 kWh1,250 kWh
A distance:
1250 m
could be displayed as:
1250 m1,25 km
Principle
This feature should only affect the presentation of the data.
The raw value and its actual precision must remain unchanged in Gladys to avoid degrading the history, calculations, or automations.
Formatting would be applied at the display level: dashboard, widgets, history, etc., depending on the components concerned.
Possible Extension
In the long term, this feature could become a generic numeric value formatting system in Gladys, allowing in particular:
- the choice of the number of decimal places;
- the conversion of compatible units;
- the choice between automatic or forced display;
- possibly rounding rules;
- the ability to define these preferences at the level of a device/feature or directly at the level of a widget.
The goal would be to clearly separate:
real value → storage unit → display format
in order to allow a restitution adapted to the needs of each user.