Support using docker labels for HASS widget custom
This commit is contained in:
parent
fc668aa9d0
commit
4948485c50
1 changed files with 8 additions and 0 deletions
|
@ -71,6 +71,14 @@ export default async function homeassistantProxyHandler(req, res) {
|
||||||
|
|
||||||
let queries = defaultQueries;
|
let queries = defaultQueries;
|
||||||
if (!widget.fields && widget.custom) {
|
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);
|
queries = widget.custom.slice(0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue