From da0260024adae867e90d1546f09b917c98459144 Mon Sep 17 00:00:00 2001 From: Blackymas Date: Sat, 12 Nov 2022 00:12:48 +0100 Subject: [PATCH] correct small things --- blueprint.yaml | 29 ++- esphome.yaml | 630 +++---------------------------------------------- 2 files changed, 63 insertions(+), 596 deletions(-) diff --git a/blueprint.yaml b/blueprint.yaml index c3a0916..ee69d10 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -32,11 +32,13 @@ blueprint: selector: text: {} delay: - name: Delay to avoid sync problems (coming soon) - description: 'Synchronization Problems may occur due to the NETWORK / WLAN. To avoid this problem enter your value for the delay (milliseconds)' + name: '# Delay to avoid sync problems' + description: '# Synchronization Problems may occur due to the NETWORK / WLAN. To avoid this problem enter your value for the delay (milliseconds)' default: '10' selector: - text: {} + number: + min: 0 + max: 100 sync_value_ha: name: Synchronization of all values from HA to NSPanel for Lightsetting and Coversetting Page. description: 'Synchronization of values between HA and NSPanel for Lightsetting and Coversetting Page -> Maybe causes number jumps' @@ -60,6 +62,15 @@ blueprint: - label: 'Yes' value: select_yes + nspnael_temp_correction: + name: 'Nspanel temperature correction' + description: 'Here the temperature of the NSPanel temperature sensor can be adjusted.' + default: '0' + selector: + number: + min: -10 + max: 10 + ##### WEATHER ##### weather: name: Weather Integration @@ -741,6 +752,7 @@ variables: time: "{{ (as_timestamp(now()) | timestamp_custom('%H:%M')) }}" weather: !input "weather" language: !input "language" + nspnael_temp_correction: !input "nspnael_temp_correction" ##### PUSH TO NEXTION DISPLAY ##### command_text_printf: "esphome.{{ nspanel_name }}_send_command_text_printf" @@ -761,6 +773,7 @@ variables: tft_path: !input "tft_path" ##### GENERAL ENTITYS ##### + nspanel_temp: sensor.{{ nspanel_name }}_temperature humidity: !input "humidity" hotwatertemp: !input "hotwatertemp" outdoortemp: !input "outdoortemp" @@ -1115,7 +1128,7 @@ trigger: - platform: event event_type: state_changed event_data: - entity_id: "{{ current_page }}" + entity_id: "{{ current_page in [1,2,3,4,5] }}" id: weather_settings ##### Page Button - Trigger "button_page" Entity sync ##### @@ -1725,6 +1738,14 @@ action: component: home.humidity_state message: "{{ states(humidity) |round(0) }}%" + ##### NSPanel boot init - NSPanel Temp ##### + - delay: + milliseconds: "{{ delay_value }}" + - service: "{{ command_text_printf }}" + data: + component: home.current_temp + message: "{{ states(nspanel_temp) }}°" + ##### NSPanel boot init - Hotwater ##### - if: - condition: template diff --git a/esphome.yaml b/esphome.yaml index b225a53..78e9b25 100644 --- a/esphome.yaml +++ b/esphome.yaml @@ -1,9 +1,12 @@ -############################################################# -##### START - SUBSTITUTIONS ##### -############################################################# +##################################################################################################### +##### NSPANEL ESPHOME created by Blackymas - https://github.com/Blackymas/NSPanel_HA_Blueprint ##### +##### ADVANCED CONFIG + FULL ESPHOME CODE! ##### +##### PLEASE only make changes if it is necessary and also the required knowledge is available. ##### +##### For normal use with the Blueprint, no changes are necessary. ##### +##################################################################################################### -##### advanced config activate only when you know what you do ##### +##### ADVANCED CONFIGURATION - activate only when you know what you do ############################## # substitutions: # ## usage of secrets-file ## -> comment in ###### Change ME ###### # device_name: "nspanel-name" # Wird im Blueprint benötigt! @@ -19,49 +22,7 @@ # dns: "10.0.0.138" # domain: ".local" -##### end of advanced config ##### - - ###### EDIT THE BELOW ENTITIES FOR YOURS... depricated ####################################################################### - ##### - will be removed in future release - ignore it or set if exist ################## - # ha_hotwater_charge: switch.wwcharge - # ha_heating_system_flame: binary_sensor.flamestatus ##### Buderus Heizung Flamen-Status (Integration) ##### - # ha_climate_thermostat_target_temp: sensor.nspanel_target_temp ##### Climate Thermostat generiert in HA (custom_configuration -> nspanel) ##### - # ha_climate_thermostat: climate.nspanel_name ##### Climate Thermostat generiert in HA (custom_configuration -> nspanel) ##### -######################################### -# -# -############################################################# -##### CLOSE - SUBSTITUTIONS ##### -############################################################# -# -## -### -############################################################################################################################################################################################# -### -## -# -############################################################# -##### START - Settings ##### -############################################################# -# -# -######################################### - -##### Functionality for the Nextion display ##### -external_components: - - source: github://pr#2956 - components: [nextion] - refresh: 1h - -##### ESP home CONFIG ##### -esphome: - name: ${device_name} - - - -##### TYPE OF ESP BOARD ##### -esp32: - board: esp32dev +##### END OF ADVANCED CONFIGURATION ############################################################## ##### WIFI SETUP ##### wifi: @@ -80,6 +41,20 @@ wifi: ssid: "${device_name}" password: ${wifi_password} +##### Functionality for the Nextion display ##### +external_components: + - source: github://pr#2956 + components: [nextion] + refresh: 1h + +##### ESPHOME CONFIGURATION ##### +esphome: + name: ${device_name} + +##### TYPE OF ESP BOARD ##### +esp32: + board: esp32dev + captive_portal: web_server: @@ -88,7 +63,7 @@ web_server: username: admin password: ${ota_password} -##### OTA (Over the air updates) password ##### +##### OTA PASSWORD ##### ota: password: ${ota_password} safe_mode: true @@ -120,35 +95,14 @@ uart: baud_rate: 115200 id: tf_uart -###### A reboot button is always useful ##### +###### REBOOT BUTTON ##### button: - platform: restart name: ${device_name} Restart id: restart_nspanel - - -######################################### -# -# -############################################################# -##### CLOSE - Settings ##### -############################################################# -# -## -### -############################################################################################################################################################################################# -### -## -# -############################################################# -##### START - API ##### -############################################################# -# -# -######################################### - +##### START - API CONFIGURATION ##### api: services: @@ -221,40 +175,10 @@ api: switch.is_on: nextion_init - lambda: 'id(disp1).set_component_background_color(component.c_str(), message);' -######################################### -# -# -############################################################# -##### CLOSE - API ##### -############################################################# -# -## -### -############################################################################################################################################################################################# -### -## -# -############################################################# -##### START - GLOBALS ##### -############################################################# -# -# -######################################### +##### START - GLOBALS CONFIGURATION ##### globals: - # ##### Save Target Temp ##### - # - id: climate_target_temp_val_global - # type: float - # restore_value: true - # initial_value: '12' - - # ##### Save Thermostat PIC Position ##### - # - id: climate_slider_val_global - # type: int - # restore_value: true - # initial_value: '0' - ##### Save Display Brightness for NSPanel reboot ##### - id: display_brightness_global type: int @@ -273,18 +197,6 @@ globals: restore_value: true initial_value: '0' - # ##### Save State Heating Room ##### - # - id: heating_room_global - # type: int - # restore_value: true - # initial_value: '0' - - ##### Save State HVAC ##### - # - id: hvac_mode_global - # type: int - # restore_value: true - # initial_value: '0' - ##### lastclick_general State ##### - id: lastclick_general_global type: std::string @@ -309,26 +221,8 @@ globals: restore_value: no initial_value: '' -######################################### -# -# -############################################################# -##### CLOSE - GLOBALS ##### -############################################################# -# -## -### -############################################################################################################################################################################################# -### -## -# -############################################################# -##### START - BINARY SENSOR ##### -############################################################# -# -# -######################################### +##### START - BINARY SENSOR CONFIGURATION ##### binary_sensor: ###### LEFT BUTTON BELOW DISPLAY TO TOGGLE RELAY##### @@ -345,42 +239,6 @@ binary_sensor: number: 27 inverted: true - ##### THERMOSTAT - BUTTON DECREASES CLIMATE TARGET TEMPERATURE IN HA ##### - # - platform: nextion - # name: ${device_name} Climate Target DOWN - # page_id: 6 - # component_id: 13 - # internal: true - # on_click: - # - homeassistant.service: - # service: climate.set_temperature - # data_template: - # entity_id: ${ha_climate_thermostat} - # temperature: !lambda return id(climate_target_temp_val_global) - 0.5; - - ##### THERMOSTAT - BUTTON INCREASES CLIMATE TARGET TEMPERATURE IN HA ##### - # - platform: nextion - # name: ${device_name} Climate Target UP - # page_id: 6 - # component_id: 14 - # internal: true - # on_click: - # - homeassistant.service: - # service: climate.set_temperature - # data_template: - # entity_id: ${ha_climate_thermostat} - # temperature: !lambda return id(climate_target_temp_val_global) + 0.5; - - ##### THERMOSTAT - BUTTON ON / OFF Heating ##### - # - platform: nextion - # name: ${device_name} Heating Room State - # id: heating_room_state - # page_id: 6 - # component_id: 15 - # internal: true - # on_click: - # - switch.toggle: hvac_mode - ##### Restart NSPanel Button ##### - platform: nextion name: ${device_name} Restart @@ -410,26 +268,8 @@ binary_sensor: data: entity_id: ${ha_hotwater_charge} -######################################### -# -# -############################################################# -##### CLOSE - BINARY SENSOR ##### -############################################################# -# -## -### -############################################################################################################################################################################################# -### -## -# -############################################################# -##### START - SENSOR ##### -############################################################# -# -# -######################################### +##### START - SENSOR CONFIGURATION ##### sensor: ##### Uptime ##### @@ -465,230 +305,12 @@ sensor: b_constant: 3950 reference_temperature: 25°C reference_resistance: 10kOhm - on_value: - then: - - wait_until: - switch.is_on: nextion_init - - lambda: id(disp1).set_component_text_printf("home.current_temp", "%.1f°", id(temp_nspanel).state); # onboard temp (thermostat temp) to home page. - - lambda: id(disp1).set_component_text_printf("climate.current_temp", "%.1f", id(temp_nspanel).state); - - ##### THERMOSTAT CLIMATE TARGET TEMPERATURE FROM HA ##### - # - platform: homeassistant - # id: ha_climate_target_temp - # entity_id: ${ha_climate_thermostat_target_temp} - # on_value: - # then: - # - wait_until: - # switch.is_on: nextion_init - # - globals.set: - # id: climate_target_temp_val_global - # value: !lambda 'return float(x);' - # - lambda: id(disp1).set_component_text_printf("climate.target_temp", "%.1f", id(climate_target_temp_val_global)); - # # THERMO PROGRESS CIRCLE, broken into 3 images to create space for the temperatures in the center. - # - lambda: |- - # int left=16; // 16 is empty left. - # int mid=17; // 17 is empty mid. - # int right=18; // 18 is empty right. - # if (id(climate_target_temp_val_global) == 13) { - # left=16; - # mid=17; - # right=18; - # } else if (id(climate_target_temp_val_global) == 13.5) { - # left=19; - # mid=17; - # right=18; - # } else if (id(climate_target_temp_val_global) == 14) { - # left=20; - # mid=17; - # right=18; - # } else if (id(climate_target_temp_val_global) == 14.5) { - # left=21; - # mid=17; - # right=18; - # } else if (id(climate_target_temp_val_global) == 15) { - # left=22; - # mid=17; - # right=18; - # } else if (id(climate_target_temp_val_global) == 15.5) { - # left=23; - # mid=17; - # right=18; - # } else if (id(climate_target_temp_val_global) == 16) { - # left=24; - # mid=17; - # right=18; - # } else if (id(climate_target_temp_val_global) == 16.5) { - # left=25; - # mid=17; - # right=18; - # } else if (id(climate_target_temp_val_global) == 17) { - # left=26; - # mid=17; - # right=18; - # } else if (id(climate_target_temp_val_global) == 17.5) { - # left=27; - # mid=17; - # right=18; - # } else if (id(climate_target_temp_val_global) == 18) { - # left=28; - # mid=17; - # right=18; - # } else if (id(climate_target_temp_val_global) == 18.5) { - # left=29; - # mid=30; - # right=18; - # } else if (id(climate_target_temp_val_global) == 19) { - # left=29; - # mid=31; - # right=18; - # } else if (id(climate_target_temp_val_global) == 19.5) { - # left=29; - # mid=32; - # right=18; - # } else if (id(climate_target_temp_val_global) == 20) { - # left=29; - # mid=33; - # right=18; - # } else if (id(climate_target_temp_val_global) == 20.5) { - # left=29; - # mid=34; - # right=18; - # } else if (id(climate_target_temp_val_global) == 21) { - # left=29; - # mid=35; - # right=18; - # } else if (id(climate_target_temp_val_global) == 21.5) { - # left=29; - # mid=36; - # right=18; - # } else if (id(climate_target_temp_val_global) == 22) { - # left=29; - # mid=37; - # right=38; - # } else if (id(climate_target_temp_val_global) == 22.5) { - # left=29; - # mid=37; - # right=39; - # } else if (id(climate_target_temp_val_global) == 23) { - # left=29; - # mid=37; - # right=40; - # } else if (id(climate_target_temp_val_global) == 23.5) { - # left=29; - # mid=37; - # right=41; - # } else if (id(climate_target_temp_val_global) == 24) { - # left=29; - # mid=37; - # right=42; - # } else if (id(climate_target_temp_val_global) == 24.5) { - # left=29; - # mid=37; - # right=43; - # } else if (id(climate_target_temp_val_global) == 25) { - # left=29; - # mid=37; - # right=44; - # } else if (id(climate_target_temp_val_global) == 25.5) { - # left=29; - # mid=37; - # right=45; - # } else if (id(climate_target_temp_val_global) == 26) { - # left=29; - # mid=37; - # right=46; - # } else if (id(climate_target_temp_val_global) == 26.5) { - # left=29; - # mid=37; - # right=47; - # } else if (id(climate_target_temp_val_global) == 27) { - # left=29; - # mid=37; - # right=48; - # } - # // sends the 3 images to the display - # id(disp1).send_command_printf("climate.a01.pic=%i", left); - # id(disp1).send_command_printf("climate.a02.pic=%i", mid); - # id(disp1).send_command_printf("climate.a03.pic=%i", right); - - ###### TARGET TEMPERATURE GET VALUE FROM NEXTION CIRCLE SLIDER AND SET GLOBAL VARIBLE ##### - # - platform: nextion - # id: climate_circleslider - # name: ${device_name} Climate circleslider - # variable_name: climateslider - # internal: true - # on_value: - # then: - # - wait_until: - # switch.is_on: nextion_init - # - globals.set: - # id: climate_slider_val_global - # value: !lambda 'return int(x);' - # - lambda: |- - # if (id(climate_slider_val_global) == 0) { - # id(climate_target_temp_val_global) = 13; - # } else if (id(climate_slider_val_global) == 1) { - # id(climate_target_temp_val_global) = 13.5; - # } else if (id(climate_slider_val_global) == 2) { - # id(climate_target_temp_val_global) = 14; - # } else if (id(climate_slider_val_global) == 3) { - # id(climate_target_temp_val_global) = 14.5; - # } else if (id(climate_slider_val_global) == 4) { - # id(climate_target_temp_val_global) = 15; - # } else if (id(climate_slider_val_global) == 5) { - # id(climate_target_temp_val_global) = 15.5; - # } else if (id(climate_slider_val_global) == 6) { - # id(climate_target_temp_val_global) = 16; - # } else if (id(climate_slider_val_global) == 7) { - # id(climate_target_temp_val_global) = 16.5; - # } else if (id(climate_slider_val_global) == 8) { - # id(climate_target_temp_val_global) = 17; - # } else if (id(climate_slider_val_global) == 9) { - # id(climate_target_temp_val_global) = 17.5; - # } else if (id(climate_slider_val_global) == 10) { - # id(climate_target_temp_val_global) = 18; - # } else if (id(climate_slider_val_global) == 11) { - # id(climate_target_temp_val_global) = 18.5; - # } else if (id(climate_slider_val_global) == 12) { - # id(climate_target_temp_val_global) = 19; - # } else if (id(climate_slider_val_global) == 13) { - # id(climate_target_temp_val_global) = 19.5; - # } else if (id(climate_slider_val_global) == 14) { - # id(climate_target_temp_val_global) = 20; - # } else if (id(climate_slider_val_global) == 15) { - # id(climate_target_temp_val_global) = 20.5; - # } else if (id(climate_slider_val_global) == 16) { - # id(climate_target_temp_val_global) = 21; - # } else if (id(climate_slider_val_global) == 17) { - # id(climate_target_temp_val_global) = 21.5; - # } else if (id(climate_slider_val_global) == 18) { - # id(climate_target_temp_val_global) = 22; - # } else if (id(climate_slider_val_global) == 19) { - # id(climate_target_temp_val_global) = 22.5; - # } else if (id(climate_slider_val_global) == 20) { - # id(climate_target_temp_val_global) = 23; - # } else if (id(climate_slider_val_global) == 21) { - # id(climate_target_temp_val_global) = 23.5; - # } else if (id(climate_slider_val_global) == 22) { - # id(climate_target_temp_val_global) = 24; - # } else if (id(climate_slider_val_global) == 23) { - # id(climate_target_temp_val_global) = 24.5; - # } else if (id(climate_slider_val_global) == 24) { - # id(climate_target_temp_val_global) = 25; - # } else if (id(climate_slider_val_global) == 25) { - # id(climate_target_temp_val_global) = 25.5; - # } else if (id(climate_slider_val_global) == 26) { - # id(climate_target_temp_val_global) = 26; - # } else if (id(climate_slider_val_global) == 27) { - # id(climate_target_temp_val_global) = 26.5; - # } else if (id(climate_slider_val_global) == 28) { - # id(climate_target_temp_val_global) = 27; - # } - # - homeassistant.service: - # service: climate.set_temperature - # data_template: - # entity_id: ${ha_climate_thermostat} - # temperature: !lambda return id(climate_target_temp_val_global); + # on_value: + # then: + # - wait_until: + # switch.is_on: nextion_init + # - lambda: id(disp1).set_component_text_printf("home.current_temp", "%.1f°", id(temp_nspanel).state); # onboard temp (thermostat temp) to home page. + # - lambda: id(disp1).set_component_text_printf("climate.current_temp", "%.1f", id(temp_nspanel).state); ###### Display Brightness GET VALUE FROM NSPanel SLIDER ##### - platform: nextion @@ -734,26 +356,7 @@ sensor: - lambda: return int(x); -######################################### -# -# -############################################################# -##### CLOSE - SENSOR ##### -############################################################# -# -## -### -############################################################################################################################################################################################# -### -## -# -############################################################# -##### START - TEXT SENSOR##### -############################################################# -# -# -######################################### - +##### START - TEXT SENSOR CONFIGURATION ##### text_sensor: ##### ESPhome version used to compile the app ##### @@ -772,11 +375,6 @@ text_sensor: name: ${device_name} BSSID disabled_by_default: true - ##### SUN SENSOR FROM HA ##### - # - platform: homeassistant - # id: sun_sun - # entity_id: sun.sun - ##### last click sensor, the main action variable - push to HA ##### - platform: nextion nextion_id: disp1 @@ -861,59 +459,8 @@ text_sensor: id: lastclick_climatesettings_global value: !lambda return x; - ##### HEATING System ICON ##### - # - platform: homeassistant - # entity_id: ${ha_heating_system_flame} - # name: "Heating System" - # id: heating_system - # on_value: - # then: - # - wait_until: - # switch.is_on: nextion_init - # - lambda: |- - # int symbol=53; // 53 is a blank image 20x20 - # if (id(heating_system).state == "on") { - # symbol=64; - # } - # id(disp1).send_command_printf("home.a50.pic=%i", symbol); - # id(disp1).send_command_printf("climate.a50.pic=%i", symbol); - ##### Hotwater Charge ICON ##### - # - platform: homeassistant - # entity_id: ${ha_hotwater_charge} - # name: "Hotwater Charge" - # id: hotwater_charge - # on_value: - # then: - # - wait_until: - # switch.is_on: nextion_init - # - lambda: |- - # if (id(hotwater_charge).state == "on") { - # id(disp1).set_component_value("climate.hotwater",1); - # } else { - # id(disp1).set_component_value("climate.hotwater",0); - # } - -######################################### -# -# -############################################################# -##### CLOSE - TEXT SENSOR ##### -############################################################# -# -## -### -############################################################################################################################################################################################# -### -## -# -############################################################# -##### START - SWITCH ##### -############################################################# -# -# -######################################### - +##### START - SWITCH CONFIGURATION ##### switch: # ##### Restart switch ###### @@ -955,47 +502,6 @@ switch: id: relay_2 pin: number: 19 - - ##### Switch Climate HVAC Mode ##### - # - platform: template - # device_class: switch - # name: ${device_name} hvac Mode - # id: hvac_mode - # restore_state: true - # assumed_state: false - # optimistic: true - # on_turn_off: - # - lambda: id(disp1).set_component_value("climate.heating",0); - # - globals.set: - # id: hvac_mode_global - # value: '0' - # - homeassistant.service: - # service: climate.set_hvac_mode - # data_template: - # entity_id: $ha_climate_thermostat - # hvac_mode: 'off' - # - lambda: id(disp1).send_command_printf("climate.heating_state.pic=49"); - # - lambda: id(disp1).send_command_printf("home.a51.pic=53"); - # - lambda: id(disp1).send_command_printf("climate.a51.pic=53"); - # on_turn_on: - # - lambda: id(disp1).set_component_value("climate.heating",1); - # - globals.set: - # id: hvac_mode_global - # value: '1' - # - homeassistant.service: - # service: climate.set_hvac_mode - # data_template: - # entity_id: $ha_climate_thermostat - # hvac_mode: 'heat' - # - lambda: |- - # if (id(heating_room_global) == 0) - # { - # id(disp1).send_command_printf("climate.heating_state.pic=50"); - # } else if (id(heating_room_global) == 1) { - # id(disp1).send_command_printf("climate.heating_state.pic=51"); - # } - # - lambda: id(disp1).send_command_printf("home.a51.pic=65"); - # - lambda: id(disp1).send_command_printf("climate.a51.pic=65"); ##### DISPLAY ALWAYS ON ##### - platform: gpio @@ -1029,26 +535,8 @@ switch: value: '1' - lambda: id(disp1).set_component_value("settings.a02",1); -######################################### -# -# -############################################################# -##### CLOSE - SWITCH ##### -############################################################# -# -## -### -############################################################################################################################################################################################# -### -## -# -############################################################# -##### START - NUMBER ##### -############################################################# -# -# -######################################### +##### START - NUMBER CONFIGURATION ##### number: ##### SCREEN BRIGHTNESS ##### @@ -1088,26 +576,8 @@ number: id: display_dim_brightness_global value: !lambda 'return int(x);' -######################################### -# -# -############################################################# -##### CLOSE - NUMBER ##### -############################################################# -# -## -### -############################################################################################################################################################################################# -### -## -# -############################################################# -##### START - DISPLAY START##### -############################################################# -# -# -######################################### +##### START - DISPLAY START CONFIGURATION ##### display: - platform: nextion id: disp1 @@ -1143,27 +613,3 @@ display: { id(disp1).set_component_value("settings.a02",1); } - # - lambda: |- - # id(disp1).send_command_printf("home.a50.pic=53"); - # id(disp1).send_command_printf("climate.a50.pic=53"); - # id(disp1).send_command_printf("climate.heating_state.pic=50"); - # if (id(heating_room_global) == 1) - # { - # id(disp1).send_command_printf("home.a52.pic=66"); - # id(disp1).send_command_printf("climate.a52.pic=66"); - # id(disp1).send_command_printf("climate.heating_state.pic=51"); - # } - # - lambda: |- - # if (id(hvac_mode_global) == 0) { - # id(disp1).send_command_printf("home.a51.pic=53"); - # id(disp1).send_command_printf("climate.a51.pic=53"); - # id(disp1).send_command_printf("climate.heating_state.pic=49"); - # } else if (id(hvac_mode_global) == 1) { - # id(disp1).send_command_printf("home.a51.pic=65"); - # id(disp1).send_command_printf("climate.a51.pic=65"); - # id(disp1).set_component_value("climate.heating",1); - # } - -############################################################# -##### CLOSE - DISPLAY START ##### -############################################################# \ No newline at end of file