diff --git a/blueprint.yaml b/blueprint.yaml index 618c4ee..a945348 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -767,6 +767,7 @@ variables: command_printf: "esphome.{{ nspanel_name }}_send_command_printf" command_font_color: "esphome.{{ nspanel_name }}_send_command_font_color" command_background_color: "esphome.{{ nspanel_name }}_send_command_background_color" + command_thermostat_cycle: "esphome.{{ nspanel_name }}_send_thermostat_cycle_state" ###### SYNC SETTINGS ##### delay_boot: !input "delay" @@ -4473,28 +4474,25 @@ action: - conditions: '{{ trigger.event.data.new_state.state == page_climate }}' alias: 'climate page' sequence: - - choose: - - conditions: '{{ outdoortemp is match "sensor." }}' - alias: 'outdoor-sensor' - sequence: - - service: "{{ command_text_printf }}" - data: - component: outdoor_temp - message: "{{ states(outdoortemp) |round(0) }}°" - - conditions: '{{ weather == "Default" }}' - alias: 'default-weather' - sequence: - - service: "{{ command_text_printf }}" - data: - component: outdoor_temp - message: '{{state_attr(ha_weather,"temperature") | round(0)}}°' - - conditions: '{{ weather == "AccuWeather" }}' - alias: 'AccuWeather' - sequence: - - service: "{{ command_text_printf }}" - data: - component: outdoor_temp - message: '{{state_attr(accuweather_value,"temperature") | round(0)}}°' + - variables: + target_temp: "{{state_attr(climate, 'temperature') | round(1)}}" + hvac_mode: "{{ states(climate) }}" + outdoor_temp: >- + {%- if outdoortemp is match "sensor." -%} {{ states(outdoortemp) |round(0) }} + {%- elif weather == "Default" -%} {{state_attr(ha_weather,"temperature") | round(0)}} + {%- elif weather == "AccuWeather" -%} {{state_attr(accuweather_value,"temperature") | round(0)}} + {%- endif -%} + heating_state: >- + {%- if hvac_mode == "off" and language == "DE" -%} aus + {%- elif hvac_mode == "off" and language == "EN" -%} off + {%- elif hvac_mode != "off" and language == "DE" -%} heizen + {%- elif hvac_mode != "off" and language == "EN" -%} heat + {%- endif -%} + + - service: "{{ command_text_printf }}" + data: + component: outdoor_temp + message: "{{ outdoor_temp }}°" - service: "{{ command_text_printf }}" data: component: current_temp @@ -4502,7 +4500,14 @@ action: - service: "{{ command_text_printf }}" data: component: target_temp - message: "{{state_attr(climate, 'temperature') | round(0)}}°" + message: "{{target_temp}}°" + - service: "{{ command_thermostat_cycle }}" + data: + value: "{{target_temp}}" + - service: "{{ command_text_printf }}" + data: + component: thermostat.heating_state + message: "{{heating_state}}" - if: - condition: template value_template: '{{ hotwatertemp is match "sensor." }}' @@ -4512,6 +4517,7 @@ action: component: climate.hotwater_temp message: "{{ states(hotwatertemp) |round(1) }}°" + ## settings ## - conditions: '{{ trigger.event.data.new_state.state == page_settings }}' sequence: diff --git a/esphome.yaml b/esphome.yaml index 78e9b25..4be4d92 100644 --- a/esphome.yaml +++ b/esphome.yaml @@ -175,6 +175,143 @@ api: switch.is_on: nextion_init - lambda: 'id(disp1).set_component_background_color(component.c_str(), message);' + #### Service to send thermostat cycle state #### + - service: send_thermostat_cycle_state + variables: + value: float + then: + - wait_until: + switch.is_on: nextion_init + - lambda: |- + //ESP_LOGD("nextion", "thermostat sendig value %f", value); + int left=16; // 16 is empty left. + int mid=17; // 17 is empty mid. + int right=18; // 18 is empty right. + if (value < 13.5) { + left=16; + mid=17; + right=18; + } else if (value >= 13.5 and value < 14) { + left=19; + mid=17; + right=18; + } else if (value >= 14 and value < 14.5) { + left=20; + mid=17; + right=18; + } else if (value >= 14.5 and value < 15) { + left=21; + mid=17; + right=18; + } else if (value >= 15 and value < 15.5) { + left=22; + mid=17; + right=18; + } else if (value >= 15.5 and value < 16) { + left=23; + mid=17; + right=18; + } else if (value >= 16 and value < 16.5) { + left=24; + mid=17; + right=18; + } else if (value >= 16.5 and value < 17) { + left=25; + mid=17; + right=18; + } else if (value >= 17 and value < 17.5) { + left=26; + mid=17; + right=18; + } else if (value >= 17.5 and value < 18) { + left=27; + mid=17; + right=18; + } else if (value >= 18 and value < 18.5) { + left=28; + mid=17; + right=18; + } else if (value >= 18.5 and value < 19) { + left=29; + mid=30; + right=18; + } else if (value >= 19 and value < 19.5) { + left=29; + mid=31; + right=18; + } else if (value >= 19.5 and value < 20) { + left=29; + mid=32; + right=18; + } else if (value >= 20 and value < 20.5) { + left=29; + mid=33; + right=18; + } else if (value >= 20.5 and value < 21) { + left=29; + mid=34; + right=18; + } else if (value >= 21 and value < 21.5) { + left=29; + mid=35; + right=18; + } else if (value >= 21.5 and value < 22) { + left=29; + mid=36; + right=18; + } else if (value >= 22 and value < 22.5) { + left=29; + mid=37; + right=38; + } else if (value >= 22.5 and value < 23) { + left=29; + mid=37; + right=39; + } else if (value >= 23 and value < 23.5) { + left=29; + mid=37; + right=40; + } else if (value >= 23.5 and value < 24) { + left=29; + mid=37; + right=41; + } else if (value >= 24 and value < 24.5) { + left=29; + mid=37; + right=42; + } else if (value >= 24.5 and value < 25) { + left=29; + mid=37; + right=43; + } else if (value >= 25 and value < 25.5) { + left=29; + mid=37; + right=44; + } else if (value >= 25.5 and value < 26) { + left=29; + mid=37; + right=45; + } else if (value >= 26 and value < 26.5) { + left=29; + mid=37; + right=46; + } else if (value >= 26.5 and value < 27) { + left=29; + mid=37; + right=47; + } else if (value >= 27) { + left=29; + mid=37; + right=48; + } + // sends the 3 images to the display + //ESP_LOGD("nextion", "thermostat left %i", left); + //ESP_LOGD("nextion", "thermostat mid %i", mid); + //ESP_LOGD("nextion", "thermostat right %i", right); + id(disp1).send_command_printf("climate_left.pic=%i", left); + id(disp1).send_command_printf("climate_middle.pic=%i", mid); + id(disp1).send_command_printf("climate_right.pic=%i", right); + ##### START - GLOBALS CONFIGURATION ##### globals: