Introduces bs_boot_completed to know the boot status
To know when the boot was completed
This commit is contained in:
@@ -27,7 +27,7 @@ substitutions:
|
|||||||
TX_MODEL_3_GANG_TEXT: "3 Gang"
|
TX_MODEL_3_GANG_TEXT: "3 Gang"
|
||||||
TX_MODEL_4_GANG_TEXT: "4 Gang"
|
TX_MODEL_4_GANG_TEXT: "4 Gang"
|
||||||
|
|
||||||
DUMP_CONFIG_CALLER_DELAY: 10s # Delay to dump config after requested
|
DUMP_CONFIG_CALLER_DELAY: 5s # Delay to dump config after requested
|
||||||
|
|
||||||
TAG_CORE_COMMON: core.common
|
TAG_CORE_COMMON: core.common
|
||||||
|
|
||||||
@@ -48,11 +48,18 @@ binary_sensor:
|
|||||||
device_class: problem
|
device_class: problem
|
||||||
on_state:
|
on_state:
|
||||||
then:
|
then:
|
||||||
- lambda: |-
|
- script.execute: dump_config_caller
|
||||||
if (x)
|
|
||||||
ESP_LOGW("${TAG_CORE_COMMON}", "Pending restart: YES");
|
- id: bs_boot_completed
|
||||||
else
|
name: Boot Completed
|
||||||
ESP_LOGD("${TAG_CORE_COMMON}", "Pending restart: No");
|
internal: false
|
||||||
|
disabled_by_default: false
|
||||||
|
platform: template
|
||||||
|
entity_category: diagnostic
|
||||||
|
device_class: connectivity
|
||||||
|
icon: mdi:rocket-launch
|
||||||
|
on_state:
|
||||||
|
then:
|
||||||
- script.execute: dump_config_caller
|
- script.execute: dump_config_caller
|
||||||
|
|
||||||
button:
|
button:
|
||||||
@@ -80,6 +87,12 @@ esphome:
|
|||||||
- -D TX_ULTIMATE_EASY_CORE_COMMON
|
- -D TX_ULTIMATE_EASY_CORE_COMMON
|
||||||
|
|
||||||
on_boot:
|
on_boot:
|
||||||
|
- priority: 1000 # Very early in boot process
|
||||||
|
then:
|
||||||
|
- binary_sensor.template.publish:
|
||||||
|
id: bs_boot_completed
|
||||||
|
state: OFF # yamllint disable-line rule:truthy
|
||||||
|
|
||||||
- priority: 750
|
- priority: 750
|
||||||
then:
|
then:
|
||||||
- script.execute: restore_from_nvs
|
- script.execute: restore_from_nvs
|
||||||
@@ -106,16 +119,16 @@ external_components:
|
|||||||
- tx_ultimate_easy
|
- tx_ultimate_easy
|
||||||
|
|
||||||
globals:
|
globals:
|
||||||
- id: is_us_model
|
|
||||||
type: bool
|
|
||||||
restore_value: true
|
|
||||||
initial_value: 'false'
|
|
||||||
|
|
||||||
- id: gang_count
|
- id: gang_count
|
||||||
type: uint8_t
|
type: uint8_t
|
||||||
restore_value: true
|
restore_value: true
|
||||||
initial_value: '0'
|
initial_value: '0'
|
||||||
|
|
||||||
|
- id: is_us_model
|
||||||
|
type: bool
|
||||||
|
restore_value: true
|
||||||
|
initial_value: 'false'
|
||||||
|
|
||||||
logger:
|
logger:
|
||||||
level: DEBUG
|
level: DEBUG
|
||||||
|
|
||||||
@@ -143,9 +156,16 @@ script:
|
|||||||
- id: boot_done
|
- id: boot_done
|
||||||
mode: restart
|
mode: restart
|
||||||
then:
|
then:
|
||||||
|
- script.wait: restore_from_nvs
|
||||||
|
- script.wait: boot_initialize
|
||||||
|
- script.wait: boot_sequence
|
||||||
- script.execute:
|
- script.execute:
|
||||||
id: api_send_ha_event_boot
|
id: api_send_ha_event_boot
|
||||||
type: done
|
type: done
|
||||||
|
- script.wait: api_send_ha_event_boot
|
||||||
|
- binary_sensor.template.publish:
|
||||||
|
id: bs_boot_completed
|
||||||
|
state: ON # yamllint disable-line rule:truthy
|
||||||
|
|
||||||
- id: boot_initialize
|
- id: boot_initialize
|
||||||
mode: restart
|
mode: restart
|
||||||
@@ -208,6 +228,12 @@ script:
|
|||||||
ESP_LOGCONFIG("${TAG_CORE_COMMON}", "Gangs (detected): %" PRIu8 "-Gang%s",
|
ESP_LOGCONFIG("${TAG_CORE_COMMON}", "Gangs (detected): %" PRIu8 "-Gang%s",
|
||||||
id(gang_count), id(gang_count) > 1 ? "s" : "");
|
id(gang_count), id(gang_count) > 1 ? "s" : "");
|
||||||
|
|
||||||
|
// Boot completion status
|
||||||
|
if (bs_boot_completed->state)
|
||||||
|
ESP_LOGCONFIG("${TAG_CORE_COMMON}", "Boot completed: Yes");
|
||||||
|
else
|
||||||
|
ESP_LOGW("${TAG_CORE_COMMON}", "Boot completed: NO");
|
||||||
|
|
||||||
// System state
|
// System state
|
||||||
if (bs_pending_restart->state)
|
if (bs_pending_restart->state)
|
||||||
ESP_LOGW("${TAG_CORE_COMMON}", "Pending restart: YES");
|
ESP_LOGW("${TAG_CORE_COMMON}", "Pending restart: YES");
|
||||||
|
|||||||
Reference in New Issue
Block a user