132 lines
4.1 KiB
Plaintext
132 lines
4.1 KiB
Plaintext
###############################################################################
|
|
# PACKAGE: OpenHASP Thermostat (MQTT-only, all BUTTON objects)
|
|
# NODE/TOPIC ROOT: hasp/openhasp_1/
|
|
###############################################################################
|
|
|
|
input_number:
|
|
lounge_setpoint:
|
|
name: Lounge Setpoint
|
|
min: 10
|
|
max: 30
|
|
step: 0.5
|
|
mode: box
|
|
unit_of_measurement: "C"
|
|
|
|
###############################################################################
|
|
# AUTOMATIONS
|
|
###############################################################################
|
|
automation:
|
|
# --- PUSH LABEL TEXTS (on buttons) ----------------------------------------
|
|
- id: hasp_temp_to_btn_text
|
|
alias: "HASP: update temp (p1b1.text)"
|
|
mode: queued
|
|
trigger:
|
|
- platform: state
|
|
entity_id: sensor.lounge_inside_temperature
|
|
action:
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b1.text"
|
|
payload: "{{ states('sensor.lounge_inside_temperature')|float(0)|round(1) }} C"
|
|
|
|
- id: hasp_setpoint_to_btn_text
|
|
alias: "HASP: update setpoint (p1b2.text)"
|
|
mode: queued
|
|
trigger:
|
|
- platform: state
|
|
entity_id: input_number.lounge_setpoint
|
|
action:
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b2.text"
|
|
payload: "Set: {{ states('input_number.lounge_setpoint')|float(0)|round(1) }} C"
|
|
|
|
- id: hasp_heater_status_to_btn_text
|
|
alias: "HASP: update heater status (p1b5.text)"
|
|
mode: queued
|
|
trigger:
|
|
- platform: state
|
|
entity_id: switch.lounge_heater
|
|
action:
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b5.text"
|
|
payload: >
|
|
{% if is_state('sensor.gas_heater_operating','ON') %}
|
|
HEAT ON
|
|
{% else %}
|
|
HEAT OFF
|
|
{% endif %}
|
|
|
|
# --- BUTTON HANDLING FROM THE PLATE (listens on /state/) ------------------
|
|
- id: hasp_btn_up_increment
|
|
alias: "HASP: p1b3 up -> increment setpoint"
|
|
mode: queued
|
|
trigger:
|
|
- platform: mqtt
|
|
topic: "hasp/openhasp_1/state/p1b4"
|
|
condition:
|
|
- condition: template
|
|
value_template: "{{ trigger.payload_json.event|default('') == 'up' }}"
|
|
action:
|
|
- service: input_number.increment
|
|
target:
|
|
entity_id: input_number.lounge_setpoint
|
|
|
|
- id: hasp_btn_down_decrement
|
|
alias: "HASP: p1b4 up -> decrement setpoint"
|
|
mode: queued
|
|
trigger:
|
|
- platform: mqtt
|
|
topic: "hasp/openhasp_1/state/p1b3"
|
|
condition:
|
|
- condition: template
|
|
value_template: "{{ trigger.payload_json.event|default('') == 'up' }}"
|
|
action:
|
|
- service: input_number.decrement
|
|
target:
|
|
entity_id: input_number.lounge_setpoint
|
|
|
|
# --- PUSH INITIAL VALUES ON HA START / PANEL ONLINE -----------------------
|
|
- id: hasp_push_on_ha_start
|
|
alias: "HASP: push texts on HA start"
|
|
trigger:
|
|
- platform: homeassistant
|
|
event: start
|
|
action:
|
|
- service: script.hasp_push_all_texts
|
|
|
|
- id: hasp_push_on_plate_birth
|
|
alias: "HASP: push texts on panel birth"
|
|
trigger:
|
|
- platform: mqtt
|
|
topic: "hasp/openhasp_1/state"
|
|
action:
|
|
- service: script.hasp_push_all_texts
|
|
|
|
###############################################################################
|
|
# SCRIPT: Push all texts to buttons
|
|
###############################################################################
|
|
script:
|
|
hasp_push_all_texts:
|
|
alias: "HASP: push all texts"
|
|
mode: queued
|
|
sequence:
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b1.text"
|
|
payload: "{{ states('sensor.lounge_inside_temperature')|float(0)|round(1) }} C"
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b2.text"
|
|
payload: "Set: {{ states('input_number.lounge_setpoint')|float(0)|round(1) }} C"
|
|
- service: mqtt.publish
|
|
data:
|
|
topic: "hasp/openhasp_1/command/p1b5.text"
|
|
payload: >
|
|
{% if is_state('sensor.gas_heater_operating','ON') %}
|
|
HEAT ON
|
|
{% else %}
|
|
HEAT OFF
|
|
{% endif %}
|