Add build flags

This commit is contained in:
Edward Firmo
2024-04-07 17:49:46 +02:00
parent 140cbdd409
commit aafbc722fd
8 changed files with 130 additions and 2 deletions

View File

@@ -32,6 +32,11 @@ substitutions:
addon_climate_dual: "false"
##############################
esphome:
platformio_options:
build_flags:
- -D NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_BASE
climate:
- platform: thermostat
name: Thermostat
@@ -192,4 +197,51 @@ script:
- lambda: |-
if (current_page->state == "climate" and !id(is_uploading_tft))
id(is_addon_climate_visible) = embedded_climate;
- id: !extend watchdog
then:
- lambda: |-
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");
}
}
...