Created
November 13, 2020 17:15
-
-
Save SteveDinn/23cb83ecb324a59d271635ab022dbb22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This file describes the climate component that will get displayed on the Home Assistant | |
| # UI, and ultimately is what people will interact with to control the living room heat pump | |
| ####################################################### | |
| # climate component | |
| ####################################################### | |
| climate: | |
| - platform: mqtt | |
| name: livingroom | |
| current_temperature_topic: tele/NodeMCU03/SENSOR | |
| current_temperature_template: "{{ states('sensor.livingroom_temperature') }}" | |
| action_topic: climate/livingroom/stat | |
| action_template: "{{ value_json.action }}" | |
| mode_command_topic: climate/livingroom/MODE | |
| mode_state_topic: climate/livingroom/stat | |
| mode_state_template: "{{ value_json.mode }}" | |
| modes: ["off", "cool", "dry", "heat", "fan_only"] | |
| temperature_command_topic: climate/livingroom/TEMP | |
| temperature_state_topic: climate/livingroom/stat | |
| temperature_state_template: "{{ value_json.temp }}" | |
| fan_mode_command_topic: climate/livingroom/FAN | |
| fan_mode_state_topic: climate/livingroom/stat | |
| fan_mode_state_template: "{{ value_json.fan }}" | |
| fan_modes: ["auto", "low", "medium", "high"] | |
| min_temp: 17 | |
| max_temp: 30 | |
| temp_step: 0.5 | |
| ####################################################### | |
| # sensors | |
| ####################################################### | |
| binary_sensor: | |
| - platform: template | |
| sensors: | |
| livingroom_temperature_diff_high: | |
| value_template: > | |
| {# Set area #} | |
| {%- set area = 'livingroom' -%} | |
| {# Get sensor and input states #} | |
| {%- set diff = states('sensor.' + area + '_temperature_diff') | float -%} | |
| {%- set range_high = states('input_number.' + area + '_temperature_range_high') | float -%} | |
| {# Calculate and output sensor value #} | |
| {%- set diff_high = diff > range_high -%} | |
| {{ diff_high }} | |
| livingroom_temperature_diff_low: | |
| value_template: > | |
| {# Set area #} | |
| {%- set area = 'livingroom' -%} | |
| {# Get sensor and input states #} | |
| {%- set diff = states('sensor.' + area + '_temperature_diff') | float -%} | |
| {%- set range_low = (states('input_number.' + area + '_temperature_range_low') | float) * -1 -%} | |
| {# Calculate and output sensor value #} | |
| {%- set diff_low = diff < range_low -%} | |
| {{ diff_low }} | |
| sensor: | |
| - platform: template | |
| sensors: | |
| livingroom_temperature_diff: | |
| unit_of_measurement: "°C" | |
| value_template: > | |
| {# Set area #} | |
| {%- set area = 'livingroom' -%} | |
| {# Get sensor and input states #} | |
| {%- set temperature = states('sensor.' + area + '_temperature') | float -%} | |
| {%- set mode = states('input_select.' + area + '_heatpump_mode') | lower -%} | |
| {%- set setpoint = states('input_number.' + area + '_heatpump_temp') | float | round(1) -%} | |
| {# Calculate and output sensor value #} | |
| {%- set delta = temperature - setpoint -%} | |
| {%- set delta_multiplier = 1 if (mode == 'heat') else (-1 if (mode == 'cool') else 0) -%} | |
| {%- set diff = (delta * delta_multiplier) | round(1) -%} | |
| {{ diff }} | |
| ####################################################### | |
| # Backing inputs | |
| ####################################################### | |
| input_text: | |
| livingroom_heatpump_command: | |
| name: livingroom_heatpump_command | |
| livingroom_heatpump_command_next: | |
| name: livingroom_heatpump_command_next | |
| input_number: | |
| livingroom_temperature_range_low: | |
| min: 0 | |
| max: 5 | |
| mode: box | |
| unit_of_measurement: "°C" | |
| livingroom_temperature_range_high: | |
| min: 0 | |
| max: 5 | |
| mode: box | |
| unit_of_measurement: "°C" | |
| livingroom_heatpump_temp: | |
| min: 17 | |
| max: 30 | |
| step: 0.1 | |
| mode: slider | |
| icon: mdi:thermometer | |
| unit_of_measurement: "°C" | |
| input_select: | |
| livingroom_heatpump_mode: | |
| icon: mdi:air-conditioner | |
| options: | |
| - "off" | |
| - "heat" | |
| - "cool" | |
| - "dry" | |
| - "fan_only" | |
| livingroom_heatpump_fanspeed: | |
| icon: mdi:fan | |
| options: | |
| - "auto" | |
| - "low" | |
| - "medium" | |
| - "high" | |
| timer: | |
| livingroom_heatpump_command: | |
| duration: "00:00:01" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment