diff --git a/docs/en/addon_climate.md b/docs/en/addon_climate.md index 1a12658..43b2da5 100644 --- a/docs/en/addon_climate.md +++ b/docs/en/addon_climate.md @@ -24,7 +24,7 @@ substitutions: ##### addon-configuration ##### ## addon_climate ## - addon_climate_heater_relay: "1" # possible values: 1/2 + heater_relay: "1" # possible values: 1/2 ##### CHANGE ME END ##### @@ -35,7 +35,7 @@ packages: ref: main files: - nspanel_esphome.yaml # Core package - - nspanel_esphome_addon_climate.yaml # activate for local climate-control + - nspanel_esphome_addon_climate_heat.yaml # activate for local climate (heater) control refresh: 300s ```   @@ -45,14 +45,14 @@ The following keys are available to be used in your `substitutions`: |Key|Required|Supported values|Default|Description| |:-|:-:|:-:|:-:|:-| -|addon_climate_heater_relay|Mandatory|`1` or `2`|`0` (disabled)|Relay used for conrol the heater. User `1` for "Relay 1" or `2` for "Relay 2".| -|addon_climate_temp_units|Optional|`°C` or `°F`|`°C`|Temperature unit.| -|addon_climate_min_heating_off_time|Optional|Positive integer representing the number of seconds|`300`|Minimum duration (in seconds) the heating action must be disengaged before it may be engaged.| -|addon_climate_min_heating_run_time|Optional|Positive integer representing the number of seconds|`300`|Minimum duration (in seconds) the heating action must be engaged before it may be disengaged.| -|addon_climate_min_idle_time|Optional|Positive integer representing the number of seconds|`30`|Minimum duration (in seconds) the idle action must be active before calling another climate action.| -|addon_climate_visual_min_temperature|Optional|Number representing a temperature in the selected unit|`5`|The minimum temperature the climate device can reach. Used to set the range of the frontend gauge.| -|addon_climate_visual_max_temperature|Optional|Number representing a temperature in the selected unit|`25`|The maximum temperature the climate device can reach. Used to set the range of the frontend gauge.| -|addon_climate_visual_temperature_step|Optional|Number representing a temperature in the selected unit|`0.5`|The granularity with which the target temperature can be controlled.| +|heater_relay|Mandatory|`1` or `2`|`0` (disabled)|Relay used for control the heater. User `1` for "Relay 1" or `2` for "Relay 2".| +|temp_units|Optional|`°C` or `°F`|`°C`|Temperature unit.| +|min_off_time|Optional|Positive integer representing the number of seconds|`300`|Minimum duration (in seconds) the heating action must be disengaged before it may be engaged.| +|min_run_time|Optional|Positive integer representing the number of seconds|`300`|Minimum duration (in seconds) the heating action must be engaged before it may be disengaged.| +|min_idle_time|Optional|Positive integer representing the number of seconds|`30`|Minimum duration (in seconds) the idle action must be active before calling another climate action.| +|temp_min|Optional|Number representing a temperature in the selected unit|`5`|The minimum temperature the climate device can reach. Used to set the range of the frontend gauge.| +|temp_max|Optional|Number representing a temperature in the selected unit|`25`|The maximum temperature the climate device can reach. Used to set the range of the frontend gauge.| +|temp_step|Optional|Number representing a temperature in the selected unit|`0.5`|The granularity with which the target temperature can be controlled.| - All values must be delimited with `""` - For more details on the keys, please take a look at [ESPHome Base Climate Configurations](https://esphome.io/components/climate/index.html#base-climate-configuration) and [ESPHome Climate Thermostat - Additional actions behavior](https://esphome.io/components/climate/thermostat.html#additional-actions-behavior). @@ -72,11 +72,11 @@ substitutions: ##### addon-configuration ##### ## addon_climate ## - addon_climate_heater_relay: "1" #Use relay 1 - addon_climate_temp_units: "°F" #Temperatures in Fahrenheit - addon_climate_visual_min_temperature: "40" #Min supported temperature is 40F - addon_climate_visual_max_temperature: "80" #Max supported temperature is 80F - addon_climate_visual_temperature_step: "1" #Temperature granularity is 1F + heater_relay: "1" #Use relay 1 + temp_units: "°F" #Temperatures in Fahrenheit + temp_min: "40" #Min supported temperature is 40°F + temp_max: "80" #Max supported temperature is 80°F + temp_step: "1" #Temperature granularity is 1°F ##### CHANGE ME END ##### @@ -87,7 +87,7 @@ packages: ref: main files: - nspanel_esphome.yaml # Core package - - nspanel_esphome_addon_climate.yaml # activate for local climate-control + - nspanel_esphome_addon_climate_heat.yaml # activate for local climate (heater) control refresh: 300s ``` diff --git a/nspanel_esphome_addon_climate_heat.yaml b/nspanel_esphome_addon_climate_heat.yaml index facc0b3..dc9bb10 100644 --- a/nspanel_esphome_addon_climate_heat.yaml +++ b/nspanel_esphome_addon_climate_heat.yaml @@ -1,51 +1,45 @@ #################################################################################################### -##### NSPanel ESPHome Add-on for Climate control ##### +##### NSPanel ESPHome Add-on for Climate control - Heat ##### ##### Add-on for https://github.com/Blackymas/NSPanel_HA_Blueprint ##### #################################################################################################### substitutions: ### Local thermostat defaults ### # https://esphome.io/components/climate/thermostat.html - addon_climate_temp_units: "°C" - addon_climate_heater_relay: "0" # Select 1 for "Relay 1", 2 for "Relay 2" or "0" to a dummy switch/disabled - addon_climate_min_heating_off_time: "300" - addon_climate_min_heating_run_time: "300" - addon_climate_min_idle_time: "30" + temp_units: "°C" + heater_relay: "0" # Select 1 for "Relay 1", 2 for "Relay 2" or "0" to a dummy switch/disabled + min_off_time: "300" + min_run_time: "300" + min_idle_time: "30" # https://esphome.io/components/climate/index.html#base-climate-configuration - addon_climate_visual_min_temperature: "5" - addon_climate_visual_max_temperature: "25" - addon_climate_visual_temperature_step: "0.5" - - ##### DON'T CHANGE THIS ##### - addon_climate: "true" - ############################# + temp_min: "5" + temp_max: "25" + temp_step: "0.5" climate: - platform: thermostat name: ${device_name} Thermostat id: thermostat_embedded sensor: temp_nspanel - min_heating_off_time: ${addon_climate_min_heating_off_time}s - min_heating_run_time: ${addon_climate_min_heating_run_time}s - min_idle_time: ${addon_climate_min_idle_time}s + min_heating_off_time: ${min_off_time}s + min_heating_run_time: ${min_run_time}s + min_idle_time: ${min_idle_time}s visual: - min_temperature: ${addon_climate_visual_min_temperature} ${addon_climate_temp_units} - max_temperature: ${addon_climate_visual_max_temperature} ${addon_climate_temp_units} - temperature_step: ${addon_climate_visual_temperature_step} ${addon_climate_temp_units} - # target_temperature: 0.5 #!lambda "return ${addon_climate_visual_target_temperature_step};" - # current_temperature: 0.1 #!lambda "return ${addon_climate_visual_current_temperature_step};" + min_temperature: ${temp_min} ${temp_units} + max_temperature: ${temp_max} ${temp_units} + temperature_step: ${temp_step} ${temp_units} heat_action: - - switch.turn_on: relay_${addon_climate_heater_relay} + - switch.turn_on: relay_${heater_relay} idle_action: - - switch.turn_off: relay_${addon_climate_heater_relay} + - switch.turn_off: relay_${heater_relay} default_preset: "Off" on_boot_restore_from: memory preset: - name: "Off" - default_target_temperature_low: ${addon_climate_visual_min_temperature} ${addon_climate_temp_units} + default_target_temperature_low: ${temp_min} ${temp_units} mode: "off" - name: Home - default_target_temperature_low: 21 ${addon_climate_temp_units} + default_target_temperature_low: 21 ${temp_units} internal: false on_state: - logger.log: Climate state changed - Start @@ -85,11 +79,11 @@ script: then: - lambda: |- // Update chips - if (${verbose_log}) ESP_LOGD("script.refresh_chips_climate", "thermostat_embedded.action=%i", int(id(thermostat_embedded).action)); + ESP_LOGV("script.refresh_chips_climate", "thermostat_embedded.action=%i", int(id(thermostat_embedded).action)); switch (int(id(thermostat_embedded).action)) // CLIMATE_ACTION_OFF = 0, CLIMATE_ACTION_COOLING = 2, CLIMATE_ACTION_HEATING = 3, CLIMATE_ACTION_IDLE = 4, CLIMATE_ACTION_DRYING = 5, CLIMATE_ACTION_FAN = 6 { case 0: //CLIMATE_ACTION_OFF - if (${verbose_log}) ESP_LOGD("script.refresh_chips_climate", "thermostat_embedded.mode=%i", int(id(thermostat_embedded).mode)); + ESP_LOGV("script.refresh_chips_climate", "thermostat_embedded.mode=%i", int(id(thermostat_embedded).mode)); switch (int(id(thermostat_embedded).mode)) // CLIMATE_MODE_OFF = 0, CLIMATE_MODE_HEAT_COOL = 1, CLIMATE_MODE_COOL = 2, CLIMATE_MODE_HEAT = 3, CLIMATE_MODE_FAN_ONLY = 4, CLIMATE_MODE_DRY = 5, CLIMATE_MODE_AUTO = 6 { case 0: //CLIMATE_MODE_OFF @@ -144,12 +138,9 @@ script: } - id: !extend addon_climate_service_call - #mode: restart - #parameters: - # key: string - # value: string then: - lambda: |- + ESP_LOGV("script.addon_climate_service_call", "Starting"); id(is_addon_climate_visible) = true; auto call = id(thermostat_embedded).make_call(); if (key == "set_temperature") @@ -161,17 +152,25 @@ script: call.set_mode(value); } call.perform(); + ESP_LOGV("script.addon_climate_service_call", "Finished"); - id: !extend addon_climate_set_climate then: - - lambda: id(is_addon_climate_visible) = embedded_climate; + - lambda: |- + ESP_LOGV("script.addon_climate_set_climate", "Starting"); + id(is_addon_climate_visible) = embedded_climate; + ESP_LOGV("script.addon_climate_set_climate", "Finished"); - id: !extend addon_climate_global_settings then: - - lambda: id(is_embedded_thermostat) = embedded_climate; + - lambda: |- + ESP_LOGV("script.addon_climate_global_settings", "Starting"); + id(is_embedded_thermostat) = embedded_climate; + ESP_LOGV("script.addon_climate_global_settings", "Finished"); - id: !extend addon_climate_update_page_climate then: + - lambda: ESP_LOGV("script.addon_climate_update_page_climate", "Starting"); - if: condition: - binary_sensor.is_on: nextion_init @@ -185,28 +184,28 @@ script: id: set_climate current_temp: !lambda "return id(thermostat_embedded).current_temperature;" target_temp: !lambda "return id(thermostat_embedded).target_temperature;" - temp_step: !lambda "return int(round(${addon_climate_visual_temperature_step}*10));" + temp_step: !lambda "return int(round(${temp_step}*10));" total_steps: !lambda |- - float temp_step = ${addon_climate_visual_temperature_step}; - float temp_offset = ${addon_climate_visual_min_temperature}; - float temp_max = ${addon_climate_visual_max_temperature}; + float temp_step = ${temp_step}; + float temp_offset = ${temp_min}; + float temp_max = ${temp_max}; float total_steps = (temp_max-temp_offset)/temp_step; return int(round(total_steps)); slider_val: !lambda |- - float temp_step = ${addon_climate_visual_temperature_step}; - float temp_offset = ${addon_climate_visual_min_temperature}; + float temp_step = ${temp_step}; + float temp_offset = ${temp_min}; return int(round((10*id(thermostat_embedded).target_temperature-temp_offset)/temp_step)); - temp_offset: !lambda "return int(round(${addon_climate_visual_min_temperature}*10));" + temp_offset: !lambda "return int(round(${temp_min}*10));" climate_icon: "" embedded_climate: True # Update target temp icon - lambda: |- - if (${verbose_log}) ESP_LOGD("script.addon_climate_update_page_climate", "thermostat_embedded.action=%i", int(id(thermostat_embedded).action)); + ESP_LOGV("script.addon_climate_update_page_climate", "thermostat_embedded.action=%i", int(id(thermostat_embedded).action)); switch (int(id(thermostat_embedded).action)) // CLIMATE_ACTION_OFF = 0, CLIMATE_ACTION_COOLING = 2, CLIMATE_ACTION_HEATING = 3, CLIMATE_ACTION_IDLE = 4, CLIMATE_ACTION_DRYING = 5, CLIMATE_ACTION_FAN = 6 { case 0: //CLIMATE_ACTION_OFF - if (${verbose_log}) ESP_LOGD("script.addon_climate_update_page_climate", "thermostat_embedded.mode=%i", int(id(thermostat_embedded).mode)); + ESP_LOGV("script.addon_climate_update_page_climate", "thermostat_embedded.mode=%i", int(id(thermostat_embedded).mode)); switch (int(id(thermostat_embedded).mode)) // CLIMATE_MODE_OFF = 0, CLIMATE_MODE_HEAT_COOL = 1, CLIMATE_MODE_COOL = 2, CLIMATE_MODE_HEAT = 3, CLIMATE_MODE_FAN_ONLY = 4, CLIMATE_MODE_DRY = 5, CLIMATE_MODE_AUTO = 6 { case 0: //CLIMATE_MODE_OFF @@ -262,7 +261,7 @@ script: # Update buttons bar - lambda: |- - if (${verbose_log}) ESP_LOGD("script.addon_climate_update_page_climate", "Updating buttons bar"); + ESP_LOGV("script.addon_climate_update_page_climate", "Updating buttons bar"); // Hide not supported hotspots id(disp1).hide_component("climate.button01"); id(disp1).hide_component("climate.button02"); @@ -279,6 +278,7 @@ script: id(disp1).set_component_font_color("climate.button05_icon", 10597); id(disp1).set_component_font_color("climate.button06_icon", 10597); id(disp1).set_component_font_color("climate.button07_icon", (id(thermostat_embedded).mode==climate::CLIMATE_MODE_OFF) ? 35921 : 48631); + - lambda: ESP_LOGV("script.addon_climate_update_page_climate", "Finished"); switch: ##### PHYSICAL SWITCH 0 (Dummy) - Used when relay is not set #####