Open Masterz69 opened 2 years ago
For the time being, you can manually add units using a simple template, or even automatically using Jinja2 templates.
- entity: sensor.top_fuel_station
layout: state
state:
postfix: " ¢/L"
Tried to use template in postfix
- it not working, imho.
- entity: sensor.sns_boiler_out
layout: state
state:
postfix: "{{ state_attr('sensor.sns_boiler_out', 'unit_of_measurement') }}"
produce
@Masterz69 Templates don't work within cards. However, you do have a couple of additional HACS-available cards that can help. Personally, I've been using custom-template-card in combination with paper-buttons-row to do this kind of thing. (custom-template-card uses javascript instead of jinja2, but it's easy enough to figure out). I have samples if they'd help.
That said, I fully support your request for an enhancement to allow inclusion of units, both to simply allow them to (optionally) be displayed and also to allow separate style control of them.
Numerous times I've wished I could include the unit, but at, say, a smaller font size. Seems like a pretty common UI trope.
F.e. by adding to layout configuration 'units', which will be entity attribute unit_of_measurement, prefixed with space symbol.