-
Notifications
You must be signed in to change notification settings - Fork 119
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
Add the time domain (time entities) to the list of standard configuration actions #808
base: main
Are you sure you want to change the base?
Conversation
let timePickerHeader = ''; | ||
if (!this.timeslots) { | ||
timePickerHeader = this.hass.localize('ui.dialogs.helper_settings.input_datetime.time'); | ||
if (this.entities?.[0].id.startsWith('time')) | ||
timePickerHeader += ` (${localize('ui.panel.common.title', getLocale(this.hass))})`; | ||
} |
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.
This timePickerHeader
logic changes the section title from "TIME" to "TIME (SCHEDULER)" to help disambiguate between the two time sections — see red arrows in the screenshots below. This only applies when the selected entity is a time entity. If the user selected a different entity, say switch, the section title remains as before, i.e. simply "TIME".
let header: string = variable.name || PrettyPrintName(field); | ||
if (header.toLowerCase() === 'time') { | ||
const entity = this.entities?.[0]; | ||
if (entity) header += ` (${PrettyPrintName(this.getEntityName(entity))})`; | ||
} |
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.
This header
logic changes the section title from "TIME" to "TIME (<entity name>)" to help disambiguate between the two time sections — see red arrows in the screenshots below. This only applies when the selected entity is a time entity. If the user selected a different entity, say switch, the section title remains as before (not including the entity name).
return html` | ||
<ha-time-input | ||
.enableSecond=${variable.enable_seconds} | ||
.value=${value} | ||
.locale=${this.hass.locale} | ||
@value-changed=${this.listVariableUpdated} | ||
></ha-time-input> | ||
<div class="key">${variable.enable_seconds ? 'Hours:Minutes:Seconds' : 'Hours:Minutes'}</div> | ||
`; |
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.
The choice of the <ha-time-input>
component can be argued. My reasoning for not using the <time-picker>
component (which is used to set / edit the scheduler time) was simply to visually differentiate between the two time sections (see other comments). Users would be used to the <time-picker>
component for setting the scheduler time and they would also be used to the <ha-time-input>
component for editing HA time entities.
I'm impressed with your efforts, the PR looks pretty good to me. |
That’s all right. I take comfort in knowing that you seem happy to incorporate this feature in principle. I had originally planned to discuss it before any implementation, 😇 and I thought it should include “photoshopping” what the time editor screen might look like. But then I thought: “Why don’t just do a quick hack of the time editor screen on its own, just to load a <ha-time-input> component there?” “Would that even be possible?” “Do custom cards have the ability of instantiating just any HA frontend component?” ”How would I even go about hacking it?” I actually had so many questions as I had never worked on a frontend project before, and I was really curious. So I just started playing with the code a bit, not planning on any large implementation, but each small step led to more questions and further small steps to answer those questions... “Now I’ve come this far, might as well finish it!” I had no idea that the final solution would involve touching so many files, honestly I initially thought I’d have to change “just a few HTML templates” — because that’s what a custom card is, right? 😄 How hard could that possibly be? 😅 By the way, I now appreciate so much more the effort that you put in creating this custom card. There is so much logic in it that end users are just oblivious to. On behalf of clueless end users, thank you! 🙏 Meanwhile, I am already using this feature through my fork of your repo, so in any event I am already benefiting from it. 🙂 |
This pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days |
f0e56df
to
9811197
Compare
Rebased on the |
This pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days |
This pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days |
This pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days |
This pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days |
This pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days |
This pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days |
This pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days |
This pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days |
Bump |
This PR addresses issue #807. Please check that issue’s description for background information (use cases, justification).
Screenshots of what this PR achieves
Scheduler Card Configuration — Included Entities
Before this PR, time entities were not listed — there wasn’t a ‘time’ row in the screenshot below. After this PR, the ‘time’ row is listed, allowing time entities to be selected.
New Schedule - Entity Editor - Time Entity
New Schedule - Time Editor - Time Entity - Set Value
New Schedule - Time Editor - Time Entity - Make Scheme
Scheduler Card - Configured Entities - Time Entity