1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-01 19:02:18 +01:00

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-10 21:52:19 +02:00
committed by GitHub
parent cdbc146e5d
commit 623570a117
5 changed files with 184 additions and 1 deletions

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