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
This commit is contained in:
@@ -10,9 +10,9 @@ This is a Home Assistant Blueprints repository containing reusable automation te
|
|||||||
### Deployment
|
### Deployment
|
||||||
After committing and pushing changes, deploy blueprints to Home Assistant:
|
After committing and pushing changes, deploy blueprints to Home Assistant:
|
||||||
```bash
|
```bash
|
||||||
HA_POD=$(kubectl -n ha get pods -l app=ha-app -o=jsonpath="{.items[0].metadata.name}")
|
labctl blueprints:pull ha # from the lab repo; runs git pull in the checkout on the ha volume
|
||||||
kubectl -n ha exec "$HA_POD" -- bash -c "cd /config/blueprints/automation/rzen && git pull"
|
|
||||||
```
|
```
|
||||||
|
Then reload automations in the Home Assistant UI (Developer tools → YAML → Automations) so blueprint changes take effect.
|
||||||
|
|
||||||
### Testing & Validation
|
### Testing & Validation
|
||||||
- **Blueprint Validation**: Use Home Assistant's built-in blueprint importer to validate YAML syntax
|
- **Blueprint Validation**: Use Home Assistant's built-in blueprint importer to validate YAML syntax
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ action:
|
|||||||
setpoint: >
|
setpoint: >
|
||||||
{{ state_attr(thermostat, 'temperature') | float }}
|
{{ state_attr(thermostat, 'temperature') | float }}
|
||||||
delta: >
|
delta: >
|
||||||
{{ abs(setpoint - outdoor_now) }}
|
{{ (setpoint - outdoor_now) | abs }}
|
||||||
required_rate: >
|
required_rate: >
|
||||||
{% set d = delta %}
|
{% set d = delta %}
|
||||||
{{ [0.01, [0.10, 0.10 - (d * 0.004)] | min] | max }}
|
{{ [0.01, [0.10, 0.10 - (d * 0.004)] | min] | max }}
|
||||||
|
|||||||
@@ -255,9 +255,9 @@ action:
|
|||||||
delta1: "{{ phase1_after - phase1_before }}"
|
delta1: "{{ phase1_after - phase1_before }}"
|
||||||
delta2: "{{ phase2_after - phase2_before }}"
|
delta2: "{{ phase2_after - phase2_before }}"
|
||||||
combined_delta: "{{ delta1 + delta2 }}"
|
combined_delta: "{{ delta1 + delta2 }}"
|
||||||
magnitude: "{{ abs(combined_delta) }}"
|
magnitude: "{{ combined_delta | abs }}"
|
||||||
balance_pct: >
|
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 }}"
|
is_balanced: "{{ balance_pct <= balance_tolerance_pct }}"
|
||||||
in_window: >
|
in_window: >
|
||||||
{{ magnitude >= element_min_watts and magnitude <= element_max_watts }}
|
{{ magnitude >= element_min_watts and magnitude <= element_max_watts }}
|
||||||
@@ -310,7 +310,7 @@ action:
|
|||||||
- variables:
|
- variables:
|
||||||
signature: "{{ states(signature_helper) | float(0) }}"
|
signature: "{{ states(signature_helper) | float(0) }}"
|
||||||
match_pct: >
|
match_pct: >
|
||||||
{{ abs(magnitude - signature) / max(signature, 1) * 100 }}
|
{{ ((magnitude - signature) | abs) / max(signature, 1) * 100 }}
|
||||||
- choose:
|
- choose:
|
||||||
# Fall matches the remembered rising signature: same element cycling off.
|
# Fall matches the remembered rising signature: same element cycling off.
|
||||||
- conditions: >
|
- conditions: >
|
||||||
|
|||||||
Reference in New Issue
Block a user