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:
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
# =============================================================================
@@ -345,6 +361,11 @@ action:
force_on_entity: !input force_on_entity
hysteresis_window: !input hysteresis_window
# -----------------------------------------------------------------------
# Device State
# -----------------------------------------------------------------------
is_device_on: "{{ states(device_entity) not in ['off', 'unavailable', 'unknown'] }}"
# -----------------------------------------------------------------------
# Force ON Check
# -----------------------------------------------------------------------
@@ -468,7 +489,7 @@ action:
# -----------------------------------------------------------------------
# Debug Flag
# -----------------------------------------------------------------------
is_debug: false
is_debug: !input enable_debug_notifications
# ---------------------------------------------------------------------------
# DEBUG: Log current state
@@ -478,18 +499,29 @@ action:
sequence:
- service: persistent_notification.create
data:
title: "Climate Controller (debug)"
title: "Climate Device Controller Debug"
message: >
is_force_on = {{ is_force_on }},
room_closed = {{ room_closed }},
house_closed = {{ house_closed }},
is_value_below_threshold = {{ is_value_below_threshold }},
is_value_below_turn_on_threshold = {{ is_value_below_turn_on_threshold }},
is_value_at_or_above_target = {{ is_value_at_or_above_target }},
target_value = {{ target_value }},
turn_on_threshold = {{ turn_on_threshold }},
schedule_active = {{ schedule_active }},
control_switch = {{ states(control_switch) }}
**Device State:**
- Device: {{ states(device_entity) }} (on: {{ is_device_on }})
- Control Switch: {{ states(control_switch) }}
- Force ON: {{ is_force_on }}
- Schedule Active: {{ schedule_active }}
**Environment:**
- Target Value: {{ target_value }}
- Turn-On Threshold: {{ turn_on_threshold }} (hysteresis: {{ hysteresis_window }})
- 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
@@ -558,7 +590,11 @@ action:
- conditions:
- condition: template
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)
@@ -567,7 +603,11 @@ action:
- conditions:
- condition: template
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
@@ -576,7 +616,11 @@ action:
- conditions:
- condition: template
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
@@ -585,7 +629,11 @@ action:
- conditions:
- condition: template
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
@@ -594,7 +642,11 @@ action:
- conditions:
- condition: template
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
@@ -603,7 +655,11 @@ action:
- conditions:
- condition: template
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)

View File

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