Files
haos-blueprints/Common/Refrigerator.yaml

138 lines
4.3 KiB
YAML

# =============================================================================
# Refrigerator Express Mode Control Blueprint
# =============================================================================
# This blueprint monitors refrigerator temperature and automatically enables
# express/turbo cooling mode when the temperature drifts too far from target.
#
# How It Works:
# - Monitors the temperature sensor and compares to target temperature
# - If difference exceeds threshold (and door is closed), enables express mode
# - Sends notification when express mode is activated
# - Automatically disables express mode when temperature normalizes
#
# Requirements:
# - Door sensor (binary_sensor) to detect if door is open
# - Temperature sensor reporting current fridge temperature
# - Climate entity with target temperature attribute
# - Switch entity to control express/turbo mode
#
# Author: Alexei Dolgolyov (dolgolyov.alexei@gmail.com)
# =============================================================================
blueprint:
name: "Custom: Refrigerator Express Mode Control"
description: >
Turns on express mode if the refrigerator temperature is too far from target.
Sends a notification when the difference exceeds the allowed threshold.
domain: automation
input:
door_sensor:
name: Door Sensor
description: Binary sensor for refrigerator door
selector:
entity:
domain: binary_sensor
temp_sensor:
name: Temperature Sensor
description: Sensor reporting current refrigerator temperature
selector:
entity:
domain: sensor
climate_entity:
name: Refrigerator Climate Entity
description: Climate entity that provides target temperature
selector:
entity:
domain: climate
device_name:
name: Device Name
description: Name of the device
default: 'Refrigerator'
selector:
text:
express_switch:
name: Express Mode Switch
description: Switch entity to enable express mode
selector:
entity:
domain: switch
max_diff:
name: Max Allowed Temperature Difference
description: Maximum difference between target and actual temperature before express mode is enabled
default: 3
selector:
number:
min: 1
max: 10
step: 0.5
unit_of_measurement: "°C"
notify_target:
name: Notification Target
description: Device or service to send notifications
default: []
selector:
entity:
domain: notify
multiple: true
mode: restart
trigger:
- platform: state
entity_id: !input temp_sensor
- platform: state
entity_id: !input door_sensor
- platform: state
entity_id: !input climate_entity
attribute: temperature
variables:
temp_sensor: !input temp_sensor
climate_entity: !input climate_entity
door_sensor: !input door_sensor
notify_target: !input notify_target
device_name: !input device_name
max_diff: !input max_diff
express_switch: !input express_switch
curr_temp: "{{ states(temp_sensor) | float(0) }}"
target_temp: "{{ state_attr(climate_entity, 'temperature') | float(0) }}"
diff: "{{ (curr_temp - target_temp) | abs }}"
temp_is_not_ok: "{{ diff > max_diff and is_state(door_sensor, 'off') }}"
action:
- choose:
- conditions:
- condition: template
value_template: "{{ temp_is_not_ok and is_state(express_switch, 'off') }}"
sequence:
- service: switch.turn_on
target:
entity_id: !input express_switch
- service: notify.send_message
target:
entity_id: !input notify_target
data:
message: >
{{ device_name }}: обнаружена проблема температурного режима.
Текущая {{ curr_temp }}°C, Целевая {{ target_temp }}°C,
Разница {{ diff }}°C. Включение экпресс режима.
- conditions:
- condition: template
value_template: "{{ not temp_is_not_ok }}"
sequence:
- service: switch.turn_off
target:
entity_id: !input express_switch