Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into from

Conversation

BenniG82
Copy link

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

This change allows to use all direct properties of an stateObj to be used as secondary_info. This is useful to support custom formatting for last-changed/last-updated
@BenniG82
Copy link
Author

BenniG82 commented Sep 14, 2022

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

@piketres
Copy link

piketres commented Feb 2, 2023

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

@benct
Copy link
Owner

benct commented May 30, 2023

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 benct closed this May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants