Skip to content

Commit

Permalink
show error when schedule is defective
Browse files Browse the repository at this point in the history
  • Loading branch information
niels committed Dec 23, 2020
1 parent a780c8f commit 6f87ae2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/custom-elements/scheduler-entity-row.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ export class ScheduleEntityRow extends LitElement {
@property() config!: CardConfig;

render() {
if (!this.schedule.next_entries.length) {
return html`
<hui-warning>
Defective schedule entity: ${this.schedule.entity_id}
</hui-warning>
`;
}
const nextEntry = this.schedule.timeslots[this.schedule.next_entries[0]];
const entities = unique(nextEntry.actions.map(e => e.entity_id)).map(e => parseEntity(e, this.hass, this.config));
const entityIcon = unique(entities.map(e => e.icon)).length == 1
Expand Down Expand Up @@ -253,5 +260,8 @@ export class ScheduleEntityRow extends LitElement {
ha-switch {
padding: 13px 5px;
}
hui-warning {
flex: 1 0 40px;
}
`;
}

0 comments on commit 6f87ae2

Please sign in to comment.