thomasloven / lovelace-template-entity-row

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

Missing Units #129

Open Nick2253 opened 3 weeks ago

Nick2253 commented 3 weeks ago

When I use template-entity-row, the unit is missing from the entity state:

type: entities
title: Missing Units
entities:
  - type: custom:template-entity-row
    entity: >-
      {{ state_attr('sensor.person_data', 'data')['person.nick']['battery']
      }}
  - type: custom:template-entity-row
    entity: sensor.pixel_6_pro_battery_level
  - entity: sensor.pixel_6_pro_battery_level

image

You can see that the first row, which is a fully templated entity pulled out of my sensor.person_data data storage, and the second row, which directly refers to the sensor.pixel_6_pro_battery_level, lack the "%" unit symbol. However, a normal entity does show the units.

ildar170975 commented 3 weeks ago

unit is missing

As expected since the result is a STATE, not a state with a unit. Compose a result using a unit if you need it.

Nick2253 commented 3 weeks ago

As expected since the result is a STATE, not a state with a unit.

I'm not sure why that would be "expected". There no indication in the documentation that it behaves any differently than a normal entity row, so I think it's pretty logical to expect it to behave that way. Since there is also a templateable state value, I'd think that I'd use that for anything that I'd want that's non-standard.

In any event, if this is indeed expected behavior, than consider this a feature request for a default or similar flag to display the entity row as if it were a default row. Reading through the documentation again, the part about "blinds" stands out to me as another reason to want this kind of behavior. And for more complicated entities like locks, thermostats, covers, etc, it would be great to be able to only template the entity, and leave everything else the same as the default entity row.

ildar170975 commented 3 weeks ago

There no indication in the documentation that it behaves any differently than a normal entity row, so I think it's pretty logical to expect it to behave that way

Then I would suggest you to prepare a PR for improving "readme" since template-entity-row DEFINITELY looks DIFFERENTLY.

image

image

image

In short - a state is always a "raw" & not localized state.

Alternatively - you may prepare a FR for displaying a "standard" row if some new option is set.