-
Notifications
You must be signed in to change notification settings - Fork 34
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
Change/override plant entity name and option to hide species #102
base: master
Are you sure you want to change the base?
Conversation
src/flower-card.ts
Outdated
@@ -36,6 +36,10 @@ export default class FlowerCard extends LitElement { | |||
this._hass = hass; | |||
this.stateObj = this.config?.entity ? hass.states[this.config.entity] : undefined; | |||
|
|||
if (this.config?.name) { | |||
this.stateObj.attributes.friendly_name = this.config.name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really like to overwrite the values in the original object, as it might cause confusion in other parts of the code or while debugging other issues.
So I'd rather do it the other way. If config.name is not set, set it to friendly_name and then display config.name instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback, I already noticed some strange behavior due to overriding the original object.
I've changed the code to display name instead of friendly_name and use friendly_name if name is not set.
Please review the changed and cherry-pick, as the branches are conflicted now.
Thanks. |
If the issues mentioned above is fixed, I'll look at merging this |
Implements feature request from #98
Also adds an option to hide the species (which may be very long text and disturb dashboards with many small cards)