Make power_sensor optional in Climate Device Controller

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-04 13:27:48 +03:00
parent 4c03bc849e
commit 584c970044
2 changed files with 10 additions and 14 deletions

View File

@@ -237,8 +237,11 @@ blueprint:
collapsed: false
input:
power_sensor:
name: Power Sensor
description: "Sensor reporting device power consumption (W)"
name: Power Sensor (optional)
description: >
Sensor reporting device power consumption (W).
Leave empty to disable power monitoring.
default:
selector:
entity:
domain: sensor
@@ -321,13 +324,6 @@ trigger:
- platform: state
entity_id: !input env_sensors
# Power sensor dropped below threshold (potential malfunction)
- platform: numeric_state
entity_id: !input power_sensor
below: !input power_threshold
for:
seconds: !input power_decay_duration
# =============================================================================
# CONDITIONS
# =============================================================================
@@ -406,13 +402,13 @@ action:
# -----------------------------------------------------------------------
# Power Monitoring
# -----------------------------------------------------------------------
power_threshold: !input power_threshold
power_sensor: !input power_sensor
power_threshold: !input power_threshold
power_problematic_indicator_entity: !input power_problematic_indicator_entity
power_decay_duration: !input power_decay_duration
power: "{{ states(power_sensor) | float(0) }}"
power: "{{ states(power_sensor) | float(0) if power_sensor is not none else 0 }}"
# Device is problematic if it's consuming power but below threshold
is_power_not_ok: "{{ (power > 0 and power < power_threshold) if power_threshold != 0 else false }}"
is_power_not_ok: "{{ (power > 0 and power < power_threshold) if power_sensor is not none and power_threshold != 0 else false }}"
# -----------------------------------------------------------------------
# Window/Door State
@@ -503,7 +499,7 @@ action:
- choose:
- conditions:
- condition: template
value_template: "{{ states(device_entity) not in ['off', 'unavailable', 'unknown'] and power_problematic_indicator_entity is not none }}"
value_template: "{{ power_sensor is not none and states(device_entity) not in ['off', 'unavailable', 'unknown'] and power_problematic_indicator_entity is not none }}"
sequence:
- variables:
# Check if enough time has passed since last power reading