From ff917d663e616b906a944f807f1d1b80652bd8b0 Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Thu, 19 Oct 2023 15:44:06 +0200 Subject: [PATCH] Improved split of addon climate files To make it easier to maintain --- nspanel_esphome_addon_climate_base.yaml | 27 +++++++++++++++++++++++++ nspanel_esphome_addon_climate_cool.yaml | 20 +----------------- nspanel_esphome_addon_climate_heat.yaml | 20 +----------------- 3 files changed, 29 insertions(+), 38 deletions(-) diff --git a/nspanel_esphome_addon_climate_base.yaml b/nspanel_esphome_addon_climate_base.yaml index 7c77ecd..131f2a3 100644 --- a/nspanel_esphome_addon_climate_base.yaml +++ b/nspanel_esphome_addon_climate_base.yaml @@ -22,6 +22,33 @@ substitutions: addon_climate_heat: "false" ############################## +climate: + - platform: thermostat + name: ${device_name} Thermostat + id: thermostat_embedded + sensor: temp_nspanel + min_idle_time: ${min_idle_time}s + visual: + min_temperature: ${temp_min} ${temp_units} + max_temperature: ${temp_max} ${temp_units} + temperature_step: ${temp_step} ${temp_units} + idle_action: + - switch.turn_off: relay_${heater_relay} + default_preset: "Off" + on_boot_restore_from: memory + preset: + - name: "Off" + default_target_temperature_low: ${temp_min} ${temp_units} + mode: "off" + - name: Home + default_target_temperature_low: 21 ${temp_units} + internal: false + on_state: + - logger.log: Climate state changed - Start + - script.execute: addon_climate_update_page_climate + - script.execute: addon_climate_update_page_home + - logger.log: Climate state changed - End + globals: ##### Is embedded thermostat visible on climate page? ##### - id: is_addon_climate_visible diff --git a/nspanel_esphome_addon_climate_cool.yaml b/nspanel_esphome_addon_climate_cool.yaml index 7fbe729..a61fbbc 100644 --- a/nspanel_esphome_addon_climate_cool.yaml +++ b/nspanel_esphome_addon_climate_cool.yaml @@ -17,35 +17,17 @@ substitutions: ############################## climate: - - platform: thermostat - name: ${device_name} Thermostat - id: thermostat_embedded - sensor: temp_nspanel + - id: !extend thermostat_embedded min_cooling_off_time: ${min_off_time}s min_cooling_run_time: ${min_run_time}s - min_idle_time: ${min_idle_time}s - visual: - min_temperature: ${temp_min} ${temp_units} - max_temperature: ${temp_max} ${temp_units} - temperature_step: ${temp_step} ${temp_units} cool_action: - switch.turn_on: relay_${cooler_relay} - idle_action: - - switch.turn_off: relay_${cooler_relay} - default_preset: "Off" - on_boot_restore_from: memory preset: - name: "Off" default_target_temperature_high: ${temp_min} ${temp_units} mode: "off" - name: Home default_target_temperature_high: 21 ${temp_units} - internal: false - on_state: - - logger.log: Climate state changed - Start - - script.execute: addon_climate_update_page_climate - - script.execute: addon_climate_update_page_home - - logger.log: Climate state changed - End packages: core_package: !include nspanel_esphome_addon_climate_base.yaml diff --git a/nspanel_esphome_addon_climate_heat.yaml b/nspanel_esphome_addon_climate_heat.yaml index 4ff2fb2..4c7ddc3 100644 --- a/nspanel_esphome_addon_climate_heat.yaml +++ b/nspanel_esphome_addon_climate_heat.yaml @@ -17,35 +17,17 @@ substitutions: ############################## climate: - - platform: thermostat - name: ${device_name} Thermostat - id: thermostat_embedded - sensor: temp_nspanel + - id: !extend thermostat_embedded 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: ${temp_min} ${temp_units} - max_temperature: ${temp_max} ${temp_units} - temperature_step: ${temp_step} ${temp_units} heat_action: - switch.turn_on: relay_${heater_relay} - idle_action: - - switch.turn_off: relay_${heater_relay} - default_preset: "Off" - on_boot_restore_from: memory preset: - name: "Off" default_target_temperature_low: ${temp_min} ${temp_units} mode: "off" - name: Home default_target_temperature_low: 21 ${temp_units} - internal: false - on_state: - - logger.log: Climate state changed - Start - - script.execute: addon_climate_update_page_climate - - script.execute: addon_climate_update_page_home - - logger.log: Climate state changed - End packages: core_package: !include nspanel_esphome_addon_climate_base.yaml