benct / lovelace-multiple-entity-row

Show multiple entity states and attributes on entity rows in Home Assistant's Lovelace UI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: Format - Percent?

kylepyke opened this issue · comments

I'm wondering if it's possible in a future release to add a percent value to the format: option, to convert single decimal places to percentage. For example, 0.3 would become 30%.

This would be helpful for, say displaying volume for a media_player.

Thanks for all of your work on this repo!

I came across this idea as well and would place a +1 for this feature.

I think adding something like

...
else if (config.format === 'percent') {
            value = Math.round(value * 100);
            unit = '%';
...

to the formatting part of the code (

if (config.format) {
) would already suffice.

Unfortunately, I am not into JS deployment. Therefore I would motivate someone else to look into this more deeply :-)