Add debug logging input and skip redundant on/off commands in Climate Device Controller

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-04 13:42:02 +03:00
parent 584c970044
commit a6ac4f4257
2 changed files with 75 additions and 19 deletions

View File

@@ -280,6 +280,22 @@ blueprint:
entity: entity:
domain: input_boolean domain: input_boolean
# -------------------------------------------------------------------------
# Debug
# -------------------------------------------------------------------------
debug_group:
name: "Debug"
collapsed: true
input:
enable_debug_notifications:
name: Enable Debug Notifications
description: >
Send persistent notifications for debugging automation behavior.
Shows current state of all variables and filtering decisions.
default: false
selector:
boolean:
# ============================================================================= # =============================================================================
# AUTOMATION MODE # AUTOMATION MODE
# ============================================================================= # =============================================================================
@@ -345,6 +361,11 @@ action:
force_on_entity: !input force_on_entity force_on_entity: !input force_on_entity
hysteresis_window: !input hysteresis_window hysteresis_window: !input hysteresis_window
# -----------------------------------------------------------------------
# Device State
# -----------------------------------------------------------------------
is_device_on: "{{ states(device_entity) not in ['off', 'unavailable', 'unknown'] }}"
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
# Force ON Check # Force ON Check
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
@@ -468,7 +489,7 @@ action:
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
# Debug Flag # Debug Flag
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
is_debug: false is_debug: !input enable_debug_notifications
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# DEBUG: Log current state # DEBUG: Log current state
@@ -478,18 +499,29 @@ action:
sequence: sequence:
- service: persistent_notification.create - service: persistent_notification.create
data: data:
title: "Climate Controller (debug)" title: "Climate Device Controller Debug"
message: > message: >
is_force_on = {{ is_force_on }}, **Device State:**
room_closed = {{ room_closed }}, - Device: {{ states(device_entity) }} (on: {{ is_device_on }})
house_closed = {{ house_closed }}, - Control Switch: {{ states(control_switch) }}
is_value_below_threshold = {{ is_value_below_threshold }}, - Force ON: {{ is_force_on }}
is_value_below_turn_on_threshold = {{ is_value_below_turn_on_threshold }}, - Schedule Active: {{ schedule_active }}
is_value_at_or_above_target = {{ is_value_at_or_above_target }},
target_value = {{ target_value }}, **Environment:**
turn_on_threshold = {{ turn_on_threshold }}, - Target Value: {{ target_value }}
schedule_active = {{ schedule_active }}, - Turn-On Threshold: {{ turn_on_threshold }} (hysteresis: {{ hysteresis_window }})
control_switch = {{ states(control_switch) }} - Below Emergency Threshold: {{ is_value_below_threshold }}
- Below Turn-On Threshold: {{ is_value_below_turn_on_threshold }}
- At/Above Target: {{ is_value_at_or_above_target }}
**Doors & Windows:**
- House Closed: {{ house_closed }}
- Room Closed: {{ room_closed }}
**Power Monitoring:**
- Power Sensor: {{ power_sensor | default('not configured') }}
- Power: {{ power }} W
- Power OK: {{ not is_power_not_ok }}
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# POWER MONITORING: Flag device if malfunctioning # POWER MONITORING: Flag device if malfunctioning
@@ -558,7 +590,11 @@ action:
- conditions: - conditions:
- condition: template - condition: template
value_template: "{{ is_force_on }}" value_template: "{{ is_force_on }}"
sequence: !input turn_on_action sequence:
- if:
- condition: template
value_template: "{{ not is_device_on }}"
then: !input turn_on_action
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
# PRIORITY 2: Emergency Override (Safety) # PRIORITY 2: Emergency Override (Safety)
@@ -567,7 +603,11 @@ action:
- conditions: - conditions:
- condition: template - condition: template
value_template: "{{ is_value_below_threshold }}" value_template: "{{ is_value_below_threshold }}"
sequence: !input turn_on_action sequence:
- if:
- condition: template
value_template: "{{ not is_device_on }}"
then: !input turn_on_action
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
# PRIORITY 3: Control Switch Off # PRIORITY 3: Control Switch Off
@@ -576,7 +616,11 @@ action:
- conditions: - conditions:
- condition: template - condition: template
value_template: "{{ is_state(control_switch, 'off') }}" value_template: "{{ is_state(control_switch, 'off') }}"
sequence: !input turn_off_action sequence:
- if:
- condition: template
value_template: "{{ is_device_on }}"
then: !input turn_off_action
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
# PRIORITY 4: Environment Not Ready # PRIORITY 4: Environment Not Ready
@@ -585,7 +629,11 @@ action:
- conditions: - conditions:
- condition: template - condition: template
value_template: "{{ not (house_closed or room_closed) or not schedule_active }}" value_template: "{{ not (house_closed or room_closed) or not schedule_active }}"
sequence: !input turn_off_action sequence:
- if:
- condition: template
value_template: "{{ is_device_on }}"
then: !input turn_off_action
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
# PRIORITY 5: Target Reached # PRIORITY 5: Target Reached
@@ -594,7 +642,11 @@ action:
- conditions: - conditions:
- condition: template - condition: template
value_template: "{{ is_value_at_or_above_target }}" value_template: "{{ is_value_at_or_above_target }}"
sequence: !input turn_off_action sequence:
- if:
- condition: template
value_template: "{{ is_device_on }}"
then: !input turn_off_action
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
# PRIORITY 6: Below Turn-On Threshold # PRIORITY 6: Below Turn-On Threshold
@@ -603,7 +655,11 @@ action:
- conditions: - conditions:
- condition: template - condition: template
value_template: "{{ is_value_below_turn_on_threshold }}" value_template: "{{ is_value_below_turn_on_threshold }}"
sequence: !input turn_on_action sequence:
- if:
- condition: template
value_template: "{{ not is_device_on }}"
then: !input turn_on_action
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# DEFAULT: Maintain Current State (Hysteresis Zone) # DEFAULT: Maintain Current State (Hysteresis Zone)

View File

@@ -1,3 +1,3 @@
{ {
"version": "2.5.0" "version": "2.5.2"
} }