-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Ensure timer row uses correct state translation keys #9143
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
Merged
bramkragten
merged 5 commits into
home-assistant:dev
from
spacegaier:timer-row-translation
May 24, 2021
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b2a9dae
Ensure timer row uses correct state translation keys
spacegaier c4de695
Changes from review
spacegaier d5eca0b
Update src/panels/lovelace/entity-rows/hui-timer-entity-row.ts
spacegaier 07b447c
Merge branch 'dev' of https://github.com/home-assistant/frontend into…
spacegaier 3982aa3
Move logic to data/timer
spacegaier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
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.
Use
computeStateDisplayso we don't have this again if we change logic there :-)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.
Made the change, but that lead me to something else: The more-info dialog also was not aligned, which I fixed now, but that meant duplicating code. But since the
computeStateDisplay()function does only accept astateObjwe cannot pass the remaining seconds to make it completely capsuled incomputeStateDisplay().We could add an optional parameter to
computeStateDisplay()for a generic value to be provided by the caller and to be used in the domain specific handling fortimerthen.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.
Isn't it the same as
stateObj.attributes.duration?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 think so.
stateObj.attributes.durationis the defined runtime that this timer runs to reach 0.timeRemainingis the remaining seconds from the start of the timer until the duration is reached.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.
Yeah I meant
stateObj.attributes.remainingThere 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.
Does not work, because the backend attribute does only get updated when the timers pauses (and perhaps periodically?), but not each second as the frontend needs it to. The "live"
timeRemainingis only known in the frontend.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.
OK, let's move it to
data/timerthenThere 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.
timerTimeRemainingshould move there too btwThere 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.
Code is moved. Have a look if that is what you had in mind.