Custom Secondary Info for Entities Card

Well this is the automation…

                  - entity: automation.update_abb_usage
                    type: 'custom:secondaryinfo-entity-row'
                    secondary_info: "[[ automation.update_abb_usage.attributes.last_triggered ]]"

Which looks like this:
image

But using the config template card I have this:

          - type: 'custom:config-template-card'
            variables:
              - states['automation.update_abb_usage'].attributes['last_triggered']
            entities:
              - sensor.abb_usage
            card:
              type: 'custom:hui-entities-card'
              title: Aussie Broadband Usage
              show_header_toggle: false
              entities:
                - entity: sensor.abb_usage
                  name: "${'Last Update Requested' +'\xa0'.repeat(5) + Number.parseInt((new Date().getTime() - new Date(vars[0])) / 60000)+ '\xa0' + 'minutes ago'}"
                  icon: mdi:clock

Which looks like this:
image

1 Like

Is there a way to selectively display or not display the secondary info?

I have this as an example:

If my device tracker is away I want it to display the zone I’m in. If I’m home I don’t want it to display anything at all since my zone would report home and so would the the state of the device tracker so the info would be redundant.

here is the template I tried but if I’m home the secondary info shows the word “null” instead of being blank:

secondary_info: "[[ if(device_tracker.life360_xxx.state == 'home', null, device_tracker.life360_xxx.state) ]]"

I realize that if I switch to the “person” component that use case resolves itself because the state of the person.xxx will show the state as the zone but there may be other uses for something like this so I figured I’d throw out the question while I have it in my mind.

Leaving it blank for a sensor works for me

{%- if states.device_tracker.jono_iphone_x.state == 'home'%}
        
{%- else -%}
    '{{ states.device_tracker.jono_iphone_x.state}}'
{%- endif -%}

So I guess you could use a similar idea for this.

I could see that working for a regular template sensor but I don’t think it will work for the type of template required for this custom component.

Will it? :thinking:

The two template styles are different.

I’m not sure about just adding it all in secondary_info (I’m not that good at templating), but how about creating the sensor in sensors.yaml

sensor:

  - platform: template
    sensors:

      life360_location:
        value_template: >-
          {%- if states.device_tracker.life360_xxx.state == 'home'%}
                  
          {%- else -%}
              '{{ states.device_tracker.life360_xxx.state}}'
          {%- endif -%}

And then add that sensor as secondary_info in lovelace_ui.yaml
type: "custom:secondaryinfo-entity-row"
secondary_info: "[[ sensor.life360_location.state ]]"

That could work as long as the template doesn’t complain about the lack of a valid entry under the “if” section. I’ve never tried that before so I don’t know what the result of that would be.

and you need to remove the quotation marks in the “else” portion around the {{ … }}.

Is there any way for this card to not remove the toggle? I’m using it on a remote entity, and it seems to be removing the ability to toggle. Any ideas?

you’re going to have to give us way more information than that.

config? screen shot of the problem area? anything?

Sorry,
When using this card, it seems to remove the toggle from a remote entity in an Entities card. Below is the config I’m using and the result. Is there any way to keep the toggle (like the “Bedroom” remote) while also having the secondary info row?

entities:
  - entity: remote.living_room
    type: 'custom:secondaryinfo-entity-row'
    secondary_info: >-
      Activity: [[ if(remote.living_room.attributes.current_activity ==
      "PowerOff", "None", remote.living_room.attributes.current_activity) ]]
  - entity: remote.bedroom
show_header_toggle: false
title: Remotes
type: entities

RemoteConfig

I see one problem with your config…

you have the second entity in the card as “- entity: remote.bedroom” change the config to this and see if it works:

entities:
  - entity: remote.living_room
    type: 'custom:secondaryinfo-entity-row'
    secondary_info: >-
      Activity: [[ if(remote.living_room.attributes.current_activity ==
      "PowerOff", "None", remote.living_room.attributes.current_activity) ]]
  - remote.bedroom
show_header_toggle: false
title: Remotes
type: entities

I just tried it with my entities and it worked fine for me. the toggle stayed for both entities.

Nope, that didn’t seem to work for me either. I did some digging, and it looks like card-tools (which this card uses) is missing the “remote” domain when creating the entity row. I submitted an issue for it, so hopefully that will resolve it eventually.

I’m glad you figured it out. Hopefully it will get resolved.

Hi all,

Does anyone know if the secondary info can be shown on entities in a glance card or entity filter card?

1 Like

I really like this card but it’s just too slow on iOS for me :frowning:

I am relativley new to Home Assistant, and i have followed the installation steps exactly as per https://github.com/custom-cards/secondaryinfo-entity-row but i get the feeling based on my previous experiences with custom components that there is information and steps missing in order to get this working.

I am unable to get this working and i keep getting an error:
“Custom element doesn’t exist: secondaryinfo-entity-row.”

If theres someone here who has this working, are you able to please post the complete full instructions. I have not previously installed the “Card Tools” prerequisite (even though i followed these instructions) and i am going to assume this is where the missing steps are?

Any help would be greatly appreciated

Is it possible to display 2 entities like this:
secondary_info: ‘[[ if(switch.master_room == on, “Daily:” sensor.master_room_lights_daily switch.masterroom, sensor.master_room_lights_daily) ]]’

  • So when the master room lights are on, display the sensor master room ALONG with the on or off switch status which will be ON. and if the master room lights are off, just display the single entity sensor

Is there a way to use multiple secondary info fields in one entity?

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