benct / lovelace-multiple-entity-row

Show multiple entity states and attributes on entity rows in Home Assistant's Lovelace UI
MIT License
768 stars 55 forks source link

Add support for showing entity output for secondary_info #316

Closed andreas-bulling closed 9 months ago

andreas-bulling commented 9 months ago

Various pre-defined information can be shown in secondary_info but what does not seem to be possible is to show values/states of an entity or template sensor - in my case the charging state of a battery. When I put sensor.battery_status for secondary_info it shows that exact string instead of the status itself.

ildar170975 commented 9 months ago

When I put sensor.battery_status for secondary_info it shows that exact string instead of the status itself.

Post a SHORT code with your attempt to show a state in the secondary_info.

andreas-bulling commented 9 months ago

This is the template sensor (battery_status):

{% if states('sensor.victron_vebus_battery_current_227') | float < 0 %}
  Discharging
{% elif states('sensor.victron_vebus_battery_current_227') | float > 0 %}
  Charging
{% else %}
  Standby
{% endif %}

And this is the bit in the frontend

type: vertical-stack
cards:
  - type: custom:multiple-entity-row
    name: Battery
    entity: sensor.victron_battery_soc
    show_state: false
    state_color: true
    secondary_info: sensor.battery_status
    entities:
      - entity: sensor.victron_vebus_battery_current_227
        name: Current
        format: precision1
        styles:
          font-size: 20px
      - entity: sensor.victron_battery_voltage
        name: Voltage
        format: precision2
        styles:
          font-size: 20px
      - entity: sensor.victron_battery_soc
        name: SOC
        format: precision1
        styles:
          font-size: 20px
ildar170975 commented 9 months ago

Your code does not show a state in secondary_info because this part is wrong. Check docs.

secondary_info:
  entity: sensor.battery_status

Suggest to ask similar questions in the dedicated community thread and leave GitHub for reporting bugs and proposing FRs.

andreas-bulling commented 9 months ago

Thanks for the hint. I did go through the documentation in detail and tried many things. After I failed I thought it might be a bug and opened the issue. Maybe an example for how to use an entity this way would help.