Files
zorruno-homeassistant/packages/flounder_heat_pump_optimistic.yaml
T
2026-08-15 14:58:19 +12:00

375 lines
13 KiB
YAML

################################################################################
# Optimistic state helpers for the Flounder dashboard heat-pump controls.
################################################################################
input_select:
lounge_hvac_requested_mode:
name: Lounge HVAC Requested Mode
options:
- none
- "off"
- heat
- cool
initial: none
flounder_lounge_power_request:
name: Flounder Lounge Power Request
options: [idle, "on", "off"]
initial: idle
flounder_master_bedroom_power_request:
name: Flounder Master Bedroom Power Request
options: [idle, "on", "off"]
initial: idle
flounder_lounge_nanoe_request:
name: Flounder Lounge Nanoe Request
options: [idle, "on", "off"]
initial: idle
flounder_master_bedroom_nanoe_request:
name: Flounder Master Bedroom Nanoe Request
options: [idle, "on", "off"]
initial: idle
flounder_lounge_preset_request:
name: Flounder Lounge Preset Request
options: [idle, none, powerful, quiet]
initial: idle
flounder_master_bedroom_preset_request:
name: Flounder Master Bedroom Preset Request
options: [idle, none, powerful, quiet]
initial: idle
input_number:
lounge_setpoint_ui:
name: Lounge Setpoint UI
min: 16
max: 30
step: 0.5
mode: box
unit_of_measurement: "°C"
icon: mdi:thermometer
input_boolean:
flounder_lounge_setpoint_pending:
name: Flounder Lounge Setpoint Pending
flounder_master_bedroom_setpoint_pending:
name: Flounder Master Bedroom Setpoint Pending
script:
flounder_lounge_power_toggle:
alias: Flounder Lounge Heat Pump Power Toggle
mode: restart
sequence:
- variables:
pending: "{{ states('input_select.flounder_lounge_power_request') }}"
requested_mode: "{{ states('input_select.lounge_hvac_requested_mode') }}"
desired: >-
{% set is_on = requested_mode in ['heat', 'cool'] or pending == 'on' or (pending == 'idle' and not is_state('climate.lounge', 'off')) %}
{{ 'off' if is_on else 'on' }}
- service: input_select.select_option
target:
entity_id: input_select.flounder_lounge_power_request
data:
option: "{{ desired }}"
- service: input_select.select_option
target:
entity_id: input_select.lounge_hvac_requested_mode
data:
option: "{{ 'off' if desired == 'off' else 'none' }}"
- service: "climate.turn_{{ desired }}"
target:
entity_id: climate.lounge
- delay: "00:00:30"
- service: input_select.select_option
target:
entity_id: input_select.flounder_lounge_power_request
data:
option: idle
flounder_master_bedroom_power_toggle:
alias: Flounder Master Bedroom Heat Pump Power Toggle
mode: restart
sequence:
- variables:
pending: "{{ states('input_select.flounder_master_bedroom_power_request') }}"
requested_mode: "{{ states('input_select.master_bedroom_hvac_requested_mode') }}"
desired: >-
{% set is_on = requested_mode in ['heat', 'cool', 'dry'] or pending == 'on' or (pending == 'idle' and not is_state('climate.master_bedroom', 'off')) %}
{{ 'off' if is_on else 'on' }}
- service: input_select.select_option
target:
entity_id: input_select.flounder_master_bedroom_power_request
data:
option: "{{ desired }}"
- service: input_select.select_option
target:
entity_id: input_select.master_bedroom_hvac_requested_mode
data:
option: "{{ 'off' if desired == 'off' else 'none' }}"
- service: "climate.turn_{{ desired }}"
target:
entity_id: climate.master_bedroom
- delay: "00:00:30"
- service: input_select.select_option
target:
entity_id: input_select.flounder_master_bedroom_power_request
data:
option: idle
flounder_lounge_hvac_mode:
alias: Flounder Lounge HVAC Mode
mode: restart
fields:
mode:
description: HVAC mode to request
sequence:
- service: input_select.select_option
target:
entity_id: input_select.lounge_hvac_requested_mode
data:
option: "{{ mode }}"
- choose:
- conditions:
- condition: template
value_template: "{{ mode == 'off' }}"
sequence:
- service: climate.turn_off
target:
entity_id: climate.lounge
default:
- service: climate.set_hvac_mode
target:
entity_id: climate.lounge
data:
hvac_mode: "{{ mode }}"
flounder_lounge_setpoint_adjust:
alias: Flounder Lounge Setpoint Adjust
mode: restart
fields:
step:
description: Setpoint change in degrees C
sequence:
- variables:
current_ui: "{{ states('input_number.lounge_setpoint_ui') | float(0) }}"
current_climate: "{{ state_attr('climate.lounge', 'temperature') | float(22) }}"
current: "{{ current_ui if current_ui >= 16 else current_climate }}"
requested: "{{ [30, [16, current + (step | float(0))] | max] | min | round(1) }}"
- service: input_boolean.turn_on
target:
entity_id: input_boolean.flounder_lounge_setpoint_pending
- service: input_number.set_value
target:
entity_id: input_number.lounge_setpoint_ui
data:
value: "{{ requested }}"
- service: climate.set_temperature
target:
entity_id: climate.lounge
data:
temperature: "{{ requested }}"
- wait_template: >-
{{ (((state_attr('climate.lounge', 'temperature') | float(0)) - (requested | float(0))) | abs) < 0.01 }}
timeout: "00:00:30"
continue_on_timeout: true
- service: input_boolean.turn_off
target:
entity_id: input_boolean.flounder_lounge_setpoint_pending
flounder_master_bedroom_setpoint_adjust:
alias: Flounder Master Bedroom Setpoint Adjust
mode: restart
fields:
step:
description: Setpoint change in degrees C
sequence:
- variables:
current_ui: "{{ states('input_number.master_bedroom_setpoint_ui') | float(0) }}"
current_climate: "{{ state_attr('climate.master_bedroom', 'temperature') | float(22) }}"
current: "{{ current_ui if current_ui >= 16 else current_climate }}"
requested: "{{ [30, [16, current + (step | float(0))] | max] | min | round(1) }}"
- service: input_boolean.turn_on
target:
entity_id: input_boolean.flounder_master_bedroom_setpoint_pending
- service: input_number.set_value
target:
entity_id: input_number.master_bedroom_setpoint_ui
data:
value: "{{ requested }}"
- service: climate.set_temperature
target:
entity_id: climate.master_bedroom
data:
temperature: "{{ requested }}"
- wait_template: >-
{{ (((state_attr('climate.master_bedroom', 'temperature') | float(0)) - (requested | float(0))) | abs) < 0.01 }}
timeout: "00:00:30"
continue_on_timeout: true
- service: input_boolean.turn_off
target:
entity_id: input_boolean.flounder_master_bedroom_setpoint_pending
flounder_lounge_nanoe_toggle:
alias: Flounder Lounge Nanoe Toggle
mode: restart
sequence:
- variables:
pending: "{{ states('input_select.flounder_lounge_nanoe_request') }}"
desired: >-
{% set is_on = pending == 'on' or (pending == 'idle' and is_state('switch.lounge_nanoe', 'on')) %}
{{ 'off' if is_on else 'on' }}
- service: input_select.select_option
target:
entity_id: input_select.flounder_lounge_nanoe_request
data:
option: "{{ desired }}"
- service: "switch.turn_{{ desired }}"
target:
entity_id: switch.lounge_nanoe
- delay: "00:00:30"
- service: input_select.select_option
target:
entity_id: input_select.flounder_lounge_nanoe_request
data:
option: idle
flounder_master_bedroom_nanoe_toggle:
alias: Flounder Master Bedroom Nanoe Toggle
mode: restart
sequence:
- variables:
pending: "{{ states('input_select.flounder_master_bedroom_nanoe_request') }}"
desired: >-
{% set is_on = pending == 'on' or (pending == 'idle' and is_state('switch.master_bedroom_nanoe', 'on')) %}
{{ 'off' if is_on else 'on' }}
- service: input_select.select_option
target:
entity_id: input_select.flounder_master_bedroom_nanoe_request
data:
option: "{{ desired }}"
- service: "switch.turn_{{ desired }}"
target:
entity_id: switch.master_bedroom_nanoe
- delay: "00:00:30"
- service: input_select.select_option
target:
entity_id: input_select.flounder_master_bedroom_nanoe_request
data:
option: idle
flounder_lounge_preset_toggle:
alias: Flounder Lounge Preset Toggle
mode: restart
fields:
preset:
description: Preset to toggle
sequence:
- variables:
pending: "{{ states('input_select.flounder_lounge_preset_request') }}"
current: "{{ pending if pending != 'idle' else (state_attr('climate.lounge', 'preset_mode') or 'none') }}"
desired: "{{ 'none' if current == preset else preset }}"
- service: input_select.select_option
target:
entity_id: input_select.flounder_lounge_preset_request
data:
option: "{{ desired }}"
- service: climate.set_preset_mode
target:
entity_id: climate.lounge
data:
preset_mode: "{{ desired }}"
- delay: "00:00:30"
- service: input_select.select_option
target:
entity_id: input_select.flounder_lounge_preset_request
data:
option: idle
flounder_master_bedroom_preset_toggle:
alias: Flounder Master Bedroom Preset Toggle
mode: restart
fields:
preset:
description: Preset to toggle
sequence:
- variables:
pending: "{{ states('input_select.flounder_master_bedroom_preset_request') }}"
current: "{{ pending if pending != 'idle' else (state_attr('climate.master_bedroom', 'preset_mode') or 'none') }}"
desired: "{{ 'none' if current == preset else preset }}"
- service: input_select.select_option
target:
entity_id: input_select.flounder_master_bedroom_preset_request
data:
option: "{{ desired }}"
- service: climate.set_preset_mode
target:
entity_id: climate.master_bedroom
data:
preset_mode: "{{ desired }}"
- delay: "00:00:30"
- service: input_select.select_option
target:
entity_id: input_select.flounder_master_bedroom_preset_request
data:
option: idle
automation:
- id: flounder_lounge_setpoint_sync
alias: Flounder Lounge Setpoint Sync
mode: restart
trigger:
- platform: state
entity_id: climate.lounge
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: input_boolean.flounder_lounge_setpoint_pending
state: "off"
action:
- variables:
setpoint: "{{ state_attr('climate.lounge', 'temperature') | float(0) }}"
- condition: template
value_template: "{{ setpoint >= 16 }}"
- service: input_number.set_value
target:
entity_id: input_number.lounge_setpoint_ui
data:
value: "{{ setpoint }}"
- id: lounge_hvac_clear_requested_mode
alias: Lounge HVAC - Clear Requested Mode
mode: restart
trigger:
- platform: state
entity_id: climate.lounge
- platform: state
entity_id: input_select.lounge_hvac_requested_mode
to: ["off", heat, cool]
condition:
- condition: template
value_template: "{{ states('input_select.lounge_hvac_requested_mode') != 'none' }}"
action:
- delay: "00:00:03"
- choose:
- conditions: >-
{% set requested = states('input_select.lounge_hvac_requested_mode') %}
{{ requested == states('climate.lounge') }}
sequence:
- service: input_select.select_option
target:
entity_id: input_select.lounge_hvac_requested_mode
data:
option: none
default:
- delay: "00:00:27"
- service: input_select.select_option
target:
entity_id: input_select.lounge_hvac_requested_mode
data:
option: none