Add state callback to ota component (#1816)

Co-authored-by: Maurice Makaay <mmakaay1@xs4all.net>
Co-authored-by: Guillermo Ruffino <glm.net@gmail.com>
This commit is contained in:
Maurice Makaay
2021-07-11 07:52:19 +12:00
committed by GitHub
co-authored by Maurice Makaay Guillermo Ruffino
parent cdbc146e5d
commit 623570a117
5 changed files with 184 additions and 1 deletions
+18
View File
@@ -197,6 +197,24 @@ ota:
port: 3286
reboot_timeout: 2min
num_attempts: 5
on_state_change:
then:
lambda: >-
ESP_LOGD("ota", "State %d", state);
on_begin:
then:
logger.log: "OTA begin"
on_progress:
then:
lambda: >-
ESP_LOGD("ota", "Got progress %f", x);
on_end:
then:
logger.log: "OTA end"
on_error:
then:
lambda: >-
ESP_LOGD("ota", "Got error code %d", x);
logger:
baud_rate: 0