############################################################################### # PACKAGE: OpenHASP Thermostat / Gas Heater Control # NODE/TOPIC ROOT: hasp/openhasp_1/ # # PAGE OBJECTS USED # - p1b1 = main temperature display # - p1b2 = setpoint display # - p1b3 = setpoint down # - p1b4 = setpoint up # - p1b5 = heater status text # - p1b6 = heater operation / flame button # - p1b7 = humidity display ############################################################################### ############################################################################### # HELPERS ############################################################################### ############################################################################### # MQTT ENTITIES ############################################################################### mqtt: sensor: - name: "Lounge Environment Humidity MQTT" unique_id: "lounge_environment_humidity_mqtt" state_topic: "viewroad-status/lounge-environment/humidity" value_template: > {% set raw = value | trim %} {% if raw.startswith('{') %} {% set j = raw | from_json %} {{ j.humidity | default(j.value | default(raw)) }} {% else %} {{ raw | replace('%', '') | trim }} {% endif %} ############################################################################### # 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 --' }} # ------------------------------------------------------------------------- # Setpoint display on left side of centre row # - Strips any existing units so only one °C is shown # ------------------------------------------------------------------------- - id: hasp_setpoint_to_btn_text alias: "HASP: update setpoint (p1b2.text)" mode: queued trigger: - platform: state entity_id: sensor.rinnai_neo_gas_heater_setpoint_text action: - service: mqtt.publish data: topic: "hasp/openhasp_1/command/p1b2.text" payload: > {% set raw = states('sensor.rinnai_neo_gas_heater_setpoint_text') %} {% set cleaned = raw | replace('°C', '') | replace('° C', '') | replace('C', '') | trim %} {% if cleaned not in ['unknown', 'unavailable', '', 'none', 'None'] %} Set: {{ cleaned | float(0) | round(1) }}°C {% else %} Set: -- °C {% endif %} # ------------------------------------------------------------------------- # Humidity display on right side of centre row # ------------------------------------------------------------------------- - id: hasp_humidity_to_btn_text alias: "HASP: update humidity (p1b7.text)" mode: queued trigger: - platform: state entity_id: sensor.lounge_environment_humidity_mqtt action: - service: mqtt.publish data: topic: "hasp/openhasp_1/command/p1b7.text" payload: > {% set raw = states('sensor.lounge_environment_humidity_mqtt') %} {% set cleaned = raw | replace('%', '') | trim %} {% if cleaned in ['unknown', 'unavailable', '', 'none', 'None'] %} Hum: Unknown {% else %} Hum: {{ cleaned }}% {% endif %} # ------------------------------------------------------------------------- # 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 # ------------------------------------------------------------------------- # 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 ############################################################################### # 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: # Push Set/Hum display styling first, so the centre row is not blue - service: script.hasp_style_center_info_buttons - 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 raw = states('sensor.rinnai_neo_gas_heater_setpoint_text') %} {% set cleaned = raw | replace('°C', '') | replace('° C', '') | replace('C', '') | trim %} {% if cleaned not in ['unknown', 'unavailable', '', 'none', 'None'] %} Set: {{ cleaned | float(0) | round(1) }}°C {% else %} Set: -- °C {% endif %} - service: mqtt.publish data: topic: "hasp/openhasp_1/command/p1b7.text" payload: > {% set raw = states('sensor.lounge_environment_humidity_mqtt') %} {% set cleaned = raw | replace('%', '') | trim %} {% if cleaned in ['unknown', 'unavailable', '', 'none', 'None'] %} Hum: Unknown {% else %} Hum: {{ cleaned }}% {% endif %} # 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" # ------------------------------------------------------------------------- # Style centre row info buttons as text panels # - p1b2 = setpoint # - p1b7 = humidity # This removes the default blue button styling from these display-only fields. # ------------------------------------------------------------------------- hasp_style_center_info_buttons: alias: "HASP: style centre info buttons" mode: queued sequence: - service: mqtt.publish data: topic: "hasp/openhasp_1/command/p1b2.text_color" payload: "#FFFFFF" - service: mqtt.publish data: topic: "hasp/openhasp_1/command/p1b2.bg_color" payload: "#000000" - service: mqtt.publish data: topic: "hasp/openhasp_1/command/p1b2.bg_grad_color" payload: "#000000" - service: mqtt.publish data: topic: "hasp/openhasp_1/command/p1b2.border_color" payload: "#000000" - service: mqtt.publish data: topic: "hasp/openhasp_1/command/p1b7.text_color" payload: "#FFFFFF" - service: mqtt.publish data: topic: "hasp/openhasp_1/command/p1b7.bg_color" payload: "#000000" - service: mqtt.publish data: topic: "hasp/openhasp_1/command/p1b7.bg_grad_color" payload: "#000000" - service: mqtt.publish data: topic: "hasp/openhasp_1/command/p1b7.border_color" payload: "#000000"