Merge pull request #1545 from benphelps/fix/hass-custom-label-support

Fix: support using docker labels for HASS widget custom
This commit is contained in:
shamoon 2023-05-25 23:20:59 -07:00 committed by GitHub
commit 1f85da934f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
}