Last active
October 16, 2024 19:04
-
-
Save briodan/8c9eaf1b2e4d2decef112aff19f4f94c to your computer and use it in GitHub Desktop.
Thermostat - run based on sensor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: thermostat run based on sensor | |
description: Set display helpers based on remote sensor and time of day. the automation will turn run on the interval specified in frequency and turn on the thermostat. | |
domain: automation | |
homeassistant: | |
min_version: 2024.10.0 | |
input: | |
frequency: | |
name: Frequency | |
description: how often to check sensor status? 1, 5 or 10 minues. 1 min should be used for testing purposed with a generic thermostat | |
selector: | |
select: | |
options: | |
- /1 | |
- /5 | |
- /10 | |
thermostat: | |
name: Thermostat | |
description: Select the Thermostat | |
selector: | |
entity: | |
filter: | |
- domain: climate | |
error_boolean_helper: | |
name: error_boolean_helper | |
description: Select the error testing helper | |
selector: | |
entity: | |
cool_tolerance_helper: | |
name: Tolerance for cooling | |
description: Precision for heating target, when heating it will cause the thermostat to stop short of target temperature by this value. If target temp is 20 and this is set to 1 it will heat to 19. | |
default: {} | |
selector: | |
entity: | |
heat_tolerance_helper: | |
name: Tolerance for heating | |
description: Precision for cooling target, when cooling it will cause the thermostat to stop short of target temperature by this value. If target temp is 20 and this is set to 1 it will cool to 21. | |
default: {} | |
selector: | |
entity: | |
current_sensor_helper: | |
name: Current Temp Sensor | |
description: This helper will be updated to display the current temp sensor | |
default: {} | |
selector: | |
entity: | |
current_temp_helper: | |
name: Current Temperature | |
description: This helper will be updated to display the current temperature when the automation last ran | |
default: {} | |
selector: | |
entity: | |
target_temp_helper: | |
name: Current Temp Target | |
description: This helper will be updated to display the temperature target | |
default: {} | |
selector: | |
entity: | |
adjusted_temp_cool_helper: | |
name: Adjusted Temp Cool | |
description: This helper will be updated to display the adjusted cool temperature target | |
default: {} | |
selector: | |
entity: | |
adjusted_temp_heat_helper: | |
name: Adjusted Temp Heat | |
description: This helper will be updated to display the adjusted heat temperature target | |
default: {} | |
selector: | |
entity: | |
triggers: | |
- trigger: time_pattern | |
minutes: !input frequency | |
- trigger: state | |
entity_id: | |
- !input cool_tolerance_helper | |
- !input heat_tolerance_helper | |
- !input target_temp_helper | |
actions: | |
- variables: | |
error_boolean_helper: !input error_boolean_helper | |
cool_tolerance_helper: !input cool_tolerance_helper | |
heat_tolerance_helper: !input heat_tolerance_helper | |
current_sensor_helper: !input current_sensor_helper | |
current_temp_helper: !input current_temp_helper | |
target_temp_helper: !input target_temp_helper | |
target_temp_float: "{{ states(target_temp_helper) | float }}" | |
current_sensor: "{{ states(current_sensor_helper) }}" | |
current_temp_float: "{{ states(current_sensor) | float }}" | |
heat_low_setpoint: "{{ target_temp_float + 4 }}" | |
cool_high_setpoint: "{{ target_temp_float - 4 }}" | |
cool_helper_float: "{{ states[cool_tolerance_helper].state | float}}" | |
heat_helper_float: "{{ states[heat_tolerance_helper].state | float}}" | |
heat_temp: "{{ ((target_temp_float - heat_helper_float ) - current_temp_float) | round(2) }}" | |
cool_temp: "{{ ((target_temp_float + cool_helper_float ) - current_temp_float) | round(2) }}" | |
adjusted_heat: "{{ (target_temp_float - heat_helper_float ) | round(2) }}" | |
adjusted_cool: "{{ (target_temp_float + cool_helper_float ) | round(2) }}" | |
- action: system_log.write | |
data: | |
message: > | |
cool_tolerance_helper and value: {{ cool_tolerance_helper }},-,{{ cool_helper_float }},{{"\n"}} | |
heat_tolerance_helper and value: {{ heat_tolerance_helper }},-,{{ heat_helper_float }},{{"\n"}} | |
current_sensor_helper and value: {{ current_sensor_helper }},{{"\n"}},-,{{ current_sensor }},{{"\n"}} | |
current_temp_helper and value: {{ current_temp_helper }},{{"\n"}},-,{{ current_temp_float }},{{"\n"}} | |
target_temp_helper and value: {{ target_temp_helper }},{{"\n"}},-,{{ target_temp_float }},{{"\n"}} | |
heat_low_setpoint: {{ heat_low_setpoint }},{{"\n"}} | |
cool_high_setpoint: {{ cool_high_setpoint }},{{"\n"}} | |
heat_temp: {{ heat_temp }},{{"\n"}} | |
cool_temp: {{ cool_temp }},{{"\n"}} | |
level: debug | |
logger: blueprints.briodan.thermostat | |
- action: input_number.set_value | |
data: | |
entity_id: !input current_temp_helper | |
value: "{{ current_temp_float }}" | |
- action: input_number.set_value | |
data: | |
entity_id: !input adjusted_temp_cool_helper | |
value: "{{ adjusted_cool }}" | |
- action: input_number.set_value | |
data: | |
entity_id: !input adjusted_temp_heat_helper | |
value: "{{ adjusted_heat }}" | |
- choose: | |
- conditions: | |
- alias: heat | |
condition: template | |
value_template: >- | |
{{ (heat_temp > 0) }} | |
sequence: | |
- action: input_select.select_option | |
target: | |
entity_id: !input error_boolean_helper | |
data: | |
option: heat | |
- action: climate.set_temperature | |
data: | |
target_temp_low: "{{ target_temp_float + 2 }}" | |
target_temp_high: "{{ heat_low_setpoint }}" | |
target: | |
entity_id: !input thermostat | |
- conditions: | |
- alias: cool | |
condition: template | |
value_template: >- | |
{{ (cool_temp < 0) }} | |
sequence: | |
- action: input_select.select_option | |
target: | |
entity_id: !input error_boolean_helper | |
data: | |
option: cool | |
- action: climate.set_temperature | |
data: | |
target_temp_low: "{{ target_temp_float -2 }}" | |
target_temp_high: "{{ cool_high_setpoint }}" | |
target: | |
entity_id: !input thermostat | |
default: | |
- action: system_log.write | |
data: | |
message: > | |
no conditions matched | |
level: info | |
logger: blueprints.briodan.thermostat | |
- action: input_select.select_option | |
target: | |
entity_id: !input error_boolean_helper | |
data: | |
option: idle |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment