Reboot with Wi-Fi timeout

This commit is contained in:
Edward Firmo
2023-12-28 02:16:21 +01:00
parent a929d88dc4
commit d7d249308a

View File

@@ -739,6 +739,12 @@ display:
##### START - GLOBALS CONFIGURATION #####
globals:
##### Wi-Fi timeout #####
- id: wifi_timeout
type: uint
restore_value: false
initial_value: '15'
##### Is uploading TFT #####
- id: is_uploading_tft
type: bool
@@ -828,7 +834,7 @@ globals:
- id: mui_time_format
type: std::string
restore_value: false
restore_value: true
initial_value: '"%H:%M"'
- id: home_time_color
type: uint
@@ -848,7 +854,7 @@ globals:
##### Relay icons #####
- id: home_relay1_icon
type: std::string
restore_value: false
restore_value: true
initial_value: ''
- id: home_relay1_icon_color
type: uint16_t
@@ -857,7 +863,7 @@ globals:
- id: home_relay2_icon
type: std::string
restore_value: false
restore_value: true
initial_value: ''
- id: home_relay2_icon_color
type: uint16_t
@@ -3011,8 +3017,14 @@ script:
disp1->send_command_printf("api=%i", id(is_blueprint_updated) ? 1 : 0);
if (!wifi_connected) {
ESP_LOGD(TAG, "Retrying Wi-Fi connection");
wifi_component->retry_connect();
if (id(wifi_timeout) > 0) {
id(wifi_timeout)--;
ESP_LOGD(TAG, "Retrying Wi-Fi connection");
wifi_component->retry_connect();
} else {
ESP_LOGE(TAG, "Restarting ESP due to a Wi-Fi timeout...");
App.safe_reboot();
}
}
if (api_connected) {
if (not id(is_blueprint_updated)) {