127 lines
4.2 KiB
YAML
127 lines
4.2 KiB
YAML
################################################################################
|
|
# OPENHASP HEAT AUTO PAGE
|
|
################################################################################
|
|
# Package: openhasp_heat_auto_page.yaml
|
|
# Version: v1.1.0
|
|
# Updated: 2026-06-20
|
|
#
|
|
# Purpose:
|
|
# Automatically changes the openHASP display page based on lounge heating/cooling.
|
|
#
|
|
# Behaviour:
|
|
# - Gas fire ON -> openHASP page 1
|
|
# - Lounge heatpump HEAT mode -> openHASP page 2
|
|
# - Lounge heatpump COOL mode -> openHASP page 3
|
|
#
|
|
# Priority:
|
|
# 1. Gas fire
|
|
# 2. Lounge heatpump heating
|
|
# 3. Lounge heatpump cooling
|
|
#
|
|
# Notes:
|
|
# - If nothing is heating/cooling, this package does not change the page.
|
|
# - openHASP page change is sent via MQTT:
|
|
# hasp/openhasp_1/command/page
|
|
#
|
|
################################################################################
|
|
|
|
################################################################################
|
|
# SCRIPT
|
|
################################################################################
|
|
|
|
script:
|
|
openhasp_heat_auto_page_evaluate:
|
|
alias: "openHASP Heat Auto Page - Evaluate"
|
|
description: "Chooses the correct openHASP page based on gas fire and lounge heatpump state."
|
|
mode: restart
|
|
|
|
variables:
|
|
##########################################################################
|
|
# CONFIG
|
|
##########################################################################
|
|
|
|
openhasp_page_topic: "hasp/openhasp_1/command/page"
|
|
|
|
gas_fire_entity: "switch.rinnai_neo_gas_heater_heater_operation"
|
|
lounge_heatpump_entity: "climate.lounge"
|
|
|
|
##########################################################################
|
|
# STATE CHECKS
|
|
##########################################################################
|
|
|
|
gas_fire_on: >-
|
|
{{ is_state(gas_fire_entity, 'on') }}
|
|
|
|
lounge_heatpump_heat: >-
|
|
{{ is_state(lounge_heatpump_entity, 'heat') }}
|
|
|
|
lounge_heatpump_cool: >-
|
|
{{ is_state(lounge_heatpump_entity, 'cool') }}
|
|
|
|
target_page: >-
|
|
{% if gas_fire_on %}
|
|
1
|
|
{% elif lounge_heatpump_heat %}
|
|
2
|
|
{% elif lounge_heatpump_cool %}
|
|
3
|
|
{% else %}
|
|
none
|
|
{% endif %}
|
|
|
|
sequence:
|
|
- condition: template
|
|
value_template: "{{ target_page != 'none' }}"
|
|
|
|
- action: mqtt.publish
|
|
data:
|
|
topic: "{{ openhasp_page_topic }}"
|
|
payload: "{{ target_page }}"
|
|
qos: 0
|
|
retain: false
|
|
|
|
################################################################################
|
|
# AUTOMATIONS
|
|
################################################################################
|
|
|
|
automation:
|
|
- id: openhasp_heat_auto_page_change
|
|
alias: "openHASP Heat Auto Page - Change Page"
|
|
description: "Changes the openHASP page when the gas fire or lounge heatpump state changes."
|
|
mode: restart
|
|
|
|
triggers:
|
|
##########################################################################
|
|
# Gas fire state changes
|
|
##########################################################################
|
|
- trigger: state
|
|
entity_id: switch.rinnai_neo_gas_heater_heater_operation
|
|
|
|
##########################################################################
|
|
# Lounge heatpump HVAC mode changes
|
|
##########################################################################
|
|
- trigger: state
|
|
entity_id: climate.lounge
|
|
|
|
##########################################################################
|
|
# Re-apply after Home Assistant restart
|
|
##########################################################################
|
|
- trigger: homeassistant
|
|
event: start
|
|
|
|
##########################################################################
|
|
# Re-apply when the openHASP display comes online
|
|
##########################################################################
|
|
- trigger: mqtt
|
|
topic: hasp/openhasp_1/status
|
|
payload: online
|
|
|
|
actions:
|
|
- if:
|
|
- condition: template
|
|
value_template: "{{ trigger.platform in ['homeassistant', 'mqtt'] }}"
|
|
then:
|
|
- delay: "00:00:02"
|
|
|
|
- action: script.openhasp_heat_auto_page_evaluate
|