Custom Secondary Info for Entities Card

In case you haven’t figured it out yet, or if someone is reading this after searching for the same thing, here is an example of using multiple secondary_info fields in one entity:

- type: entities
  title: Custom Secondary Info
  show_header_toggle: false
  entities:
    - entity: sun.sun
      name: Templated entity object
      type: "custom:secondaryinfo-entity-row"
      secondary_info: '[[ if({entity}.attributes.elevation < 0, "Below", "Above") ]] the horizon<br>Next Dawn: [[ {entity}.attributes.next_dawn ]]'

Here is what it looks like:
10_22_19%20%409_30_34

As you can see here, the yaml is typed as a single entry. However, we are displaying it as two separate secondary_info fields by separating them with <br>, which is the html tag for a line break.

6 Likes

The next question is;
How to properly format the date/time to something human readable?!

Tried some stuff, but getting all sorts of errors… Did you figured is out?

off top of head something like

[[ {entity}.attributes.next_dawn  | timestamp_custom('%D %-I:%M %P') ]]

waiting for my line to start up

Hi,
Just installed and getting the following message:

“Expected a value type…”

Am I doing something wrong?

Thanks,

Hi,

I am getting same error… did you solve this?

not yet, but I filed a feature request: Add secondary_info: last-triggered for entities-card

maybe that would be of use in this card also? If so, please bump the FR… :wink:

Has anyone managed to combine a template with a string in the then or else fields?
My code looks like this:

- entity: sensor.ha_installed_version
  type: "custom:secondaryinfo-entity-row"
  secondary_info: '[[ if({entity}.state == sensor.ha_available_version.state , "Up to date" , "New version available: [[ sensor.ha_available_version.state ]]") ]]'

Unfortunately, this results in a “Template matching failed” error.

I can replace "New version available: [[ sensor.ha_available_version.state ]]"
with either "New version available: " or just sensor.ha_available_version.state, both of which work. But I cannot seem to figure out how to concatenate the two.

@kikon_kike You were trying to achieve the exact same thing as me. Did you ever work it out?
@iptvcld It seems you were trying something similar. Have you had any luck?

I think it would probably be simpler (easier?) to create a ‘regular’ template sensor with the if statements, and then add that sensor to secondary_info rather than trying to do it all in secondary_info.

For some reason, I’m getting the same error here, it worked perfectly fine a few days ago…

Could you share the template that was working for you?

Is it possible to fix that issue https://github.com/custom-cards/secondaryinfo-entity-row/issues/20 ?

Here is my example that doesn’t work :frowning:

card:
  show_header_toggle: false
  title: Rachunki
  type: entities
filter:
  include:
    - entity_id: variable.*
      options:
        secondary_info: >-
          Do zapłaty: <b style='color:[[ if({entity}.attributes.czy_oplacony ==
          'nie', 'green', 'red') ]]'>[[ {entity}.attributes.do_zaplaty ]]</b>
        type: 'custom:secondaryinfo-entity-row'
sort:
  method: state
type: 'custom:auto-entities'

Hi all,

I updated Home assistant to 106.5 and now all my entities that where using secondaryinfo-entity-row are not working and display this message:

Old version of card-tools found. Get the latest version of card-tools.js from https://github.com/thomasloven/lovelace-card-tools

I installed the custom components using HACS.

The problem is related to the fact that the developer need to fix this custom components or do I have to change somenthing?

Thanks

Install card-tools 2.1.1 manually and change the ressource in Lovelace.
I don’t know why this version is not installable with HACS.

Thanks for the help!

I solved manually installing card-tools as you suggested.

However after the install I had to delete the cache in the browser and secondaryinfo-entity-row started to work again.

is there any way to format the time stamp?

this is not working for me:

[[ {entity}.attributes.next_dawn  | timestamp_custom('%D %-I:%M %P') ]]
1 Like

Is it possible to do simple calculations on state or attribute values? (e.g. subtract a static amount of time from a date)

You need to convert it to a timestamp first.

{{ as_timestamp(states.sun.sun.attributes.next_dawn)  | timestamp_custom('%D %-I:%M %P') }}

works in the template editor.

There are multiple examples in the repository

I tried your suggestion, but this it’s not working for me:

type: "custom:secondaryinfo-entity-row"
secondary_info: "Last Update: [[ {{ as_timestamp(states.sensor.MYSENSORID.attributes.time) | timestamp_custom('%D %-I:%M %P') }} ]]"

However

{{ as_timestamp(states.sensor.MYSENSORID.attributes.time) | timestamp_custom('%D %-I:%M %P') }}

is working well in the template page under developer tools.

I reed here that secondary info don’t support jinja. So I think that’s the problem.

Is anyone using this with popup cards?

If I click on the state I get the popup I’ve defined but if I click on the name I get the more-info card.

eg

image

Clicking on the ‘8.0’ gives me my popup:

image

Clicking on ‘Number of zones defined’ gives me more-info:

image

type: custom:multiple-entity-row
entity: input_number.irrigation_number_of_zones
name: Number of zones defined
tap_action:
  action: call-service
  service: browser_mod.popup
  service_data:
    title: Number of zones defined
    card:
      type: entities
      entities:
        - entity: input_number.irrigation_number_of_zones
          name: ' '
    deviceID:
      - this
    style:
      font-family: Oswald
      font-size: 14px
      box-shadow: 0em 0em 0.5em
      opacity: 0.9