Skip to content

Commit

Permalink
dix: don't display disarm button is no states selected (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya committed Feb 6, 2022
1 parent b854f5e commit d2209d8
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,12 @@ export class AlarmControlPanelCard extends LitElement implements LovelaceCard {
mainEntity.state
) >= 0;

const actions: ActionButtonType[] = isDisarmed(mainEntity)
? this._config.states?.map((state) => ({ state })) || []
: [{ state: "disarmed" }];
const actions: ActionButtonType[] =
this._config.states && this._config.states.length > 0
? isDisarmed(mainEntity)
? this._config.states.map((state) => ({ state }))
: [{ state: "disarmed" }]
: [];

const isActionEnabled = isActionsAvailable(mainEntity);

Expand Down

0 comments on commit d2209d8

Please sign in to comment.