diff --git a/esphome/nspanel_esphome_addon_climate_base.yaml b/esphome/nspanel_esphome_addon_climate_base.yaml index dd57abd..18aae4d 100644 --- a/esphome/nspanel_esphome_addon_climate_base.yaml +++ b/esphome/nspanel_esphome_addon_climate_base.yaml @@ -201,47 +201,47 @@ script: - id: !extend watchdog then: - lambda: |- + // Check if more than one or none of the climate options are defined + #if defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_COOL) && defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_HEAT) + #error "Invalid settings for add-on Climate. More than one option selected: Cool + Heat." + #elif defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_COOL) && defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_DUAL) + #error "Invalid settings for add-on Climate. More than one option selected: Cool + Dual." + #elif defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_HEAT) && defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_DUAL) + #error "Invalid settings for add-on Climate. More than one option selected: Heat + Dual." + #elif !defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_COOL) && !defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_HEAT) && !defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_DUAL) + #error "Invalid settings for add-on Climate. No option selected between Cool, Heat or Dual." + #endif if (!id(is_uploading_tft)) { static const char *const TAG = "addon_climate_base.script.watchdog"; - bool addon_climate_cool = ${addon_climate_cool}; - bool addon_climate_heat = ${addon_climate_heat}; - bool addon_climate_dual = ${addon_climate_dual}; uint cooler_relay = ${cooler_relay}; uint heater_relay = ${heater_relay}; ESP_LOGI(TAG, "Add-on climate:"); - if (addon_climate_cool) { - ESP_LOGI(TAG, " Cool: %s", addon_climate_cool ? "Enabled" : "Disabled"); - if (cooler_relay == 1 or cooler_relay == 2) - ESP_LOGI(TAG, " Relay: %u", cooler_relay); - else - ESP_LOGE(TAG, " Relay: %u", cooler_relay); - } - if (addon_climate_heat) { - ESP_LOGI(TAG, " Heat: %s", addon_climate_heat ? "Enabled" : "Disabled"); - if (heater_relay == 1 or heater_relay == 2) - ESP_LOGI(TAG, " Relay: %u", heater_relay); - else - ESP_LOGE(TAG, " Relay: %u", heater_relay); - } - if (addon_climate_dual) { - ESP_LOGI(TAG, " Dual: %s", addon_climate_dual ? "Enabled" : "Disabled"); - if (cooler_relay == 1 or cooler_relay == 2) - ESP_LOGI(TAG, " Relay (cooler): %u", cooler_relay); - else - ESP_LOGE(TAG, " Relay (cooler): %u", cooler_relay); - if (heater_relay == 1 or heater_relay == 2) - ESP_LOGI(TAG, " Relay (heater): %u", heater_relay); - else - ESP_LOGE(TAG, " Relay (heater): %u", heater_relay); - if (cooler_relay == heater_relay) - ESP_LOGE(TAG, " Double relay assignment"); - } - - if ((addon_climate_cool && addon_climate_heat) || - (addon_climate_cool && addon_climate_dual) || - (addon_climate_heat && addon_climate_dual) || - (!addon_climate_cool && !addon_climate_heat && !addon_climate_dual)) { - ESP_LOGE(TAG, "Invalid settings for add-on Climate"); - } + #ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_COOL + ESP_LOGI(TAG, " Cool: Enabled"); + if (cooler_relay == 1 or cooler_relay == 2) + ESP_LOGI(TAG, " Relay: %u", cooler_relay); + else + ESP_LOGE(TAG, " Relay: %u", cooler_relay); + #endif + #ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_HEAT + ESP_LOGI(TAG, " Heat: Enabled"); + if (heater_relay == 1 or heater_relay == 2) + ESP_LOGI(TAG, " Relay: %u", heater_relay); + else + ESP_LOGE(TAG, " Relay: %u", heater_relay); + #endif + #ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_DUAL + ESP_LOGI(TAG, " Dual: Enabled"); + if (cooler_relay == 1 or cooler_relay == 2) + ESP_LOGI(TAG, " Relay (cooler): %u", cooler_relay); + else + ESP_LOGE(TAG, " Relay (cooler): %u", cooler_relay); + if (heater_relay == 1 or heater_relay == 2) + ESP_LOGI(TAG, " Relay (heater): %u", heater_relay); + else + ESP_LOGE(TAG, " Relay (heater): %u", heater_relay); + if (cooler_relay == heater_relay) + ESP_LOGE(TAG, " Double relay assignment"); + #endif } ... diff --git a/prebuilt/Wall_Display.yaml b/prebuilt/Wall_Display.yaml index c60166f..09b069a 100644 --- a/prebuilt/Wall_Display.yaml +++ b/prebuilt/Wall_Display.yaml @@ -10,14 +10,13 @@ ##################################################################################################### substitutions: heater_relay: "1" # Possible values: 1/2 - temp_units: "°C" # Temperatures in Fahrenheit temp_min: "16" # Min supported temperature is 40°F temp_max: "26" # Max supported temperature is 80°F temp_step: "0.5" # Temperature granularity is 1°F packages: - climate_heat: !include ../esphome/nspanel_esphome_addon_climate_heat.yaml prebuilt_package: !include nspanel_esphome_prebuilt.yaml + climate_heat: !include ../esphome/nspanel_esphome_addon_climate_heat.yaml dashboard_import: package_import_url: github://Blackymas/NSPanel_HA_Blueprint/prebuilt/Wall_Display.yaml@main