Files

hasp_plate01_p9_hvac.yaml
############################################################################## # Automations for handling climate controls on page 9 automation: # Set font and text labels for scene buttons on device connection - alias: hasp_plate01_p9_HVACInit trigger: - platform: state entity_id: "binary_sensor.plate01_connected" to: "on" - platform: homeassistant event: start action: - service: mqtt.publish data: topic: "hasp/plate01/command/json" payload_template: >- ["p[9].b[4].font=6","p[9].b[4].txt=\"Mode\"", "p[9].b[5].font=6", "p[9].b[6].font=10","p[9].b[6].ycen=2", "p[9].b[7].font=7","p[9].b[7].bco=63488","p[9].b[7].txt=\"\"", "p[9].b[8].font=7","p[9].b[8].bco=31","p[9].b[8].txt=\"\"", "p[9].b[9].font=10","p[9].b[9].pco=63488","p[9].b[9].ycen=2", "p[9].b[10].font=7","p[9].b[10].bco=63488","p[9].b[10].txt=\"\"", "p[9].b[11].font=7","p[9].b[11].bco=31","p[9].b[11].txt=\"\"", "p[9].b[12].font=10","p[9].b[12].pco=31","p[9].b[12].ycen=2"] - service: mqtt.publish data: topic: "hasp/plate01/command/p[9].b[5].txt" payload_template: '"{{ states("climate.mqtt_hvac")|replace("fan_only","Fan")|replace("_"," ")|title }}"' - service: mqtt.publish data: topic: "hasp/plate01/command/p[9].b[6].txt" payload_template: '" {{ state_attr("climate.mqtt_hvac", "temperature") }}°"' - service: mqtt.publish data: topic: "hasp/plate01/command/p[9].b[9].txt" payload_template: '" {{ state_attr("climate.mqtt_hvac", "target_temp_high") }}°"' - service: mqtt.publish data: topic: "hasp/plate01/command/p[9].b[12].txt" payload_template: '" {{ state_attr("climate.mqtt_hvac", "target_temp_low") }}°"' - alias: hasp_plate01_p9_UpdateHVACMode trigger: - platform: state entity_id: "climate.mqtt_hvac" action: - service: mqtt.publish data: topic: "hasp/plate01/command/p[9].b[5].txt" payload_template: '"{{ states("climate.mqtt_hvac")|replace("fan_only","Fan")|replace("_"," ")|title }}"' # Catch either of the "mode" buttons, iterate through the list of supported modes, and # select the next one in the list or loop back to the beginning if it's the last item - alias: hasp_plate01_p9_CycleHVACMode trigger: - platform: mqtt topic: "hasp/plate01/state/p[9].b[4]" payload: "ON" - platform: mqtt topic: "hasp/plate01/state/p[9].b[5]" payload: "ON" action: - service: climate.set_hvac_mode entity_id: "climate.mqtt_hvac" data_template: hvac_mode: >- {% for mode in state_attr("climate.mqtt_hvac", "hvac_modes") %} {% if mode == states("climate.mqtt_hvac") %} {% if loop.last %} {{ state_attr("climate.mqtt_hvac", "hvac_modes")[0] }} {% else %} {{ state_attr("climate.mqtt_hvac", "hvac_modes")[loop.index] }} {% endif %} {% endif %} {% endfor %} # Display current HVAC temp on HASP when updated in Home Assistant - alias: hasp_plate01_p9_UpdateHVACTemp trigger: platform: state entity_id: "climate.mqtt_hvac" condition: condition: template value_template: '{{ trigger.from_state and trigger.to_state.attributes.temperature != trigger.from_state.attributes.temperature }}' action: - service: mqtt.publish data: topic: "hasp/plate01/command/p[9].b[6].txt" payload_template: '" {{ state_attr("climate.mqtt_hvac", "temperature") }}°"' # Display current HVAC high temp set point on HASP when updated in Home Assistant - alias: hasp_plate01_p9_UpdateHVACTempHigh trigger: platform: state entity_id: "climate.mqtt_hvac" condition: condition: template value_template: '{{ trigger.from_state and trigger.to_state.attributes.target_temp_high != trigger.from_state.attributes.target_temp_high }}' action: - service: mqtt.publish data: topic: "hasp/plate01/command/p[9].b[9].txt" payload_template: '" {{ state_attr("climate.mqtt_hvac", "target_temp_high") }}°"' # Display current HVAC low temp set point on HASP when updated in Home Assistant - alias: hasp_plate01_p9_UpdateHVACTempLow trigger: platform: state entity_id: "climate.mqtt_hvac" condition: condition: template value_template: '{{ trigger.from_state and trigger.to_state.attributes.target_temp_low != trigger.from_state.attributes.target_temp_low }}' action: - service: mqtt.publish data: topic: "hasp/plate01/command/p[9].b[12].txt" payload_template: '" {{ state_attr("climate.mqtt_hvac", "target_temp_low") }}°"' # Increment HVAC high temp set point when p[9].b[7] is pressed - alias: hasp_plate01_p9_SetHVACTempHighPlus trigger: - platform: mqtt topic: "hasp/plate01/state/p[9].b[7]" payload: "ON" action: - service: climate.set_temperature entity_id: "climate.mqtt_hvac" data_template: target_temp_high: '{{ state_attr("climate.mqtt_hvac", "target_temp_high") + 1 | int}}' target_temp_low: '{{ state_attr("climate.mqtt_hvac", "target_temp_low") | int}}' # Decrement HVAC high temp set point when p[9].b[8] is pressed - alias: hasp_plate01_p9_SetHVACTempHighMinus trigger: - platform: mqtt topic: "hasp/plate01/state/p[9].b[8]" payload: "ON" action: - service: climate.set_temperature entity_id: "climate.mqtt_hvac" data_template: target_temp_high: '{{ state_attr("climate.mqtt_hvac", "target_temp_high") - 1 | int}}' target_temp_low: '{{ state_attr("climate.mqtt_hvac", "target_temp_low") | int}}' # Increment HVAC low temp set point when p[9].b[10] is pressed - alias: hasp_plate01_p9_SetHVACTempLowPlus trigger: - platform: mqtt topic: "hasp/plate01/state/p[9].b[10]" payload: "ON" action: - service: climate.set_temperature entity_id: "climate.mqtt_hvac" data_template: target_temp_high: '{{ state_attr("climate.mqtt_hvac", "target_temp_high") | int}}' target_temp_low: '{{ state_attr("climate.mqtt_hvac", "target_temp_low") | int + 1 }}' # Decrement HVAC low temp set point when p[9].b[11] is pressed - alias: hasp_plate01_p9_SetHVACTempLowMinus trigger: - platform: mqtt topic: "hasp/plate01/state/p[9].b[11]" payload: "ON" action: - service: climate.set_temperature entity_id: "climate.mqtt_hvac" data_template: target_temp_high: '{{ state_attr("climate.mqtt_hvac", "target_temp_high") | int}}' target_temp_low: '{{ state_attr("climate.mqtt_hvac", "target_temp_low") | int - 1 }}' ############################################################################## # Automations to set colors on HASP Page 9 # - alias: hasp_plate01_p9_ColorConfig_selectedforegroundcolor trigger: - platform: state entity_id: "binary_sensor.plate01_connected" to: "on" - platform: homeassistant event: start - platform: state entity_id: input_number.hasp_plate01_selectedforegroundcolor action: - service: mqtt.publish data: topic: "hasp/plate01/command/json" payload_template: >- ["p[9].b[4].bco={{ states('input_number.hasp_plate01_selectedforegroundcolor')|int }}", "p[9].b[5].pco={{ states('input_number.hasp_plate01_selectedforegroundcolor')|int }}", "p[9].b[6].pco={{ states('input_number.hasp_plate01_selectedforegroundcolor')|int }}"] - alias: hasp_plate01_p9_ColorConfig_selectedbackgroundcolor trigger: - platform: state entity_id: "binary_sensor.plate01_connected" to: "on" - platform: homeassistant event: start - platform: state entity_id: input_number.hasp_plate01_selectedbackgroundcolor action: - service: mqtt.publish data: topic: "hasp/plate01/command/json" payload_template: >- ["p[9].b[4].pco={{ states('input_number.hasp_plate01_selectedbackgroundcolor')|int }}", "p[9].b[5].bco={{ states('input_number.hasp_plate01_selectedbackgroundcolor')|int }}", "p[9].b[6].bco={{ states('input_number.hasp_plate01_selectedbackgroundcolor')|int }}", "p[9].b[7].pco={{ states('input_number.hasp_plate01_selectedbackgroundcolor')|int }}", "p[9].b[8].pco={{ states('input_number.hasp_plate01_selectedbackgroundcolor')|int }}", "p[9].b[9].bco={{ states('input_number.hasp_plate01_selectedbackgroundcolor')|int }}", "p[9].b[10].pco={{ states('input_number.hasp_plate01_selectedbackgroundcolor')|int }}", "p[9].b[11].pco={{ states('input_number.hasp_plate01_selectedbackgroundcolor')|int }}", "p[9].b[12].bco={{ states('input_number.hasp_plate01_selectedbackgroundcolor')|int }}"] - alias: hasp_plate01_p9_ColorConfig_unselectedforegroundcolor trigger: - platform: state entity_id: "binary_sensor.plate01_connected" to: "on" - platform: homeassistant event: start - platform: state entity_id: input_number.hasp_plate01_unselectedforegroundcolor action: - service: mqtt.publish data: topic: "hasp/plate01/command/json" payload_template: >- [{%- for i in range(4,13) -%}"p[9].b[{{i}}].pco2={{ states('input_number.hasp_plate01_unselectedforegroundcolor')|int }}"{% if not loop.last %},{% endif %}{%- endfor -%}] - alias: hasp_plate01_p9_ColorConfig_unselectedbackgroundcolor trigger: - platform: state entity_id: "binary_sensor.plate01_connected" to: "on" - platform: homeassistant event: start - platform: state entity_id: input_number.hasp_plate01_unselectedbackgroundcolor action: - service: mqtt.publish data: topic: "hasp/plate01/command/json" payload_template: >- [{%- for i in range(4,13) -%}"p[9].b[{{i}}].bco2={{ states('input_number.hasp_plate01_unselectedbackgroundcolor')|int }}"{% if not loop.last %},{% endif %}{%- endfor -%}]
Report a bug