Dont parse castom cards. Hide unsupported

This commit is contained in:
Yegor Vialov 2020-05-08 12:36:13 +00:00
parent 1670c8e505
commit 4d4add4581
2 changed files with 20 additions and 5 deletions

View File

@ -20,15 +20,25 @@ class CardData {
} }
switch (rawData['type']) { switch (rawData['type']) {
case CardType.ENTITIES: case CardType.ENTITIES:
case CardType.HISTORY_GRAPH:
case CardType.MAP:
case CardType.PICTURE_GLANCE:
case CardType.SENSOR:
case CardType.ENTITY:
case CardType.WEATHER_FORECAST:
case CardType.PLANT_STATUS:
if (rawData['entity'] != null) {
rawData['entities'] = [rawData['entity']];
}
return EntitiesCardData(rawData); return EntitiesCardData(rawData);
break; break;
case CardType.ALARM_PANEL: case CardType.ALARM_PANEL:
return AlarmPanelCardData(rawData); return AlarmPanelCardData(rawData);
break; break;
case CardType.BUTTON:
return ButtonCardData(rawData);
break;
case CardType.ENTITY_BUTTON: case CardType.ENTITY_BUTTON:
case CardType.LIGHT:
case CardType.BUTTON:
case CardType.PICTURE_ENTITY:
return ButtonCardData(rawData); return ButtonCardData(rawData);
break; break;
case CardType.CONDITIONAL: case CardType.CONDITIONAL:
@ -47,6 +57,10 @@ class CardData {
return GaugeCardData(rawData); return GaugeCardData(rawData);
break; break;
case CardType.GLANCE: case CardType.GLANCE:
case CardType.THERMOSTAT:
if (rawData['entity'] != null) {
rawData['entities'] = [rawData['entity']];
}
return GlanceCardData(rawData); return GlanceCardData(rawData);
break; break;
case CardType.HORIZONTAL_STACK: case CardType.HORIZONTAL_STACK:
@ -61,8 +75,6 @@ class CardData {
case CardType.MEDIA_CONTROL: case CardType.MEDIA_CONTROL:
return MediaControlCardData(rawData); return MediaControlCardData(rawData);
break; break;
//TODO make all other official Lovelace cards as Entities
//All other cards should be unsupported and not shown
default: default:
return CardData(null); return CardData(null);
} }

View File

@ -113,6 +113,7 @@ class CardType {
static const IFRAME = "iframe"; static const IFRAME = "iframe";
static const GAUGE = "gauge"; static const GAUGE = "gauge";
static const ENTITY_BUTTON = "entity-button"; static const ENTITY_BUTTON = "entity-button";
static const ENTITY = "entity";
static const BUTTON = "button"; static const BUTTON = "button";
static const CONDITIONAL = "conditional"; static const CONDITIONAL = "conditional";
static const ALARM_PANEL = "alarm-panel"; static const ALARM_PANEL = "alarm-panel";
@ -120,6 +121,8 @@ class CardType {
static const LIGHT = "light"; static const LIGHT = "light";
static const ENTITY_FILTER = "entity-filter"; static const ENTITY_FILTER = "entity-filter";
static const UNKNOWN = "unknown"; static const UNKNOWN = "unknown";
static const HISTORY_GRAPH = "history-graph";
static const PICTURE_GLANCE = "picture-glance";
} }
class Sizes { class Sizes {