lovelace-multiple-entity-row icon indicating copy to clipboard operation
lovelace-multiple-entity-row copied to clipboard

#221: Support last-changed/last-updated as secondary_info attribute

Open BenniG82 opened this issue 2 years ago • 1 comments

This change allows to use all direct properties of an stateObj as secondary_info. This is useful to support custom formatting for last-changed/last-updated

Config-Example:

entity: binary_sensor.my_sensor
name: Main Door
type: custom:multiple-entity-row
secondary_info:
  attribute: last_changed
  format: datetime

image

BenniG82 avatar Sep 14 '22 19:09 BenniG82

Maybe it would make sense to also change entityStateDisplay in entity.js? The following line also does not allow us to use last_changed/last_updated:

let value = config.attribute ? stateObj.attributes[config.attribute] : stateObj.state;

could be changed to

    let value = config.attribute
        ? stateObj.attributes[config.attribute] ?? stateObj.attributes[config.attribute]
        : stateObj.state;

If you like I can add this change to the PR

BenniG82 avatar Sep 14 '22 20:09 BenniG82

Hello! Is there a reason for this PR not being merged or just that it´s an outdated repo no longer being maintained?

piketres avatar Feb 02 '23 14:02 piketres

These changes has unfortunately resulted in some conflicts with other PRs, so I'll try to add it manually for the next release. Thanks.

benct avatar May 30 '23 13:05 benct