Skip to content

Commit 6af53c1

Browse files
committed
Fix bug when passing entities as strings
1 parent 041722d commit 6af53c1

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/plotly-graph-card.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ export class PlotlyGraph extends HTMLElement {
206206
refresh_interval: config.refresh_interval ?? 0,
207207

208208
entities: config.entities.map((entityIn, entityIdx) => {
209+
if (typeof entityIn === "string") entityIn = { entity: entityIn };
209210
if ("statistic" in entityIn || "period" in entityIn) {
210211
const validStatistic = ["mean", "min", "max", "sum"].includes(
211212
entityIn.statistic || ""
@@ -233,11 +234,9 @@ export class PlotlyGraph extends HTMLElement {
233234
},
234235
},
235236
config.defaults?.entity,
236-
typeof entityIn === "string" ? { entity: entityIn } : entityIn,
237+
entityIn,
237238
{
238239
show_value: entityIn.show_value ?? false,
239-
},
240-
{
241240
lambda: entityIn.lambda ? window.eval(entityIn.lambda) : undefined,
242241
}
243242
);

0 commit comments

Comments
 (0)