Created
March 31, 2025 22:50
-
-
Save pantherale0/f6ce5a32227473a105b33633ad729019 to your computer and use it in GitHub Desktop.
HA Automation Samsung ASHP DHW Controller
This file contains hidden or 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: Samsung ASHP ESPHome Automatic Hot Water Controller | |
description: An automatic hot water controller for your Samsung ASHP | |
domain: automation | |
input: | |
hot_water_schedule: | |
name: Hot Water Schedule | |
selector: | |
entity: | |
domain: schedule | |
holiday_mode_sensor: | |
name: Holiday Mode | |
selector: | |
entity: | |
domain: binary_sensor | |
hot_water_boost: | |
name: (Helper) Hot Water Boost | |
description: Create a new input boolean to allow you to boost your hot water at anytime (similar to existing UK DHW boost functionality) | |
selector: | |
entity: | |
domain: input_boolean | |
target_samsung_climate_entity: | |
name: Samsung DHW Controller | |
description: The climate entity for the Samsung controller | |
selector: | |
entity: | |
domain: climate | |
dhw_current_temperature: | |
name: Samsung DHW Current Temperature | |
description: The sensor entity storing the current DHW temperature | |
selector: | |
entity: | |
domain: sensor | |
current_rate_sensor: | |
name: Current Energy Rate | |
selector: | |
entity: | |
domain: sensor | |
next_plunge_slot: | |
name: Next Energy Rate Plunge Time | |
description: A sensor that contains the next time plunge pricing is expected, during this time the hot water temperature is boosted | |
selector: | |
entity: | |
domain: sensor | |
standard_temperature: | |
name: Standard Temperature | |
description: Normal operation target temperature | |
selector: | |
number: | |
plunge_temperature: | |
name: Plunge Temperature | |
description: Target temperature during energy price plunge events | |
selector: | |
number: | |
eco_price: | |
name: Eco Price | |
description: The price to put the ASHP into eco mode during a scheduled DHW heating session | |
selector: | |
number: | |
standard_price: | |
name: Standard Price | |
description: The price to put the ASHP into standard mode during a scheduled DHW heating session | |
selector: | |
number: | |
dhw_am_energy_target: | |
name: AM DHW Octopus Target Rate | |
description: Octopus target rate sensor for morning operation | |
selector: | |
entity: | |
domain: sensor | |
dhw_pm_energy_target: | |
name: PM DHW Octopus Target Rate | |
description: Octopus target rate sensor for afternoon/evening operation | |
selector: | |
entity: | |
domain: sensor | |
std_rate: | |
name: Standard Energy Rate | |
description: The standard energy rate (known as Standard Variable Rate in the UK, Octopus customers can create a cost comparison sensor for this) | |
selector: | |
entity: | |
domain: sensor | |
full_auto_override: | |
name: (Helper) Full Auto Mode | |
description: A helper to enable or disable full auto mode. In full auto mode, the times the DHW will come on is based on purely energy rates. Whereas if it is turned off, it is based on the schedule. | |
selector: | |
entity: | |
domain: input_boolean | |
away_mode_zone: | |
name: (Zone) Away Mode Zone | |
description: The zone that is used to change the current mode from away to home | |
selector: | |
entity: | |
domain: zone | |
triggers: | |
- entity_id: !input "current_rate_sensor" | |
id: current-rate | |
attribute: start | |
trigger: state | |
- entity_id: !input "hot_water_schedule" | |
from: "on" | |
to: "off" | |
id: schedule | |
trigger: state | |
- entity_id: !input "hot_water_schedule" | |
from: "off" | |
to: "on" | |
id: schedule | |
trigger: state | |
- entity_id: !input "holiday_mode_sensor" | |
from: "off" | |
to: "on" | |
id: holiday-mode | |
trigger: state | |
- entity_id: !input "hot_water_boost" | |
from: "off" | |
to: "on" | |
id: boost | |
trigger: state | |
- entity_id: !input "hot_water_boost" | |
from: "on" | |
to: "off" | |
id: boost | |
trigger: state | |
- entity_id: | |
- !input "dhw_pm_energy_target" | |
- !input "dhw_am_energy_target" | |
from: "off" | |
to: "on" | |
id: target | |
trigger: state | |
- entity_id: | |
- !input "dhw_pm_energy_target" | |
- !input "dhw_am_energy_target" | |
from: "on" | |
to: "off" | |
id: target | |
trigger: state | |
conditions: [] | |
actions: | |
- variables: | |
target_controller: !input "target_samsung_climate_entity" | |
cur_state: | | |
{{ states(!input "target_samsung_climate_entity") }} | |
cur_mode: | | |
{{ state_attr(!input "target_samsung_climate_entity", 'preset_mode') }} | |
cur_temp: > | |
{{ states(!input "dhw_current_temperature") | float(!input "standard_temperature") | |
}} | |
default_temp: !input "standard_temperature" | |
plunge_temp: !input "plunge_temperature" | |
power_mode: activity | |
eco_mode: eco | |
standard_mode: home | |
boost_mode: home | |
next_plunge: | | |
{{ states(!input "next_plunge_slot") }} | |
schedule: | | |
{{ states(!input "hot_water_schedule") == 'on' }} | |
std_rate: > | |
{{ states(!input "std_rate") | float(0) }} | |
cur_rate: > | |
{{ | |
states(!input "current_rate_sensor") | |
| float }} | |
holiday_mode: | | |
{{ states(!input "holiday_mode_sensor") == 'on' }} | |
operation_delay: 5 | |
boost: | | |
{{ states(!input "hot_water_boost") == 'on' }} | |
dhw_full_auto: | | |
{{ states(!input "full_auto_override") == 'on' }} | |
am_target: | | |
{{ states(!input "dhw_am_energy_target") == 'on' }} | |
pm_target: | | |
{{ states(!input "dhw_pm_energy_target") == 'on' }} | |
away_mode: | | |
{{ states(!input "away_mode_zone") | int(0) == 0 }} | |
away_lower_limit: 30 | |
- choose: | |
- conditions: | |
- condition: trigger | |
id: | |
- current-rate | |
- alias: Test holiday mode off | |
condition: template | |
value_template: "{{ holiday_mode == false }}" | |
- alias: Test current rate < 0 | |
condition: template | |
value_template: "{{ cur_rate < 0.0 }}" | |
sequence: | |
- if: | |
- condition: template | |
value_template: "{{ cur_mode != 'activity' }}" | |
then: | |
- target: | |
entity_id: | | |
{{ target_controller }} | |
data: | |
preset_mode: | | |
{{ power_mode }} | |
action: climate.set_preset_mode | |
- delay: | |
hours: 0 | |
minutes: 0 | |
seconds: | | |
{{ operation_delay }} | |
milliseconds: 0 | |
- metadata: {} | |
data: | |
temperature: | | |
{{ plunge_temp }} | |
target: | |
entity_id: | | |
{{ target_controller }} | |
action: climate.set_temperature | |
- delay: | |
hours: 0 | |
minutes: 0 | |
seconds: | | |
{{ operation_delay }} | |
milliseconds: 0 | |
- if: | |
- condition: template | |
value_template: "{{ states(target_controller) == 'off' }}" | |
then: | |
- data: | |
hvac_mode: heat | |
target: | |
entity_id: | | |
{{ target_controller }} | |
action: climate.set_hvac_mode | |
- delay: | |
hours: 0 | |
minutes: 0 | |
seconds: | | |
{{ operation_delay }} | |
milliseconds: 0 | |
alias: Negative Pricing Starts Set Power Mode | |
- conditions: | |
- alias: Current rate > standard rate | |
condition: template | |
value_template: "{{ cur_rate > std_rate }}" | |
- condition: or | |
conditions: | |
- condition: trigger | |
id: | |
- target | |
- condition: trigger | |
id: | |
- current-rate | |
- condition: trigger | |
id: | |
- schedule | |
- condition: state | |
entity_id: input_boolean.hot_water_boost | |
state: "off" | |
- alias: Test holiday mode off | |
condition: template | |
value_template: "{{ holiday_mode == false }}" | |
sequence: | |
- metadata: {} | |
data: | |
hvac_mode: "off" | |
target: | |
entity_id: | | |
{{ target_controller }} | |
action: climate.set_hvac_mode | |
- delay: | |
hours: 0 | |
minutes: 0 | |
seconds: | | |
{{ operation_delay }} | |
milliseconds: 0 | |
alias: Peak Period Starts Turn Off | |
- conditions: | |
- condition: or | |
conditions: | |
- condition: or | |
conditions: | |
- alias: Triggered By Schedule + No Full Auto | |
condition: and | |
conditions: | |
- alias: Full Auto Disabled | |
condition: template | |
value_template: "{{ dhw_full_auto == false }}" | |
- condition: trigger | |
id: | |
- schedule | |
- condition: and | |
conditions: | |
- alias: Full Auto Enabled | |
condition: template | |
value_template: "{{ dhw_full_auto }}" | |
- condition: trigger | |
id: | |
- target | |
alias: Triggered By Target + Full Auto | |
alias: Schedule or Full Auto? | |
- condition: trigger | |
id: | |
- current-rate | |
alias: Current Rate or Control? | |
- alias: Current rate >= !input "eco_price" and < SVR | |
condition: template | |
value_template: '{{ cur_rate >= !input "eco_price" and cur_rate <= std_rate }}' | |
- condition: or | |
conditions: | |
- condition: template | |
value_template: "{{ next_plunge == 'unknown' }}" | |
alias: Next plunge unknown | |
- alias: Next plunge more than 12 hours away | |
condition: template | |
value_template: >- | |
{{ next_plunge != 'unknown' and | |
(next_plunge|as_datetime|relative_time - now()) > | |
timedelta(hours=12) }} | |
alias: Next plunge unknown or more than 12 hours away | |
- alias: Schedule or am_target or pm_target on | |
condition: template | |
value_template: >- | |
{{ (schedule and not dhw_full_auto) or ((am_target and | |
dhw_full_auto) or (pm_target and dhw_full_auto)) }} | |
- alias: Test boost off | |
condition: template | |
value_template: "{{ boost == false }}" | |
- alias: >- | |
Test holiday mode and away mode off or current temp is lower than | |
limit | |
condition: template | |
value_template: >- | |
{{ (holiday_mode == false and away_mode == false) or (cur_temp < | |
away_lower_limit) }} | |
sequence: | |
- if: | |
- condition: template | |
value_template: "{{ cur_mode != 'eco' }}" | |
alias: Current mode not eco | |
then: | |
- target: | |
entity_id: | | |
{{ target_controller }} | |
data: | |
preset_mode: | | |
{{ eco_mode }} | |
action: climate.set_preset_mode | |
- delay: | |
hours: 0 | |
minutes: 0 | |
seconds: | | |
{{ operation_delay }} | |
milliseconds: 0 | |
alias: Set preset to eco if different | |
- metadata: {} | |
data: | |
temperature: | | |
{{ default_temp }} | |
target: | |
entity_id: | | |
{{ target_controller }} | |
action: climate.set_temperature | |
- delay: | |
hours: 0 | |
minutes: 0 | |
seconds: | | |
{{ operation_delay }} | |
milliseconds: 0 | |
- if: | |
- condition: template | |
value_template: "{{ cur_state == 'off' }}" | |
alias: Check current state off | |
then: | |
- metadata: {} | |
data: | |
hvac_mode: heat | |
target: | |
entity_id: | | |
{{ target_controller }} | |
action: climate.set_hvac_mode | |
- delay: | |
hours: 0 | |
minutes: 0 | |
seconds: | | |
{{ operation_delay }} | |
milliseconds: 0 | |
alias: Turn on target_controller if off | |
alias: Set Eco mode when rate between !input "eco_price" and SVR | |
- conditions: | |
- condition: or | |
conditions: | |
- condition: or | |
conditions: | |
- alias: Triggered By Schedule + No Full Auto | |
condition: and | |
conditions: | |
- alias: Full Auto Disabled | |
condition: template | |
value_template: "{{ dhw_full_auto == false }}" | |
- condition: trigger | |
id: | |
- schedule | |
- condition: and | |
conditions: | |
- alias: Full Auto Enabled | |
condition: template | |
value_template: "{{ dhw_full_auto }}" | |
- condition: trigger | |
id: | |
- target | |
alias: Triggered By Target + Full Auto | |
alias: Schedule or Full Auto? | |
- condition: trigger | |
id: | |
- current-rate | |
alias: Current Rate or Control? | |
- condition: template | |
value_template: '{{ cur_rate > 0.0 and cur_rate < !input "eco_price" }}' | |
alias: Current rate > 0 and < !input "eco_price" | |
- condition: or | |
conditions: | |
- condition: template | |
value_template: "{{ next_plunge == 'unknown' }}" | |
alias: Next plunge unknown | |
- alias: Next plunge more than 12 hours away | |
condition: template | |
value_template: >- | |
{{ next_plunge != 'unknown' and | |
(next_plunge|as_datetime|relative_time - now()) > | |
timedelta(hours=12) }} | |
alias: Next plunge unknown or more than 12 hours away | |
- alias: Test boost off | |
condition: template | |
value_template: "{{ boost == false }}" | |
- alias: Schedule or am_target or pm_target on | |
condition: template | |
value_template: >- | |
{{ (schedule and not dhw_full_auto) or ((am_target and | |
dhw_full_auto) or (pm_target and dhw_full_auto)) }} | |
- alias: >- | |
Test holiday mode and away mode off or current temp is lower than | |
limit | |
condition: template | |
value_template: >- | |
{{ (holiday_mode == false and away_mode == false) or (cur_temp < | |
away_lower_limit) }} | |
sequence: | |
- alias: Set preset to std if different | |
if: | |
- alias: Current mode not eco | |
condition: template | |
value_template: "{{ cur_mode != 'none' }}" | |
then: | |
- target: | |
entity_id: | | |
{{ target_controller }} | |
data: | |
preset_mode: | | |
{{ standard_mode }} | |
action: climate.set_preset_mode | |
- delay: | |
hours: 0 | |
minutes: 0 | |
seconds: | | |
{{ operation_delay }} | |
milliseconds: 0 | |
- metadata: {} | |
data: | |
temperature: | | |
{{ default_temp }} | |
target: | |
entity_id: | | |
{{ target_controller }} | |
action: climate.set_temperature | |
- delay: | |
hours: 0 | |
minutes: 0 | |
seconds: | | |
{{ operation_delay }} | |
milliseconds: 0 | |
- if: | |
- condition: template | |
value_template: "{{ cur_state == 'off' }}" | |
alias: Check current state off | |
then: | |
- metadata: {} | |
data: | |
hvac_mode: heat | |
target: | |
entity_id: | | |
{{ target_controller }} | |
action: climate.set_hvac_mode | |
- delay: | |
hours: 0 | |
minutes: 0 | |
seconds: | | |
{{ operation_delay }} | |
milliseconds: 0 | |
alias: Turn on target_controller if off | |
alias: Set Standard mode when rate between 0.00 and !input "eco_price" | |
- conditions: | |
- alias: cur_rate > 0 | |
condition: template | |
value_template: "{{ cur_rate > 0.0 }}" | |
- condition: trigger | |
id: | |
- schedule | |
- boost | |
- current-rate | |
- target | |
- alias: Test boost off | |
condition: template | |
value_template: "{{ boost == false }}" | |
- alias: Test holiday mode off | |
condition: template | |
value_template: "{{ holiday_mode == false }}" | |
- alias: Test schedule off | |
condition: template | |
value_template: >- | |
{{ (schedule and not dhw_full_auto) or ((am_target and | |
dhw_full_auto) or (pm_target and dhw_full_auto)) == false }} | |
sequence: | |
- metadata: {} | |
data: | |
hvac_mode: "off" | |
target: | |
entity_id: | | |
{{ target_controller }} | |
alias: Turn off DHW | |
action: climate.set_hvac_mode | |
- delay: | |
hours: 0 | |
minutes: 0 | |
seconds: | | |
{{ operation_delay }} | |
milliseconds: 0 | |
alias: Turn off if plunge available or triggered by schedule | |
- conditions: | |
- condition: trigger | |
id: | |
- holiday-mode | |
sequence: | |
- metadata: {} | |
data: | |
hvac_mode: "off" | |
target: | |
entity_id: | | |
{{ target_controller }} | |
action: climate.set_hvac_mode | |
- delay: | |
hours: 0 | |
minutes: 0 | |
seconds: | | |
{{ operation_delay }} | |
milliseconds: 0 | |
alias: Turn off DHW while holiday mode active | |
- conditions: | |
- condition: trigger | |
id: | |
- boost | |
- alias: Test boost on | |
condition: template | |
value_template: "{{ boost }}" | |
sequence: | |
- alias: Set preset to boost if different | |
if: | |
- alias: Current mode not eco | |
condition: template | |
value_template: "{{ cur_mode != boost_mode }}" | |
then: | |
- target: | |
entity_id: | | |
{{ target_controller }} | |
data: | |
preset_mode: | | |
{{ boost_mode }} | |
action: climate.set_preset_mode | |
- delay: | |
hours: 0 | |
minutes: 0 | |
seconds: | | |
{{ operation_delay }} | |
milliseconds: 0 | |
- metadata: {} | |
data: | |
temperature: | | |
{{ default_temp }} | |
target: | |
entity_id: | | |
{{ target_controller }} | |
action: climate.set_temperature | |
- delay: | |
hours: 0 | |
minutes: 0 | |
seconds: | | |
{{ operation_delay }} | |
milliseconds: 0 | |
- if: | |
- condition: template | |
value_template: "{{ cur_state == 'off' }}" | |
alias: Check current state off | |
then: | |
- metadata: {} | |
data: | |
hvac_mode: heat | |
target: | |
entity_id: | | |
{{ target_controller }} | |
action: climate.set_hvac_mode | |
- delay: | |
hours: 0 | |
minutes: 0 | |
seconds: | | |
{{ operation_delay }} | |
milliseconds: 0 | |
alias: Turn on target_controller if off | |
alias: Set Standard Mode if boost activated | |
- conditions: | |
- condition: or | |
conditions: | |
- condition: or | |
conditions: | |
- alias: Triggered By Schedule + No Full Auto | |
condition: and | |
conditions: | |
- alias: Full Auto Disabled | |
condition: template | |
value_template: "{{ dhw_full_auto == false }}" | |
- condition: trigger | |
id: | |
- schedule | |
- condition: and | |
conditions: | |
- alias: Full Auto Enabled | |
condition: template | |
value_template: "{{ dhw_full_auto }}" | |
- condition: trigger | |
id: | |
- target | |
alias: Triggered By Target + Full Auto | |
alias: Schedule or Full Auto? | |
- condition: trigger | |
id: | |
- current-rate | |
alias: Current Rate or Control? | |
- condition: template | |
value_template: "{{ cur_rate > std_rate }}" | |
alias: Current rate > SVR | |
- condition: template | |
value_template: "{{ next_plunge == 'unknown' }}" | |
alias: Next plunge unknown | |
- alias: Test boost off | |
condition: template | |
value_template: "{{ boost == false }}" | |
- alias: Test holiday mode off | |
condition: template | |
value_template: "{{ holiday_mode == false }}" | |
- alias: Schedule or am_target or pm_target on | |
condition: template | |
value_template: "{{ schedule or am_target or pm_target }}" | |
sequence: | |
- metadata: {} | |
data: | |
hvac_mode: "off" | |
target: | |
entity_id: | | |
{{ target_controller }} | |
action: climate.set_hvac_mode | |
- delay: | |
hours: 0 | |
minutes: 0 | |
seconds: | | |
{{ operation_delay }} | |
milliseconds: 0 | |
alias: Turn off DHW if schedule on and rate > SVR | |
mode: queued | |
max: 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment