šŸ”¹ template-entity-row - Put templates in an entities row

hey David, Maybe also +1 on the Fr for the toggle :wink:

1 Like

Is it possible for the secondary info to have multi line output? I canā€™t seem to inject any kind of of new line character in the template.

anyone else seeing issues on the template-entity-row card in HA115.
I am using this on templates built by Python at startup, which apparently is not very well digested (too late for the engine, causing the full startup to take a very long time.) either by HA, or by the T-e-r card.

thereā€™s a fix for HA planned for several of these timing issues, maybe T-e-r card would need some extra attention

Iā€™m trying to get template-entity-row to show localized state which in my case I think should be like this:

state: "_(state.binary_sensor.door.{{states('binary_sensor.balkongdorr_sovrum_tmpl')}})"

which shows up like this:
image

ā€¦not really the way I expected.

But this actually works:

state: "_(component.binary_sensor.state.door.{{states('binary_sensor.balkongdorr_sovrum_tmpl')}})"

image

Am I doing something wrong (that just accidentally happened to work) or has something changed and the docs should be updated?

having made this verbose template:

  - type: custom:auto-entities
    card:
      type: entities
      title: Person address trackers
    filter:
      include:
        - entity_id: person.*_address
          options:
            type: custom:template-entity-row
            secondary: >
              {{state_attr(config.entity,'road')}} {{state_attr(config.entity,'house_number')}},{{state_attr(config.entity,'postcode')}} {{state_attr(config.entity,'town') if state_attr(config.entity,'town') else state_attr(config.entity,'city')}}, {{state_attr(config.entity,'country')}}

I suppose there could be a better wayā€¦
but, donā€™t see it right now, so turning to the community here.

Please have a look? thanks!

Is this HACS add-in still working?

I just get ā€˜custom element doesnā€™t exist: template-entity-rowā€™

Iā€™ve installed it using up-to-date HACS (1.9.0) whilst running 2020-12-1 and also restarted HA.

I am using it with no problems

Maybe it is the act of installing it in the current HA version.??
I got round it by using card-templater instead.

I have been using it for ages with no issues and now in 2021.1.0b1 and all is goodā€¦

1 Like

Thanks for the prod David,
I typed my card definition in long-hand rather than a cut and paste and it works ! :grinning:

Hello Thomas,
thanks for this plugin.
Can i ask for you help for something similar:
I try to get this:
image
the problem i have is that i canā€™t manage to get the title to work with template as you do in your post because i use a different type of entity (i want the time to be the bigger as possible).
i try with this code:

type: entity
entity: sensor.time
name: '{{states(''sensor.date_fr'')}}'

but i get:
image

two questions:

I try to mimic secondary_info: last-changed from a normal in entity

secondary: "{{ relative_time(states[config.entity].last_changed) }}" works fine but isnā€™t translated in the UI.

any wordaround?

2nd: when using card_mod is there a way to color just the icon and the entity value?

This gives me a full colored row and icon:

        card_mod:
          style: |
            {% if states(config.entity) | float > 23 %}
               :host {
                 --paper-item-icon-color: red;
                 color: red
               }
            {% elif states(config.entity) | float < 21 %}
               :host {
                 --paper-item-icon-color: blue;
                 color: blue
               }
            {% else %}
               :host {
                 --paper-item-icon-color: green;
                 color: green
               }
            {% endif %}

Thanks =)

1 Like

Can I pass attribute values to a script on tap_action with this?

Is it work with Banner Card? Iā€™ve tried to add it, but the card shows nothing.
Same entry works fine for built-in Entities Card.

type: custom:banner-card
heading:
  - Bedroom
background: url("/local/images/bedroom.jpg")
entities:
  - entity: sensor.zwave_temp_bedroom_air_temperature
    name: Temperature
  - entity: sensor.zwave_temp_bedroom_humidity
    name: Humidity
  - entity: switch.zwave_plug_bedroom
    name: Purifier
  - type: custom:template-entity-row
    name: AC Power Rounded
    state: '{{ states.sensor.zwave_plug_ac_electric_consumed_w.state | round }}'

Can anyone help?

Just started learning this nice card, have a question about localized strings:

      - type: custom:template-entity-row
        name: name
        secondary: |
          {{ '_(ui.common.previous)'  }}
        icon: mdi:car

The result for the ā€œsecondaryā€ is ā€œBackā€.

Is it possible to do any operations with the localized string?
For example, I need smth like this:

          {{ '_(ui.common.previous)'.lower()  }}

to convert ā€œBackā€ to ā€œbackā€.
But it does not work since the ā€œ_()ā€ is resolved after the template works.

Can this be combined with the slider-entity-row?

Wondering if anyone had an experience with nested attributes? Iā€™ve got myself stuck here:

This worksā€¦

 - entity: sensor.rpi_monitor_piholeprimary
   name: Memory
   type: custom:template-entity-row
   state: |
     {{ states.sensor.rpi_monitor_piholeprimary.attributes['memory']['size_mb']}}

But this doesnā€™tā€¦

 - entity: sensor.rpi_monitor_piholeprimary
   name: Memory
   type: custom:template-entity-row
   state: |
     {{ states.config.entity.attributes['memory']['size_mb']}}

Could be argued that I should just use it the way it works, but this forms part of a template using the decluttering card which Iā€™m reusing. The entity is being passed in by the decluttering card (proven to work) so the use of config.entity is key for me.

If I just try to get the memory object that works fine both ways, just canā€™t get to the attributes of the memory.

Any pointers or suggestions really appreciated. Thanks!

if size_mb is part of the attributes memory object, you might want to try:

{{state_attr(config.entity,'memory').size_mb}}

ofc, test in dev tools with

{{state_attr('sensor.rpi_monitor_piholeprimary','memory').size_mb}}

to be sure

2 Likes

Brilliant thanks @Mariusthvdb - Iā€™d tried various combinations and just couldnā€™t get it. That works a treat thank you :slight_smile:

1 Like

I want to show the alexa timer as counter and have two questions:

a. This should be easier, but how? :wink:

{% set timer = strptime(states('sensor.echo_show_5_next_timer'),'%Y-%m-%dT%H:%M:%S%z')-now() %}
{% set sekunden = timer.seconds %}
{% set stunden = sekunden // 3600 %}
{% set sekunden = sekunden - (stunden * 3600) %}
{% set minuten = sekunden // 60 %}
{% set sekunden = sekunden - (minuten * 60 ) %}
{% if stunden >= 10 %}
  {% set stundentext = stunden ~ ":" %}
{% elif stunden > 0 %}
  {% set stundentext = 0 ~ stunden ~ ":" %}
{% endif %}
{{stundentext}}{{ minuten }}:{{ sekunden }}

Anyway, it is working, e.g. 22:12

b. Main question: But If I use this as state in this row, it is not updating every second. How is it possible to get it updated every second?