From 4948485c50fb64b186f65fb7c1c875f553a389c4 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Thu, 25 May 2023 23:15:45 -0700 Subject: [PATCH] Support using docker labels for HASS widget custom --- src/widgets/homeassistant/proxy.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/widgets/homeassistant/proxy.js b/src/widgets/homeassistant/proxy.js index 648525ef5..944d14d98 100644 --- a/src/widgets/homeassistant/proxy.js +++ b/src/widgets/homeassistant/proxy.js @@ -71,6 +71,14 @@ export default async function homeassistantProxyHandler(req, res) { let queries = defaultQueries; if (!widget.fields && widget.custom) { + if (typeof widget.custom === 'string') { + try { + widget.custom = JSON.parse(widget.custom) + } catch (error) { + logger.debug("Error parsing HASS widget custom label: %s", JSON.stringify(error)); + return res.status(400).json({ error: "Error parsing widget custom label" }); + } + } queries = widget.custom.slice(0, 4); }