Custom Secondary Info for Entities Card

Did anyone figure out the way to format the date in the secondary info to display in the format of how many hours ago something was triggered or updated?

HI @MizterB,

Not sure if you’re still here, but would there be any chance of you checking this Secondaryinfo-entity-row throwing a null error? (since HA 2020) issue your card keeps throwing in this config?

Maybe its a user error, and if so please let me know. If not Please have a look at the issue I wrote in the GitHub? thanks.

Maybe its a card-tools thing? since Thomas Lovens’s card is mentioned/needed as resource, that could be of course, not sure who to ask first…

@darknebula Did you ever figure out how to format the date?

Hi everyone! I’m enjoying this plugin very much, I’ve gotten it to do exactly what I want for a few things in my instance of HA! I have a Shelly1PM with a temperature sensor add-on for my downstairs freezer, and showing both the freezer temp and the watts on one line is AWESOME.

I have 2 switches that I’m using this for. 1 switch is for my Pi-Hole instance, and I’m showing the days Adblock stats under the switch. I have another Shelly1PM in our bathroom on the GFCI outlets and I’m showing the Watts in the secondary info line for that one - it’s the “Did I leave anything on in the bathroom” peace of mind item for my wife!

My question is… does anyone know how to get the color of the icon to change with the state of the switch for these custom entities? As soon as I use this custom entity type, the icon no longer changes color when the switch is on. For example - in my screenshot I have the Master Bathroom Outlets on my dashboard twice - once as just a normal switch and the indicator works, and one as a custom entity that doesn’t work.

Just wondering what I’m missing?

This may not be the answer you’re looking for, but lovelace-template-entity-row by thomasloven allows you to define when the icon should be in an active state.

1 Like

As the original author of the SecondaryInfo card, I now also recommend lovelace-template-entity-row as well. It is actively maintained and more feature-complete.

5 Likes

Hey, thank you! I just got the lovelace-template-entity-row module installed, and it’s absolutely perfect. I now have a “Master Bathroom Outlets” switch on my dashboard, showing Watts for the secondary info, and the icon changes color when I toggle the switch.

Really appreciate your responding to me and all of the work you put into this module!

1 Like

Hey Guys, Im not sure if im doing something wrong or something broke the code in the latest update of HA, but here is a snippet of the code im using and what output im getting.
The last code is an example snippet i copied over to see if maybe my code is wrong and that still doesn’t work.

I have:

secondaryinfo-entity-row: Verion-5
resource used: /hacsfiles/battery-state-card/battery-state-card.js?hacstag=256292682211

card-tools: Verion-11
resourceused: /hacsfiles/lovelace-card-tools/card-tools.js?hacstag=16140332811

type: custom:battery-state-card
title: Battery levels
secondary_info: last_updated
color_gradient:
  - '#c0392b'
  - '#f39c12'
  - '#f1c40f'
  - '#2ecc71'
  - '#1abc9c'
entities:
  - entity: sensor.s20u_battery_level
    name: S20U
    type: custom:template-entity-row
    secondary_info: 'Charging: [[ sensor.s20u_battery_state.state'
  - entity: sensor.masterbedroom_power
    name: MasterBed Motion
  - entity: sensor.lumi_lumi_sensor_magnet_aq2_power
    name: Garage Door Sensor
  - entity: sun.sun
    name: Jinja2 template
    type: custom:secondaryinfo-entity-row
    secondary_info: 'Next Dawn: {{ state_attr(''sun.sun'', ''next_dawn'') }}'



Screenshot 2022-02-25 222648

You can try using lovelace-card-mod.

I think for the first one, you need to close the brackets:

secondary_info: 'Charging: [[ sensor.s20u_battery_state.state ]]'

Not sure about the second one. Confirm if the resources are added properly.

In a case like this… how would you remove the default secondary info–specifically, “Currently 74 °F”?

I have a few heat pumps. For two of them I just started using Sensibo, for which there’s a current_temperature attribute. My other heat pumps are using a different integration and don’t have that attribute… so I pull it from elsewhere. So now on the two Sensibo entities I have the current temperature duplicated. I’d like them to show up consistently if possible!

Does anyone have an example of using secondaryinfo-entity-row with auto-entities by chance? I cannot figure out how to make the two play nice together for the life of me. Thanks!

@thomasloven It sure would be nice to be able to use math somehow within [[ ]] and be able to divide by 2.55 there rather than having to create new templated sensors for every dimmable light you want to see as brightness_pct!

Tagging a person not a good way. Suggest you to create a FR in GitHub (link) for a needed functionality.

Hi Guys,
my Message starts like many others: I’m totally new to Home Assistant and it blows my mind! Sure I need some help with one thing or the other, as I’m coming from a totally different Smarthome mindset (FHEM, if somebody knows it).

I installed these great Custom Card, and it works fine with the provided samples, unfortunately with my own sensor it won’t.

image

Here is my YAML:

type: entities
title: Mülltonnen leerung
entities:
  - entity: sensor.srhh_leerung_rest
    name: Restmüll
    type: custom:secondaryinfo-entity-row
    secondary_info: [[ attribute:collection_date ]]

And just to be shure, here is the sensor creating the attribut I like to display:

- sensor:
      - name: "srhh.leerung.rest"
        state: >
           {% set daysTo = (as_timestamp(states('sensor.stadtreinigung_hamburg_zuhause_schwarze_restmulltonne')) | timestamp_custom('%Y-%m-%d', True) | as_datetime).date() - now().date() %}
           {% if daysTo.days == 0 %}heute{% elif daysTo.days == 1 %}morgen{% else %}in {{daysTo.days}} Tagen{% endif %}
        attributes:
           collection_date: "{{ as_timestamp(states('sensor.stadtreinigung_hamburg_zuhause_schwarze_restmulltonne')) | timestamp_custom('%Y-%m-%d') }}"

I’m running out of ideas, not even Google helped me with the messega I get

Any hints somebody?

Sorry guys for the off-topic, but it doesn’t seem like I’m able to PM mr. Romquenin :slight_smile:

May I ask how did you manage to get this kind of card with the badge displayed? I’m trying to create exactly the same card (Time to bus) as you showed there with info in the badge, but failing miserably…
I do have custom-ui installed and currently displaying sensors in “entities” type card with additional info in custom:secondaryinfo-entity-row type entity. Tried adding “extra_badge” attribute all around, but without any luck.
Could you share your card config maybe?
Thanks a zillion!

Imho that was a MS Paint …

I hope not :slight_smile: seen similar cards e.g. here, but can’t figure out how this UI magic works :smiley:

A similar may be achieved by multiple-entity-row.

Had a brief look at that repo; a code posted in “ui-lovelace” does not have any badges.

aha! thanks Ildar! that’s an interesting card. seems like it does mention rendering state-badge component in the code, just not exactly sure yet it if it visually looks like a badge there :smiley: will have to give it a run :slight_smile: