thomasloven / lovelace-template-entity-row

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

name and secondary too close to image #21

Closed Mariusthvdb closed 4 years ago

Mariusthvdb commented 4 years ago

using:

#card:
#  type: custom:secondaryinfo-entity-row
#  entity: '[[entity]]'
#  secondary_info: '[[ {entity}.attributes.type ]]: [[ {entity}.attributes.original_date ]]'

card:
  type: custom:template-entity-row
  entity: '[[entity]]'
  secondary: >
    {{states.[[entity]].attributes.type}}: {{states.[[entity]].attributes.original_date}}
#  name: '{{states.[[entity]].attributes.friendly_name}}'
#  state: '{{states.[[entity]].state}}'
#  image: '{{states.[[entity]].attributes.entity_picture}}'

in a decluttering card causes the name and secondary_info to be placed too closely to the entity_picture of the row. wrong

Compare that to the commented secondary info-entity-row code, which places it correctly:

correct

and uses the 'normal' space between image and name in a entity row, like:

Schermafbeelding 2020-03-19 om 09 56 08

furthermore, it doesn't show the unit_of_measurement, isn't that taken from the entity? if not, please add that too?

Schermafbeelding 2020-03-19 om 10 18 48

please have a look?

HA 106.6 T-E-R 1.1.0 thanks ps also discussed in the community

thomasloven commented 4 years ago

Is this fixed? I think it is..?

Mariusthvdb commented 4 years ago

yes! well, almost. spacing is perfect, thank you sir!

no unit yet though, is that something you are still looking in to please?

Schermafbeelding 2020-04-15 om 09 17 22
thomasloven commented 4 years ago

The unit's right there in the attributes. Use templating to put it wherever you want it.

Mariusthvdb commented 4 years ago

Well, im puzzled, I thought to have tried all... please give me a hint how to get the attribute

{{states.[[entity]].attributes.unit_of_measurement}}

on the 'official' spot for unit? Its not for the 'secondary' line, but since this is using 'entity', there is no placeholder for anything besides that? no option for unit listed here: https://github.com/thomasloven/lovelace-template-entity-row#options

thomasloven commented 4 years ago

By putting in in the state: just like the state.

state: "{{states(config.entity)}} {{state_attr(config.entity, 'unit_of_measurement')}}"

This row is all about configurability. Having it do everything automatically would ruin the point.

Mariusthvdb commented 4 years ago

ok thanks, will do. cool.

Schermafbeelding 2020-04-15 om 10 02 14

working nicely!

was not using the 'state' till now, this

card:
  type: custom:template-entity-row
  entity: '[[entity]]'
  secondary: >
    {{states.[[entity]].attributes.type}}: {{states.[[entity]].attributes.original_date}}

works just fine ;-) exactly because it takes most automatically from the entity (3d bullet in https://github.com/thomasloven/lovelace-template-entity-row#options)

could I FR adding unit_of_measurement there? It would allow it to be as close to regular entity if wanted, and still allow for all templating options for optimal configurability if so desired.