From b8901ce9deb46490d273bef412e0680401a7ae07 Mon Sep 17 00:00:00 2001 From: tempus2016 Date: Mon, 11 May 2026 13:21:00 +0000 Subject: [PATCH] fix(panel): coerce numeric settings via type attribute, not property ha-textfield doesn't reliably reflect type="number" onto el.type, so the "number" branch in _doSaveSettings was being skipped and values were sent to the WS schema as strings. The backend uses vol.All(int, ...) which rejects strings, causing 'expected int for dictionary value' errors when saving Settings (history_days, perfect_week_bonus, calendar_projection_days). Read the type via getAttribute() with el.type as a fallback so both native inputs and ha-textfield wrappers route correctly. Fixes #350 --- custom_components/taskmate/www/taskmate-panel.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/custom_components/taskmate/www/taskmate-panel.js b/custom_components/taskmate/www/taskmate-panel.js index 709676a..05638d3 100644 --- a/custom_components/taskmate/www/taskmate-panel.js +++ b/custom_components/taskmate/www/taskmate-panel.js @@ -1213,9 +1213,10 @@ class TaskMatePanel extends HTMLElement { const payload = { type: "taskmate/update_settings" }; fields.forEach(el => { const name = el.dataset.setting; + const declaredType = el.getAttribute("type") || el.type; let v; - if (el.type === "checkbox" || el.tagName === "HA-SWITCH") v = el.checked; - else if (el.type === "number") v = el.value === "" ? undefined : Number(el.value); + if (declaredType === "checkbox" || el.tagName === "HA-SWITCH") v = el.checked; + else if (declaredType === "number") v = el.value === "" ? undefined : Number(el.value); else v = el.value; if (v !== undefined) payload[name] = v; });