Extend watchdog to add-ons

This commit is contained in:
Edward Firmo
2023-12-27 14:26:47 +01:00
parent 4ad5457b0f
commit 357572d401
2 changed files with 46 additions and 1 deletions

View File

@@ -161,3 +161,48 @@ script:
- lambda: |-
if (current_page->state == "climate")
id(is_addon_climate_visible) = embedded_climate;
- id: !extend watchdog
then:
- lambda: |-
static const char *const TAG = "script.watchdog (add-on climate)";
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_LOGD(TAG, "Add-on climate:");
if (addon_climate_cool) {
ESP_LOGD(TAG, " Cool: %s", addon_climate_cool ? "Enabled" : "Disabled");
if (cooler_relay == 1 or cooler_relay == 2)
ESP_LOGD(TAG, " Relay: %i", cooler_relay);
else
ESP_LOGE(TAG, " Relay: %i", cooler_relay);
}
if (addon_climate_heat) {
ESP_LOGD(TAG, " Heat: %s", addon_climate_heat ? "Enabled" : "Disabled");
if (heater_relay == 1 or heater_relay == 2)
ESP_LOGD(TAG, " Relay: %i", heater_relay);
else
ESP_LOGE(TAG, " Relay: %i", heater_relay);
}
if (addon_climate_dual) {
ESP_LOGD(TAG, " Dual: %s", addon_climate_dual ? "Enabled" : "Disabled");
if (cooler_relay == 1 or cooler_relay == 2)
ESP_LOGD(TAG, " Relay (cooler): %i", cooler_relay);
else
ESP_LOGE(TAG, " Relay (cooler): %i", cooler_relay);
if (heater_relay == 1 or heater_relay == 2)
ESP_LOGD(TAG, " Relay (heater): %i", heater_relay);
else
ESP_LOGE(TAG, " Relay (heater): %i", 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");
}

View File

@@ -2915,7 +2915,7 @@ script:
// report Wi-Fi status
bool wifi_connected = wifi_component->is_connected();
if (wifi_connected)
ESP_LOGD(TAG, "Wi-Fi: %.0fdB", wifi_rssi->state);
ESP_LOGD(TAG, "Wi-Fi: %.0f dBm", wifi_rssi->state);
else
ESP_LOGW(TAG, "Wi-Fi: DISCONNECTED");