Skip to content

Commit

Permalink
v2.3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsfaber committed Sep 17, 2022
1 parent 5b7d19b commit 871e729
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 141 deletions.
270 changes: 137 additions & 133 deletions dist/scheduler-card.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/const.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CardConfig } from './types';

export const CARD_VERSION = 'v2.3.6';
export const CARD_VERSION = 'v2.3.7';

export const DefaultTimeStep = 10;

Expand Down
4 changes: 2 additions & 2 deletions src/data/actions/compute_action_display.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export function computeActionDisplay(action: Action) {
const res = parameterPattern.exec(string);
if (!res) return string;

const hasWildcard = res[1].match(wildcardPattern)?.map(e => Object.keys(action.service_data || {}).includes(e[1]));

const field = res[1].match(wildcardPattern)![1];
const hasWildcard = Object.keys(action.service_data || {}).includes(field);
if (hasWildcard) string = string.replace(res[0], replaceWildcards(res[1]));
else string = string.replace(res[0], '');
if (recursionDepth >= MAX_RECURSION_DEPTH) return string;
Expand Down
5 changes: 3 additions & 2 deletions src/scheduler-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ export class SchedulerCard extends LitElement {

firstUpdated() {
const hass = this._hass!;
if (hass.localize('ui.panel.config.automation.editor.actions.name')) this.translationsLoaded = true;
if (hass.localize('ui.panel.config.automation.editor.actions.type.device_id.action'))
this.translationsLoaded = true;
else {
const el = document.querySelector('home-assistant') as HTMLElement & { _loadFragmentTranslations: any };
el._loadFragmentTranslations(hass.language, 'config').then(() => {
Expand All @@ -86,7 +87,7 @@ export class SchedulerCard extends LitElement {
protected shouldUpdate(changedProps: PropertyValues): boolean {
const oldHass = changedProps.get('_hass') as HomeAssistant | undefined;
if (oldHass && changedProps.size == 1) {
if (!oldHass.localize('ui.panel.config.automation.editor.actions.name')) {
if (!oldHass.localize('ui.panel.config.automation.editor.actions.type.device_id.action')) {
this.translationsLoaded = true;
return true;
} else if (this._view == EViews.Overview) return true;
Expand Down
4 changes: 3 additions & 1 deletion src/views/scheduler-entitypicker-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ export class SchedulerEditorCard extends LitElement {
: localize('ui.panel.entity_picker.no_entities_for_group', getLocale(this.hass))}
</button-group>
<div class="header">${this.hass.localize('ui.panel.config.automation.editor.actions.name')}</div>
<div class="header">
${this.hass.localize('ui.panel.config.automation.editor.actions.type.device_id.action')}
</div>
<button-group
.items=${actions}
.value=${actions.findIndex(e => isEqual(e, this.selectedAction))}
Expand Down
6 changes: 4 additions & 2 deletions src/views/scheduler-timepicker-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ export class SchedulerTimepickerCard extends LitElement {
<ha-icon-button .path=${mdiClose} @click=${this.cancelClick}> </ha-icon-button>
</div>
<div class="card-content">
<div class="header">${this.hass.localize('ui.panel.config.automation.editor.actions.name')}</div>
<div class="header">
${this.hass.localize('ui.panel.config.automation.editor.actions.type.device_id.action')}
</div>
${this.renderSummary()}
${!this.timeslots
? html`
Expand Down Expand Up @@ -238,7 +240,7 @@ export class SchedulerTimepickerCard extends LitElement {
: null;

return html`
<div class="header">${this.hass.localize('ui.panel.config.automation.editor.actions.name')}</div>
<div class="header">${this.hass.localize('ui.panel.config.automation.editor.actions.type.device_id.action')}</div>
<button-group
.items=${this.activeEntry !== null ? this.actions : []}
.value=${selectedAction !== null
Expand Down

0 comments on commit 871e729

Please sign in to comment.