diff --git a/src/apexcharts-card.ts b/src/apexcharts-card.ts index 88fba11..4b65b5a 100644 --- a/src/apexcharts-card.ts +++ b/src/apexcharts-card.ts @@ -259,7 +259,11 @@ class ChartsCard extends LitElement { delete (configDup as any).entities; } configDup = configDup as ChartCardExternalConfig; - if (configDup.config_templates && configDup.config_templates.length > 0) { + if (configDup.config_templates) { + configDup.config_templates = + configDup.config_templates && Array.isArray(configDup.config_templates) + ? configDup.config_templates + : [configDup.config_templates]; configDup = mergeConfigTemplates(getLovelace(), configDup); } try { diff --git a/src/types-config-ti.ts b/src/types-config-ti.ts index 3da8b12..06824c4 100644 --- a/src/types-config-ti.ts +++ b/src/types-config-ti.ts @@ -6,7 +6,7 @@ import * as t from "ts-interface-checker"; export const ChartCardExternalConfig = t.iface([], { "type": t.lit('custom:apexcharts-card'), - "config_templates": t.opt(t.array("string")), + "config_templates": t.opt(t.union(t.array("string"), "string")), "color_list": t.opt(t.array("string")), "locale": t.opt("string"), "experimental": t.opt(t.iface([], { diff --git a/src/types-config.ts b/src/types-config.ts index 83feeeb..5de6e3f 100644 --- a/src/types-config.ts +++ b/src/types-config.ts @@ -1,6 +1,6 @@ export interface ChartCardExternalConfig { type: 'custom:apexcharts-card'; - config_templates?: string[]; + config_templates?: string[] | string; color_list?: string[]; locale?: string; experimental?: {