Filter out unavailable calendars in calendar panel (#14584)
This commit is contained in:
parent
076a6c4459
commit
b06db26540
|
@ -2,6 +2,7 @@ import { getColorByIndex } from "../common/color/colors";
|
|||
import { computeDomain } from "../common/entity/compute_domain";
|
||||
import { computeStateName } from "../common/entity/compute_state_name";
|
||||
import type { HomeAssistant } from "../types";
|
||||
import { UNAVAILABLE_STATES } from "./entity";
|
||||
|
||||
export interface Calendar {
|
||||
entity_id: string;
|
||||
|
@ -134,7 +135,11 @@ const getCalendarDate = (dateObj: any): string | undefined => {
|
|||
|
||||
export const getCalendars = (hass: HomeAssistant): Calendar[] =>
|
||||
Object.keys(hass.states)
|
||||
.filter((eid) => computeDomain(eid) === "calendar")
|
||||
.filter(
|
||||
(eid) =>
|
||||
computeDomain(eid) === "calendar" &&
|
||||
!UNAVAILABLE_STATES.includes(hass.states[eid].state)
|
||||
)
|
||||
.sort()
|
||||
.map((eid, idx) => ({
|
||||
entity_id: eid,
|
||||
|
|
Loading…
Reference in New Issue