From 36d838ca8667e784a7cc4713be0c264510cb64ff Mon Sep 17 00:00:00 2001 From: ltadeu6 Date: Sun, 17 May 2026 15:00:02 -0300 Subject: [PATCH] Use numeric AC fan modes --- AGENTS.md | 3 ++- hosts/Nixos/configuration.nix | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 267bca3..08f5e12 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -620,7 +620,8 @@ Estado atual: - Entre 23 C e 28 C, o script usa pulsos planejados de `cool` com setpoint 22 C por ate 15 minutos, depois volta para `dry` por ate 40 minutos. - Acima de 28 C, o script nunca aquece; usa `cool` com setpoint 23 C por ate 20 minutos e depois `dry`. - O tempo maximo de execucao e 6 horas; ao expirar, o script desliga `climate.ar` e desliga `input_boolean.secar_roupas`. -- Fan mode e definido apenas se o valor existir em `state_attr('climate.ar', 'fan_modes')`; tenta `medium`/`high` e cai para `auto`. +- Fan mode e definido apenas se o valor existir em `state_attr('climate.ar', 'fan_modes')`; a integracao atual aceita niveis numericos `1..5`. +- O script usa fan `3` no `dry`, fan `4` no `cool` e fan `5` no `heat`, sempre com fallback para um nivel abaixo. Cuidados: diff --git a/hosts/Nixos/configuration.nix b/hosts/Nixos/configuration.nix index 2435473..7728407 100644 --- a/hosts/Nixos/configuration.nix +++ b/hosts/Nixos/configuration.nix @@ -37,7 +37,7 @@ let conditions = [{ condition = "template"; value_template = - "{{ '${preferred}' in (state_attr('${haAirConditioner}', 'fan_modes') or []) }}"; + "{{ '${preferred}' in ((state_attr('${haAirConditioner}', 'fan_modes') or []) | map('string') | list) }}"; }]; sequence = [ (haSetFanMode preferred) ]; } @@ -45,7 +45,7 @@ let conditions = [{ condition = "template"; value_template = - "{{ '${fallback}' in (state_attr('${haAirConditioner}', 'fan_modes') or []) }}"; + "{{ '${fallback}' in ((state_attr('${haAirConditioner}', 'fan_modes') or []) | map('string') | list) }}"; }]; sequence = [ (haSetFanMode fallback) ]; } @@ -53,27 +53,27 @@ let }; haDryCycle = [ (haSetHvacMode "dry") - (haSetFanModeIfAvailable "medium" "auto") + (haSetFanModeIfAvailable "3" "2") ]; haHeatEvaporationCycle = [ (haSetHvacMode "heat") (haSetTemperature 25) - (haSetFanModeIfAvailable "high" "auto") + (haSetFanModeIfAvailable "5" "4") ]; haHeatRecoveryCycle = [ (haSetHvacMode "heat") (haSetTemperature 24) - (haSetFanModeIfAvailable "high" "auto") + (haSetFanModeIfAvailable "5" "4") ]; haCoolPulse = [ (haSetHvacMode "cool") (haSetTemperature 22) - (haSetFanModeIfAvailable "medium" "auto") + (haSetFanModeIfAvailable "4" "3") ]; haHotRoomCoolPulse = [ (haSetHvacMode "cool") (haSetTemperature 23) - (haSetFanModeIfAvailable "medium" "auto") + (haSetFanModeIfAvailable "4" "3") ]; zenExtension = shortId: guid: { name = guid;