From 591e66b2088b9e8f160cd73fa1fb555184d38e5d Mon Sep 17 00:00:00 2001 From: rzen Date: Sun, 6 Sep 2026 07:11:26 -0400 Subject: [PATCH] Use the abs filter instead of an abs() call in the stove and HVAC blueprints Home Assistant's template engine has no abs() function, so every run of Stove On Detection failed at its first variable ("'abs' is undefined") and the HVAC failure monitor would fail the same way. Deployment note now points at labctl blueprints:pull ha. Claude-Session: https://claude.ai/code/session_01JBPyi1vyBbme5DKykW3Z25 --- CLAUDE.md | 4 ++-- hvac-failure-monitor.yaml | 2 +- stove-activity-detector.yaml | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index bc33915..5379262 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -10,9 +10,9 @@ This is a Home Assistant Blueprints repository containing reusable automation te ### Deployment After committing and pushing changes, deploy blueprints to Home Assistant: ```bash -HA_POD=$(kubectl -n ha get pods -l app=ha-app -o=jsonpath="{.items[0].metadata.name}") -kubectl -n ha exec "$HA_POD" -- bash -c "cd /config/blueprints/automation/rzen && git pull" +labctl blueprints:pull ha # from the lab repo; runs git pull in the checkout on the ha volume ``` +Then reload automations in the Home Assistant UI (Developer tools → YAML → Automations) so blueprint changes take effect. ### Testing & Validation - **Blueprint Validation**: Use Home Assistant's built-in blueprint importer to validate YAML syntax diff --git a/hvac-failure-monitor.yaml b/hvac-failure-monitor.yaml index 45b0c8d..993701a 100644 --- a/hvac-failure-monitor.yaml +++ b/hvac-failure-monitor.yaml @@ -99,7 +99,7 @@ action: setpoint: > {{ state_attr(thermostat, 'temperature') | float }} delta: > - {{ abs(setpoint - outdoor_now) }} + {{ (setpoint - outdoor_now) | abs }} required_rate: > {% set d = delta %} {{ [0.01, [0.10, 0.10 - (d * 0.004)] | min] | max }} diff --git a/stove-activity-detector.yaml b/stove-activity-detector.yaml index 16b4a76..5cf2ba4 100644 --- a/stove-activity-detector.yaml +++ b/stove-activity-detector.yaml @@ -255,9 +255,9 @@ action: delta1: "{{ phase1_after - phase1_before }}" delta2: "{{ phase2_after - phase2_before }}" combined_delta: "{{ delta1 + delta2 }}" - magnitude: "{{ abs(combined_delta) }}" + magnitude: "{{ combined_delta | abs }}" balance_pct: > - {{ abs(delta1 - delta2) / max(abs(delta1), abs(delta2), 1) * 100 }} + {{ ((delta1 - delta2) | abs) / max(delta1 | abs, delta2 | abs, 1) * 100 }} is_balanced: "{{ balance_pct <= balance_tolerance_pct }}" in_window: > {{ magnitude >= element_min_watts and magnitude <= element_max_watts }} @@ -310,7 +310,7 @@ action: - variables: signature: "{{ states(signature_helper) | float(0) }}" match_pct: > - {{ abs(magnitude - signature) / max(signature, 1) * 100 }} + {{ ((magnitude - signature) | abs) / max(signature, 1) * 100 }} - choose: # Fall matches the remembered rising signature: same element cycling off. - conditions: >