Skip to content

Commit

Permalink
Merge pull request #2327 from Blackymas/dev
Browse files Browse the repository at this point in the history
Yaml to lambda OTA log
  • Loading branch information
edwardtfn authored Oct 15, 2024
2 parents 0495156 + 8a42d02 commit 4018f13
Showing 1 changed file with 13 additions and 47 deletions.
60 changes: 13 additions & 47 deletions esphome/nspanel_esphome_core_base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,53 +126,19 @@ ota:
password: ${ota_password}
on_state_change:
then:
- script.execute:
id: goto_page
page: boot
- if:
condition:
- lambda: return state == ota::OTA_STARTED;
then:
- script.execute:
id: set_component_value
page: boot
component: progress
val: 0
- script.execute:
id: boot_log
category: OTA
log_message: Started
- if:
condition:
- lambda: return state == ota::OTA_IN_PROGRESS;
then:
- lambda: |-
disp1->send_command("progress.val+=10");
- script.execute:
id: boot_log
category: OTA
log_message: In progress
- if:
condition:
- lambda: return state == ota::OTA_COMPLETED;
then:
- script.execute:
id: set_component_value
page: boot
component: progress
val: 100
- script.execute:
id: boot_log
category: OTA
log_message: Completed
- if:
condition:
- lambda: return state == ota::OTA_ERROR;
then:
- script.execute:
id: boot_log
category: OTA
log_message: Error
- lambda: |-
goto_page->execute("boot");
if (state == ota::OTA_STARTED) {
set_component_value->execute("boot", "progress", 0);
boot_log->execute("OTA", "Started");
} else if (state == ota::OTA_IN_PROGRESS) {
disp1->send_command("progress.val+=10");
boot_log->execute("OTA", "In progress");
} else if (state == ota::OTA_COMPLETED) {
set_component_value->execute("boot", "progress", 100);
boot_log->execute("OTA", "Completed");
} else if (state == ota::OTA_ERROR)
boot_log->execute("OTA", "Error");
safe_mode:
reboot_timeout: 3min
Expand Down

0 comments on commit 4018f13

Please sign in to comment.