Open Nick2253 opened 4 months 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.
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.
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.
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.
From the point of view of "principle of least surprise", going from
- entity: sensor.foo
to
- entity: sensor.foo
type: custom:template-entity-row
... I, too, would expect it to behave exactly the same, not having specified any of the new options template-entity-row provides.
Anyway, it's too late to make this work by default now without breaking people. For anyone seeing this wanting a solution:
- entity: sensor.foo
type: custom-template-entity-row
state: >
{{ states(config.entity) }} {{ state_attr(config.entity, 'unit_of_measurement') }}
When I use
template-entity-row
, the unit is missing from the entity state: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 thesensor.pixel_6_pro_battery_level
, lack the "%" unit symbol. However, a normal entity does show the units.