This commit is contained in:
Mateusz Gruszczyński
2026-09-15 18:47:20 +02:00
parent 7ffaba6c7a
commit 3d69e74319
37 changed files with 426 additions and 318 deletions
+2 -4
View File
@@ -143,7 +143,6 @@ function homeAssistantSettingsBodyFromForm(form) {
const raw = Object.fromEntries(new FormData(form));
const body = {
url: raw.ha_url,
default_entity_id: raw.ha_entity_id,
outdoor_entity_id: raw.ha_outdoor_entity_id,
sensor_stale_after_seconds: Math.max(60, Math.min(86400, Math.round(Number(raw.ha_sensor_stale_after_minutes || 5) * 60))),
allow_invalid_tls: form.ha_allow_invalid_tls.checked,
@@ -289,10 +288,9 @@ $('#haTest').addEventListener('click', async event => {
button.textContent = tr('settings.testingHa');
try {
await saveHomeAssistantSettings(form, false);
const entity = form.ha_entity_id.value || form.ha_outdoor_entity_id.value || null;
const result = await api('/api/integrations/home-assistant/test', { method: 'POST', body: { entity_id: entity } });
await api('/api/integrations/home-assistant/test', { method: 'POST' });
markFormClean(form);
toast(tr('toast.haTemperature', { temperature: result.temperature_c.toFixed(1) }));
toast(tr('toast.haConnected'));
} catch (error) { presentFormError(form, error); }
finally { button.disabled = false; button.textContent = idle; }
});