openhasp mods and file shuffling
This commit is contained in:
@@ -0,0 +1,126 @@
|
||||
################################################################################
|
||||
# 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
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,245 @@
|
||||
###############################################################################
|
||||
# PACKAGE: OpenHASP Lounge 1 Wall Plate Backlight Control
|
||||
# NODE/TOPIC ROOT: hasp/openhasp_1/
|
||||
#
|
||||
# INTENT:
|
||||
# - Keep backlight control separate from the thermostat/heater UI package.
|
||||
# - Avoid using brightness 0 as the main OFF method.
|
||||
# - Wake the panel with "idle off" before applying brightness.
|
||||
# - Quiet Time overrides everything and forces the backlight OFF.
|
||||
#
|
||||
# OPENHASP NOTES:
|
||||
# - backlight brightness range is 1..255
|
||||
# - backlight off is a state, not a brightness level
|
||||
# - idle off clears idle/sleep state and behaves like a wake-up
|
||||
###############################################################################
|
||||
|
||||
###############################################################################
|
||||
# HELPERS
|
||||
###############################################################################
|
||||
input_boolean:
|
||||
openhasp_1_backlight_enable:
|
||||
name: OpenHASP 1 Backlight Enable
|
||||
icon: mdi:television-ambient-light
|
||||
initial: true
|
||||
|
||||
input_number:
|
||||
openhasp_1_backlight_level:
|
||||
name: OpenHASP 1 Backlight Level
|
||||
min: 1
|
||||
max: 255
|
||||
step: 1
|
||||
mode: slider
|
||||
initial: 255
|
||||
|
||||
###############################################################################
|
||||
# AUTOMATIONS
|
||||
###############################################################################
|
||||
automation:
|
||||
# -------------------------------------------------------------------------
|
||||
# Quiet Time override
|
||||
# - Quiet Time ON -> force backlight OFF
|
||||
# - Quiet Time OFF -> re-apply the requested backlight state
|
||||
# -------------------------------------------------------------------------
|
||||
- id: openhasp_1_backlight_quiet_time_changed
|
||||
alias: "OpenHASP 1: backlight quiet time changed"
|
||||
mode: restart
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: input_boolean.quiet_time
|
||||
action:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: input_boolean.quiet_time
|
||||
state: "on"
|
||||
sequence:
|
||||
- service: script.openhasp_1_backlight_off
|
||||
|
||||
default:
|
||||
- service: script.openhasp_1_backlight_apply_requested_state
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Backlight enable helper changed
|
||||
# - ON -> wake panel and apply current brightness level, unless Quiet Time
|
||||
# - OFF -> tell openHASP to switch the backlight off
|
||||
# -------------------------------------------------------------------------
|
||||
- id: openhasp_1_backlight_enable_changed
|
||||
alias: "OpenHASP 1: backlight enable changed"
|
||||
mode: restart
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: input_boolean.openhasp_1_backlight_enable
|
||||
action:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: input_boolean.openhasp_1_backlight_enable
|
||||
state: "on"
|
||||
- condition: state
|
||||
entity_id: input_boolean.quiet_time
|
||||
state: "off"
|
||||
sequence:
|
||||
- service: script.openhasp_1_backlight_apply
|
||||
|
||||
default:
|
||||
- service: script.openhasp_1_backlight_off
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Backlight level helper changed
|
||||
# - If backlight is enabled and Quiet Time is OFF, apply the new level
|
||||
# - If disabled or Quiet Time is ON, just store the new level for later
|
||||
# -------------------------------------------------------------------------
|
||||
- id: openhasp_1_backlight_level_changed
|
||||
alias: "OpenHASP 1: backlight level changed"
|
||||
mode: restart
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: input_number.openhasp_1_backlight_level
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.openhasp_1_backlight_enable
|
||||
state: "on"
|
||||
- condition: state
|
||||
entity_id: input_boolean.quiet_time
|
||||
state: "off"
|
||||
action:
|
||||
- service: script.openhasp_1_backlight_apply
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Re-apply requested backlight state when Home Assistant starts
|
||||
# Quiet Time is checked inside the script.
|
||||
# -------------------------------------------------------------------------
|
||||
- id: openhasp_1_backlight_on_ha_start
|
||||
alias: "OpenHASP 1: apply backlight on HA start"
|
||||
mode: queued
|
||||
trigger:
|
||||
- platform: homeassistant
|
||||
event: start
|
||||
action:
|
||||
- delay: "00:00:10"
|
||||
- service: script.openhasp_1_backlight_apply_requested_state
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Re-apply requested backlight state when the panel reconnects
|
||||
# Quiet Time is checked inside the script.
|
||||
# -------------------------------------------------------------------------
|
||||
- id: openhasp_1_backlight_on_panel_online
|
||||
alias: "OpenHASP 1: apply backlight on panel online"
|
||||
mode: queued
|
||||
trigger:
|
||||
- platform: mqtt
|
||||
topic: "hasp/openhasp_1/LWT"
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ trigger.payload == 'online' }}"
|
||||
action:
|
||||
- delay: "00:00:05"
|
||||
- service: script.openhasp_1_backlight_apply_requested_state
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# If openHASP enters idle while HA says the backlight should be enabled,
|
||||
# wake it and re-apply the requested brightness.
|
||||
#
|
||||
# Quiet Time blocks this recovery, so the panel stays dark overnight.
|
||||
# -------------------------------------------------------------------------
|
||||
- id: openhasp_1_backlight_recover_from_idle
|
||||
alias: "OpenHASP 1: recover backlight from idle"
|
||||
mode: restart
|
||||
trigger:
|
||||
- platform: mqtt
|
||||
topic: "hasp/openhasp_1/state/idle"
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.openhasp_1_backlight_enable
|
||||
state: "on"
|
||||
- condition: state
|
||||
entity_id: input_boolean.quiet_time
|
||||
state: "off"
|
||||
- condition: template
|
||||
value_template: "{{ trigger.payload | lower != 'off' }}"
|
||||
action:
|
||||
- delay: "00:00:01"
|
||||
- service: script.openhasp_1_backlight_apply
|
||||
|
||||
###############################################################################
|
||||
# SCRIPTS
|
||||
###############################################################################
|
||||
script:
|
||||
# -------------------------------------------------------------------------
|
||||
# Apply current requested brightness.
|
||||
#
|
||||
# Important:
|
||||
# - Send idle off first so the panel is awake.
|
||||
# - Then send a JSON backlight command with state ON and brightness 1..255.
|
||||
# -------------------------------------------------------------------------
|
||||
openhasp_1_backlight_apply:
|
||||
alias: "OpenHASP 1: apply backlight level"
|
||||
mode: restart
|
||||
sequence:
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: "hasp/openhasp_1/command"
|
||||
payload: "idle off"
|
||||
|
||||
- delay: "00:00:00.25"
|
||||
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: "hasp/openhasp_1/command"
|
||||
payload: >
|
||||
backlight {"state":"on","brightness":{{ states('input_number.openhasp_1_backlight_level') | int(255) }}}
|
||||
|
||||
# Send once more shortly after. This helps with panels that miss the
|
||||
# brightness change while coming out of idle.
|
||||
- delay: "00:00:00.75"
|
||||
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: "hasp/openhasp_1/command"
|
||||
payload: >
|
||||
backlight {"state":"on","brightness":{{ states('input_number.openhasp_1_backlight_level') | int(255) }}}
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Turn the backlight off using the openHASP backlight OFF state.
|
||||
# Do not set brightness to 0.
|
||||
# -------------------------------------------------------------------------
|
||||
openhasp_1_backlight_off:
|
||||
alias: "OpenHASP 1: backlight off"
|
||||
mode: restart
|
||||
sequence:
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: "hasp/openhasp_1/command"
|
||||
payload: "backlight off"
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Apply either ON/current-level or OFF according to helper state.
|
||||
# Used on HA startup, panel reconnect, and Quiet Time changes.
|
||||
#
|
||||
# Priority:
|
||||
# 1. Quiet Time ON -> backlight OFF
|
||||
# 2. Backlight Enable ON -> apply current level
|
||||
# 3. Backlight Enable OFF -> backlight OFF
|
||||
# -------------------------------------------------------------------------
|
||||
openhasp_1_backlight_apply_requested_state:
|
||||
alias: "OpenHASP 1: apply requested backlight state"
|
||||
mode: restart
|
||||
sequence:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: input_boolean.quiet_time
|
||||
state: "on"
|
||||
sequence:
|
||||
- service: script.openhasp_1_backlight_off
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: input_boolean.openhasp_1_backlight_enable
|
||||
state: "on"
|
||||
sequence:
|
||||
- service: script.openhasp_1_backlight_apply
|
||||
|
||||
default:
|
||||
- service: script.openhasp_1_backlight_off
|
||||
Reference in New Issue
Block a user