Convert state-card-display to LitElement and use timestamp display#8150
Merged
spacegaier merged 6 commits intohome-assistant:devfrom Jan 14, 2021
Merged
Convert state-card-display to LitElement and use timestamp display#8150spacegaier merged 6 commits intohome-assistant:devfrom
spacegaier merged 6 commits intohome-assistant:devfrom
Conversation
Member
|
About the issue, the value can't be more to the left? |
bramkragten
reviewed
Jan 13, 2021
bramkragten
reviewed
Jan 13, 2021
bramkragten
reviewed
Jan 13, 2021
Comment on lines
+43
to
+50
| ${computeDomain(this.stateObj?.entity_id) === "sensor" && | ||
| this.stateObj.attributes.device_class === "timestamp" && | ||
| !UNAVAILABLE_STATES.includes(this.stateObj.state) | ||
| ? html` <hui-timestamp-display | ||
| .hass=${this.hass} | ||
| .ts=${new Date(this.stateObj.state)} | ||
| .format=${"datetime"} | ||
| ></hui-timestamp-display>` |
Member
There was a problem hiding this comment.
Can we do this inside computeStateDisplay?
Member
Author
There was a problem hiding this comment.
I had thought about but decided against because so far computeStateDisplay never returns any HTML but always only a string representation of the state and leaves the rest up to the caller.
bramkragten
reviewed
Jan 13, 2021
Member
Author
I will remove the |
bramkragten
reviewed
Jan 14, 2021
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
bramkragten
reviewed
Jan 14, 2021
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
bramkragten
approved these changes
Jan 14, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breaking change
Proposed change
Convert
state-card-displayto LitElement. Driving force behind the change was that I wanted to use thehui-timestamp-displayin it.Before:

After:

One minor issue: The datetime value is a bit too long and crosses into the padding area of the card, because it is classified as having a unit of measure which prevents wrapping. But without it, it looks slightly weird because of the comma at the end of the first line.
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: