487 lines
18 KiB
YAML
487 lines
18 KiB
YAML
###############################################################################
|
|
# PACKAGE: OpenHASP Thermostat / Gas Heater Control
|
|
# NODE/TOPIC ROOT: hasp/openhasp_1/
|
|
#
|
|
# PAGE OBJECTS USED
|
|
# - p1b1 = main temperature display
|
|
# - p1b2 = alternating Setpoint / Humidity display
|
|
# - p1b3 = setpoint down
|
|
# - p1b4 = setpoint up
|
|
# - p1b5 = heater status text
|
|
# - p1b6 = heater operation / flame button
|
|
###############################################################################
|
|
|
|
###############################################################################
|
|
# HELPERS
|
|
###############################################################################
|
|
input_boolean:
|
|
hasp_setpoint_hold_active:
|
|
name: HASP Setpoint Hold Active
|
|
initial: false
|
|
|
|
input_number:
|
|
# How long Setpoint and Humidity are each shown before rotating
|
|
hasp_setpoint_humidity_cycle_seconds:
|
|
name: HASP Setpoint Humidity Cycle Seconds
|
|
min: 1
|
|
max: 60
|
|
step: 1
|
|
mode: box
|
|
unit_of_measurement: s
|
|
initial: 10
|
|
|
|
# After the setpoint changes, hold the setpoint screen for this long
|
|
hasp_setpoint_hold_seconds:
|
|
name: HASP Setpoint Hold Seconds
|
|
min: 1
|
|
max: 60
|
|
step: 1
|
|
mode: box
|
|
unit_of_measurement: s
|
|
initial: 15
|
|
|
|
###############################################################################
|
|
# MQTT ENTITIES
|
|
###############################################################################
|
|
mqtt:
|
|
sensor:
|
|
- name: "Lounge Environment Humidity MQTT"
|
|
unique_id: "lounge_environment_humidity_mqtt"
|
|
state_topic: "viewroad-status/lounge-environment/humidity"
|
|
|
|
###############################################################################
|
|
# AUTOMATIONS
|
|
###############################################################################
|
|
automation:
|
|
# -------------------------------------------------------------------------
|
|
# Main temperature display
|
|
# - Shows normal lounge temperature
|
|
# - Normalises values so we do not get duplicated °C or long float strings
|
|
# -------------------------------------------------------------------------
|
|
- id: hasp_temp_to_btn_text
|
|
alias: "HASP: update temp (p1b1.text)"
|
|
mode: queued
|
|
trigger:
|
|
- platform: state
|
|
entity_id: sensor.lounge_environment_lounge_environment_temperature
|
|
action:
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b1.text"
|
|
payload: >
|
|
{% set raw = states('sensor.lounge_environment_lounge_environment_temperature') %}
|
|
{% set cleaned = raw
|
|
| replace('°C', '')
|
|
| replace('° C', '')
|
|
| replace('C', '')
|
|
| trim %}
|
|
{% if cleaned not in ['unknown', 'unavailable', '', 'none', 'None'] %}
|
|
{{ cleaned | float(0) | round(1) }} °C
|
|
{% else %}
|
|
-- °C
|
|
{% endif %}
|
|
|
|
# -------------------------------------------------------------------------
|
|
# Heater status text at bottom of screen
|
|
# -------------------------------------------------------------------------
|
|
- id: hasp_heater_status_to_btn_text
|
|
alias: "HASP: update heater status (p1b5.text)"
|
|
mode: queued
|
|
trigger:
|
|
- platform: state
|
|
entity_id: sensor.rinnai_neo_gas_heater_rinnai_neo_gas_heater_status_text
|
|
action:
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b5.text"
|
|
payload: >
|
|
{% set s = states('sensor.rinnai_neo_gas_heater_rinnai_neo_gas_heater_status_text') %}
|
|
{{ s if s not in ['unknown', 'unavailable', ''] else 'HEATER --' }}
|
|
|
|
# -------------------------------------------------------------------------
|
|
# When setpoint changes:
|
|
# - immediately show Setpoint
|
|
# - hold it for hold_seconds
|
|
# - then allow normal Setpoint/Humidity rotation again
|
|
# -------------------------------------------------------------------------
|
|
- id: hasp_setpoint_changed_hold_display
|
|
alias: "HASP: show setpoint immediately and hold"
|
|
mode: restart
|
|
trigger:
|
|
- platform: state
|
|
entity_id: sensor.rinnai_neo_gas_heater_setpoint_text
|
|
action:
|
|
- service: input_boolean.turn_on
|
|
target:
|
|
entity_id: input_boolean.hasp_setpoint_hold_active
|
|
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b2.text"
|
|
payload: >
|
|
{% set s = states('sensor.rinnai_neo_gas_heater_setpoint_text') %}
|
|
{{ 'Setpoint: ' ~ (s if s not in ['unknown', 'unavailable', ''] else '--') }}
|
|
|
|
- delay:
|
|
seconds: "{{ states('input_number.hasp_setpoint_hold_seconds') | int(15) }}"
|
|
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.hasp_setpoint_hold_active
|
|
|
|
# -------------------------------------------------------------------------
|
|
# Up / Down buttons on the HASP plate
|
|
# These call the existing HA button entities
|
|
# -------------------------------------------------------------------------
|
|
- id: hasp_btn_up_press
|
|
alias: "HASP: p1b4 up -> heater setpoint UP"
|
|
mode: queued
|
|
trigger:
|
|
- platform: mqtt
|
|
topic: "hasp/openhasp_1/state/p1b4"
|
|
condition:
|
|
- condition: template
|
|
value_template: "{{ trigger.payload_json.event | default('') == 'up' }}"
|
|
action:
|
|
- service: button.press
|
|
target:
|
|
entity_id: button.rinnai_neo_gas_heater_rinnai_neo_gas_heater_setpoint_up
|
|
|
|
- id: hasp_btn_down_press
|
|
alias: "HASP: p1b3 up -> heater setpoint DOWN"
|
|
mode: queued
|
|
trigger:
|
|
- platform: mqtt
|
|
topic: "hasp/openhasp_1/state/p1b3"
|
|
condition:
|
|
- condition: template
|
|
value_template: "{{ trigger.payload_json.event | default('') == 'up' }}"
|
|
action:
|
|
- service: button.press
|
|
target:
|
|
entity_id: button.rinnai_neo_gas_heater_rinnai_neo_gas_heater_setpoint_down
|
|
|
|
# -------------------------------------------------------------------------
|
|
# Middle flame button
|
|
# - Tap toggles heater operation
|
|
# -------------------------------------------------------------------------
|
|
- id: hasp_btn_heat_toggle
|
|
alias: "HASP: p1b6 up -> heater operation toggle"
|
|
mode: queued
|
|
trigger:
|
|
- platform: mqtt
|
|
topic: "hasp/openhasp_1/state/p1b6"
|
|
condition:
|
|
- condition: template
|
|
value_template: "{{ trigger.payload_json.event | default('') == 'up' }}"
|
|
action:
|
|
- service: switch.toggle
|
|
target:
|
|
entity_id: switch.rinnai_neo_gas_heater_heater_operation
|
|
|
|
# -------------------------------------------------------------------------
|
|
# Flame button appearance
|
|
# - Operation OFF: dark grey background, light grey flame
|
|
# - Operation ON, Activate Flame OFF: theme blue background, white flame
|
|
# - Operation ON, Activate Flame ON: theme blue background, solid red flame
|
|
# -------------------------------------------------------------------------
|
|
- id: hasp_heat_button_state
|
|
alias: "HASP: update heat button state (p1b6)"
|
|
mode: restart
|
|
trigger:
|
|
- platform: state
|
|
entity_id:
|
|
- switch.rinnai_neo_gas_heater_heater_operation
|
|
- switch.rinnai_neo_gas_heater_rinnai_neo_gas_heater_activate_flame
|
|
action:
|
|
- choose:
|
|
# Heater Operation OFF -> dark grey button, light grey flame
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: switch.rinnai_neo_gas_heater_heater_operation
|
|
state: "off"
|
|
sequence:
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.text"
|
|
payload: "\uE238"
|
|
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.text_color"
|
|
payload: "#C0C0C0"
|
|
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.bg_color"
|
|
payload: "#2F3240"
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.bg_grad_color"
|
|
payload: "#2F3240"
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.border_color"
|
|
payload: "#2F3240"
|
|
|
|
# Heater Operation ON, flame OFF -> blue button, white flame
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: switch.rinnai_neo_gas_heater_heater_operation
|
|
state: "on"
|
|
- condition: state
|
|
entity_id: switch.rinnai_neo_gas_heater_rinnai_neo_gas_heater_activate_flame
|
|
state: "off"
|
|
sequence:
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.text"
|
|
payload: "\uE238"
|
|
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.text_color"
|
|
payload: "#FFFFFF"
|
|
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.bg_color"
|
|
payload: "#0095D9"
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.bg_grad_color"
|
|
payload: "#00B6FF"
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.border_color"
|
|
payload: "#0095D9"
|
|
|
|
# Heater Operation ON, flame ON -> blue button, red flame
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: switch.rinnai_neo_gas_heater_heater_operation
|
|
state: "on"
|
|
- condition: state
|
|
entity_id: switch.rinnai_neo_gas_heater_rinnai_neo_gas_heater_activate_flame
|
|
state: "on"
|
|
sequence:
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.text"
|
|
payload: "\uE238"
|
|
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.text_color"
|
|
payload: "#FF3030"
|
|
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.bg_color"
|
|
payload: "#0095D9"
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.bg_grad_color"
|
|
payload: "#00B6FF"
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.border_color"
|
|
payload: "#0095D9"
|
|
|
|
# -------------------------------------------------------------------------
|
|
# Start / restart display when HA starts
|
|
# -------------------------------------------------------------------------
|
|
- id: hasp_start_on_ha_start
|
|
alias: "HASP: start display loop on HA start"
|
|
trigger:
|
|
- platform: homeassistant
|
|
event: start
|
|
action:
|
|
- service: script.hasp_push_static_texts
|
|
- service: script.turn_on
|
|
target:
|
|
entity_id: script.hasp_rotate_setpoint_humidity
|
|
|
|
# -------------------------------------------------------------------------
|
|
# Re-push screen state when panel comes online
|
|
# -------------------------------------------------------------------------
|
|
- id: hasp_start_on_panel_online
|
|
alias: "HASP: start display loop when panel goes online"
|
|
trigger:
|
|
- platform: mqtt
|
|
topic: "hasp/openhasp_1/LWT"
|
|
condition:
|
|
- condition: template
|
|
value_template: "{{ trigger.payload == 'online' }}"
|
|
action:
|
|
- delay: "00:00:05"
|
|
- service: script.hasp_push_static_texts
|
|
- service: script.turn_on
|
|
target:
|
|
entity_id: script.hasp_rotate_setpoint_humidity
|
|
|
|
###############################################################################
|
|
# SCRIPTS
|
|
###############################################################################
|
|
script:
|
|
# -------------------------------------------------------------------------
|
|
# Push all current values / colours to the panel
|
|
# Useful on HA startup and panel reconnect
|
|
# -------------------------------------------------------------------------
|
|
hasp_push_static_texts:
|
|
alias: "HASP: push static texts"
|
|
mode: queued
|
|
sequence:
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b1.text"
|
|
payload: >
|
|
{% set raw = states('sensor.lounge_environment_lounge_environment_temperature') %}
|
|
{% set cleaned = raw
|
|
| replace('°C', '')
|
|
| replace('° C', '')
|
|
| replace('C', '')
|
|
| trim %}
|
|
{% if cleaned not in ['unknown', 'unavailable', '', 'none', 'None'] %}
|
|
{{ cleaned | float(0) | round(1) }} °C
|
|
{% else %}
|
|
-- °C
|
|
{% endif %}
|
|
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b5.text"
|
|
payload: >
|
|
{% set s = states('sensor.rinnai_neo_gas_heater_rinnai_neo_gas_heater_status_text') %}
|
|
{{ s if s not in ['unknown', 'unavailable', ''] else 'HEATER --' }}
|
|
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b2.text"
|
|
payload: >
|
|
{% set s = states('sensor.rinnai_neo_gas_heater_setpoint_text') %}
|
|
{{ 'Setpoint: ' ~ (s if s not in ['unknown', 'unavailable', ''] else '--') }}
|
|
|
|
# Push middle flame button state
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.text"
|
|
payload: "\uE238"
|
|
|
|
- choose:
|
|
# Heater Operation OFF -> dark grey button, light grey flame
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: switch.rinnai_neo_gas_heater_heater_operation
|
|
state: "off"
|
|
sequence:
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.text_color"
|
|
payload: "#C0C0C0"
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.bg_color"
|
|
payload: "#2F3240"
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.bg_grad_color"
|
|
payload: "#2F3240"
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.border_color"
|
|
payload: "#2F3240"
|
|
|
|
# Heater Operation ON, flame OFF -> blue button, white flame
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: switch.rinnai_neo_gas_heater_heater_operation
|
|
state: "on"
|
|
- condition: state
|
|
entity_id: switch.rinnai_neo_gas_heater_rinnai_neo_gas_heater_activate_flame
|
|
state: "off"
|
|
sequence:
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.text_color"
|
|
payload: "#FFFFFF"
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.bg_color"
|
|
payload: "#0095D9"
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.bg_grad_color"
|
|
payload: "#00B6FF"
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.border_color"
|
|
payload: "#0095D9"
|
|
|
|
# Heater Operation ON, flame ON -> blue button, red flame
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: switch.rinnai_neo_gas_heater_heater_operation
|
|
state: "on"
|
|
- condition: state
|
|
entity_id: switch.rinnai_neo_gas_heater_rinnai_neo_gas_heater_activate_flame
|
|
state: "on"
|
|
sequence:
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.text_color"
|
|
payload: "#FF3030"
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.bg_color"
|
|
payload: "#0095D9"
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.bg_grad_color"
|
|
payload: "#00B6FF"
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b6.border_color"
|
|
payload: "#0095D9"
|
|
|
|
# -------------------------------------------------------------------------
|
|
# Rotate the middle information line between Setpoint and Humidity
|
|
# Pauses humidity display while the setpoint hold flag is active
|
|
# -------------------------------------------------------------------------
|
|
hasp_rotate_setpoint_humidity:
|
|
alias: "HASP: rotate setpoint and humidity"
|
|
mode: restart
|
|
sequence:
|
|
- repeat:
|
|
while:
|
|
- condition: template
|
|
value_template: "{{ true }}"
|
|
sequence:
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b2.text"
|
|
payload: >
|
|
{% set s = states('sensor.rinnai_neo_gas_heater_setpoint_text') %}
|
|
{{ 'Setpoint: ' ~ (s if s not in ['unknown', 'unavailable', ''] else '--') }}
|
|
|
|
- delay:
|
|
seconds: "{{ states('input_number.hasp_setpoint_humidity_cycle_seconds') | int(10) }}"
|
|
|
|
- condition: state
|
|
entity_id: input_boolean.hasp_setpoint_hold_active
|
|
state: "off"
|
|
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b2.text"
|
|
payload: >
|
|
{% set h = states('sensor.lounge_environment_humidity_mqtt') %}
|
|
{% if h in ['unknown', 'unavailable', ''] %}
|
|
Humidity: Unknown
|
|
{% else %}
|
|
Humidity: {{ h }}%
|
|
{% endif %}
|
|
|
|
- delay:
|
|
seconds: "{{ states('input_number.hasp_setpoint_humidity_cycle_seconds') | int(10) }}"
|