thomasloven / lovelace-template-entity-row

🔹 Display whatever you want in an entities card row.
MIT License
210 stars 16 forks source link

no Unit of measurement on entity displayed (while properly set on the entity) #58

Closed Mariusthvdb closed 3 months ago

Mariusthvdb commented 2 years ago

scroll down this post please... FR addunit to: if this evaluates to an entity id, icon, name, state and image will be taken from that entity unless manually overridden

using:

      - type: custom:template-entity-row
        entity: sensor.argon_one_addon_fan_speed
        secondary: >
          Temp: {{state_attr(config.entity,'Temperature C')}} °C, Mode: {{state_attr(config.entity,'mode')}}, Level: {{state_attr(config.entity,'fan level')}}

doesn't respect the entity unit_of measurement:

Schermafbeelding 2021-07-14 om 12 23 58

which is set, as displayed in the second entity of the screenshot. It is also showed in the more-info when clicked in the template-entity-row entity:

Schermafbeelding 2021-07-14 om 12 24 14

and in states:

Schermafbeelding 2021-07-14 om 12 28 42

please have a look? thanks

btw, I do know we can use:

        state: >
          {{states(config.entity)}} %

but it would simply be cool if an entity, without a non set state: would respect the unit of that entity, just like does for the icon, name state and image, as described in the options

maybe I should simply rephrase this as: please add unitto that list.....

ChipWolf commented 2 years ago

Currently using this on all uses of the template entity row:

state: >
  {{states(config.entity)}} {{state_attr(config.entity, 'unit_of_measurement')}}
Mariusthvdb commented 3 months ago

just a long overdue update on this:

                state: >
                  {{states[config.entity].state_with_unit}}

works nicely ;-)

as does:

{{ states(config.entity, with_unit=True) }}

closing with that