Skip to content

Commit

Permalink
Remove alarm modes list when adding a alarm modes card feature (#20688)
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya authored May 2, 2024
1 parent b2797ab commit deda200
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/panels/lovelace/card-features/hui-alarm-modes-card-feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ import "../../../components/ha-control-select";
import type { ControlSelectOption } from "../../../components/ha-control-select";
import "../../../components/ha-control-slider";
import {
ALARM_MODES,
AlarmControlPanelEntity,
AlarmMode,
ALARM_MODES,
supportedAlarmModes,
} from "../../../data/alarm_control_panel";
import { UNAVAILABLE } from "../../../data/entity";
import { showEnterCodeDialog } from "../../../dialogs/enter-code/show-enter-code-dialog";
import { HomeAssistant } from "../../../types";
import { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types";
import { AlarmModesCardFeatureConfig } from "./types";
import { showEnterCodeDialog } from "../../../dialogs/enter-code/show-enter-code-dialog";
import { filterModes } from "./common/filter-modes";
import { AlarmModesCardFeatureConfig } from "./types";

export const supportsAlarmModesCardFeature = (stateObj: HassEntity) => {
const domain = computeDomain(stateObj.entity_id);
Expand All @@ -43,15 +43,9 @@ class HuiAlarmModeCardFeature

@state() _currentMode?: AlarmMode;

static getStubConfig(_, stateObj?: HassEntity): AlarmModesCardFeatureConfig {
static getStubConfig(): AlarmModesCardFeatureConfig {
return {
type: "alarm-modes",
modes: stateObj
? (Object.keys(ALARM_MODES) as AlarmMode[]).filter((mode) => {
const feature = ALARM_MODES[mode as AlarmMode].feature;
return !feature || supportsFeature(stateObj, feature);
})
: [],
};
}

Expand Down

0 comments on commit deda200

Please sign in to comment.