From 91054c9d774f226fb9d91824fc89c047ad0b2d27 Mon Sep 17 00:00:00 2001 From: Bartosz Dokurno Date: Sat, 20 May 2023 13:10:53 +0200 Subject: [PATCH] Fix `hide_when_no_warning` --- src/meteoalarm-card.ts | 4 ++-- src/predefined-cards.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/meteoalarm-card.ts b/src/meteoalarm-card.ts index dc468a0..6cd2e61 100644 --- a/src/meteoalarm-card.ts +++ b/src/meteoalarm-card.ts @@ -278,9 +278,9 @@ export class MeteoalarmCard extends LitElement { ); // Handle hide_when_no_warning - if(events.length == 0 && this.config.hide_when_no_warning) { + if(events.every(e => !e.isActive) && this.config.hide_when_no_warning) { // eslint-disable-next-line no-console - console.log('MeteoalarmCard: Card is hidden since hide_when_no_warning is enabled and there are no warnings'); + console.log('MeteoalarmCard: Card is hidden - hide_when_no_warning is enabled and there are no warnings'); this.setCardMargin(false); return html``; } diff --git a/src/predefined-cards.ts b/src/predefined-cards.ts index 65577c9..ebbbfc4 100644 --- a/src/predefined-cards.ts +++ b/src/predefined-cards.ts @@ -6,7 +6,7 @@ import { MeteoalarmAlertParsed, MeteoalarmLevelType } from './types'; export class PredefinedCards { public static unavailableCard(): MeteoalarmAlertParsed { return { - isActive: false, + isActive: true, entity: undefined, icon: 'cloud-question', color: MeteoalarmData.getLevel(MeteoalarmLevelType.None).color,