Don't run scripts during upload

This commit is contained in:
Edward Firmo
2024-02-06 10:32:18 +01:00
parent 9cae2b3d9f
commit 6b03d7c44f

View File

@@ -82,7 +82,7 @@ script:
- id: !extend change_climate_state - id: !extend change_climate_state
then: then:
- lambda: |- - lambda: |-
if (embedded) { if (embedded and !id(is_uploading_tft)) {
static const char *const TAG = "addon_climate_base.script.change_climate_state"; static const char *const TAG = "addon_climate_base.script.change_climate_state";
auto FahrenheitToCelsius = [](float fahrenheit) -> float { auto FahrenheitToCelsius = [](float fahrenheit) -> float {
return (fahrenheit - 32.0) * 5.0 / 9.0; return (fahrenheit - 32.0) * 5.0 / 9.0;
@@ -136,7 +136,7 @@ script:
then: then:
- lambda: |- - lambda: |-
id(is_addon_climate_visible) = (current_page->state == "climate" and detailed_entity->state == "embedded_climate"); id(is_addon_climate_visible) = (current_page->state == "climate" and detailed_entity->state == "embedded_climate");
if (id(is_addon_climate_visible)) { if (id(is_addon_climate_visible) and !id(is_uploading_tft)) {
static const char *const TAG = "addon_climate_base.script.page_climate"; static const char *const TAG = "addon_climate_base.script.page_climate";
auto CelsiusToFahrenheit = [](float celsius) -> float { auto CelsiusToFahrenheit = [](float celsius) -> float {
return (celsius * 9 / 5) + 32; return (celsius * 9 / 5) + 32;
@@ -207,57 +207,59 @@ script:
then: then:
- lambda: |- - lambda: |-
// Update chips // Update chips
if (id(is_embedded_thermostat)) if (id(is_embedded_thermostat) and !id(is_uploading_tft))
update_climate_icon->execute("home.icon_top_03", int(thermostat_embedded->action), int(thermostat_embedded->mode)); update_climate_icon->execute("home.icon_top_03", int(thermostat_embedded->action), int(thermostat_embedded->mode));
- id: !extend set_climate - id: !extend set_climate
then: then:
- lambda: |- - lambda: |-
if (current_page->state == "climate") if (current_page->state == "climate" and !id(is_uploading_tft))
id(is_addon_climate_visible) = embedded_climate; id(is_addon_climate_visible) = embedded_climate;
- id: !extend watchdog - id: !extend watchdog
then: then:
- lambda: |- - lambda: |-
static const char *const TAG = "addon_climate_base.script.watchdog"; if (!id(is_uploading_tft)) {
bool addon_climate_cool = ${addon_climate_cool}; static const char *const TAG = "addon_climate_base.script.watchdog";
bool addon_climate_heat = ${addon_climate_heat}; bool addon_climate_cool = ${addon_climate_cool};
bool addon_climate_dual = ${addon_climate_dual}; bool addon_climate_heat = ${addon_climate_heat};
uint cooler_relay = ${cooler_relay}; bool addon_climate_dual = ${addon_climate_dual};
uint heater_relay = ${heater_relay}; uint cooler_relay = ${cooler_relay};
ESP_LOGI(TAG, "Add-on climate:"); uint heater_relay = ${heater_relay};
if (addon_climate_cool) { ESP_LOGI(TAG, "Add-on climate:");
ESP_LOGI(TAG, " Cool: %s", addon_climate_cool ? "Enabled" : "Disabled"); if (addon_climate_cool) {
if (cooler_relay == 1 or cooler_relay == 2) ESP_LOGI(TAG, " Cool: %s", addon_climate_cool ? "Enabled" : "Disabled");
ESP_LOGI(TAG, " Relay: %u", cooler_relay); if (cooler_relay == 1 or cooler_relay == 2)
else ESP_LOGI(TAG, " Relay: %u", cooler_relay);
ESP_LOGE(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 (addon_climate_heat) {
if (heater_relay == 1 or heater_relay == 2) ESP_LOGI(TAG, " Heat: %s", addon_climate_heat ? "Enabled" : "Disabled");
ESP_LOGI(TAG, " Relay: %u", heater_relay); if (heater_relay == 1 or heater_relay == 2)
else ESP_LOGI(TAG, " Relay: %u", heater_relay);
ESP_LOGE(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 (addon_climate_dual) {
if (cooler_relay == 1 or cooler_relay == 2) ESP_LOGI(TAG, " Dual: %s", addon_climate_dual ? "Enabled" : "Disabled");
ESP_LOGI(TAG, " Relay (cooler): %u", cooler_relay); if (cooler_relay == 1 or cooler_relay == 2)
else ESP_LOGI(TAG, " Relay (cooler): %u", cooler_relay);
ESP_LOGE(TAG, " Relay (cooler): %u", cooler_relay); else
if (heater_relay == 1 or heater_relay == 2) ESP_LOGE(TAG, " Relay (cooler): %u", cooler_relay);
ESP_LOGI(TAG, " Relay (heater): %u", heater_relay); if (heater_relay == 1 or heater_relay == 2)
else ESP_LOGI(TAG, " Relay (heater): %u", heater_relay);
ESP_LOGE(TAG, " Relay (heater): %u", heater_relay); else
if (cooler_relay == heater_relay) ESP_LOGE(TAG, " Relay (heater): %u", heater_relay);
ESP_LOGE(TAG, " Double relay assignment"); if (cooler_relay == heater_relay)
} ESP_LOGE(TAG, " Double relay assignment");
}
if ((addon_climate_cool && addon_climate_heat) || if ((addon_climate_cool && addon_climate_heat) ||
(addon_climate_cool && addon_climate_dual) || (addon_climate_cool && addon_climate_dual) ||
(addon_climate_heat && addon_climate_dual) || (addon_climate_heat && addon_climate_dual) ||
(!addon_climate_cool && !addon_climate_heat && !addon_climate_dual)) { (!addon_climate_cool && !addon_climate_heat && !addon_climate_dual)) {
ESP_LOGE(TAG, "Invalid settings for add-on Climate"); ESP_LOGE(TAG, "Invalid settings for add-on Climate");
}
} }
... ...