2018-05-13 11:37:02 +02:00
|
|
|
OTA Update Component
|
|
|
|
====================
|
|
|
|
|
2018-11-14 22:12:27 +01:00
|
|
|
.. seo::
|
|
|
|
:description: Instructions for setting up Over-The-Air (OTA) updates for ESPs to upload firmwares remotely.
|
2018-11-19 18:32:16 +01:00
|
|
|
:image: system-update.png
|
2018-11-14 22:12:27 +01:00
|
|
|
:keywords: Xiaomi, Mi Flora, BLE, Bluetooth
|
|
|
|
|
2018-05-13 11:37:02 +02:00
|
|
|
With the OTA (Over The Air) update component you can upload your
|
|
|
|
firmware binaries to your node without having to use an USB cable for
|
2019-02-16 23:25:23 +01:00
|
|
|
uploads. ESPHome natively supports this through its ``run`` and
|
2018-05-13 11:37:02 +02:00
|
|
|
``upload`` helper scripts.
|
|
|
|
|
2019-02-16 23:25:23 +01:00
|
|
|
ESPHome also has an "OTA safe mode". If for some reason your
|
|
|
|
node gets into a boot loop, ESPHome will automatically try to detect
|
2018-05-13 11:37:02 +02:00
|
|
|
this and will go over into a safe mode after 10 unsuccessful boot
|
|
|
|
attempts. In that mode, all components are disabled and only Serial
|
|
|
|
Logging+WiFi+OTA are initialized, so that you can upload a new binary.
|
|
|
|
|
2018-11-19 18:32:16 +01:00
|
|
|
.. code-block:: yaml
|
2018-05-13 11:37:02 +02:00
|
|
|
|
|
|
|
# Example configuration entry
|
|
|
|
ota:
|
|
|
|
safe_mode: True
|
|
|
|
password: VERYSECURE
|
|
|
|
|
|
|
|
Configuration variables:
|
2018-08-24 22:44:01 +02:00
|
|
|
------------------------
|
2018-05-13 11:37:02 +02:00
|
|
|
|
|
|
|
- **safe_mode** (*Optional*, boolean): Whether to enable safe mode.
|
|
|
|
Defaults to ``True``.
|
|
|
|
- **password** (*Optional*, string): The password to use for updates.
|
|
|
|
- **port** (*Optional*, int): The port to use for OTA updates. Defaults
|
|
|
|
to ``3232`` for the ESP32 and ``8266`` for the ESP8266.
|
2018-06-01 18:10:00 +02:00
|
|
|
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
|
|
|
|
|
2019-02-16 23:25:23 +01:00
|
|
|
.. note::
|
|
|
|
|
2019-02-27 18:32:47 +01:00
|
|
|
Please be aware that ESP8266 modules must be reset after a serial
|
|
|
|
upload before OTA can work.
|
|
|
|
When you are trying to conduct an OTA update and receive an error message
|
|
|
|
``Bad Answer: ERR: ERROR[11]: Invalid bootstrapping`` the reason is
|
|
|
|
very likely that power-cycling the ESP module is required once after
|
|
|
|
the serial upload.
|
2019-02-16 23:25:23 +01:00
|
|
|
|
2019-01-17 17:07:57 +01:00
|
|
|
Updating the password:
|
|
|
|
----------------------
|
|
|
|
|
2019-02-16 23:25:23 +01:00
|
|
|
Since the password is used both for compiling and uploading the regular ``esphome <file> run``
|
|
|
|
won't work of course. This issue can be worked around by executing the operations separately
|
2019-10-21 20:35:56 +02:00
|
|
|
through an ``on_boot`` trigger:
|
2019-01-17 17:07:57 +01:00
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
2019-02-16 23:25:23 +01:00
|
|
|
esphome:
|
2019-01-17 17:07:57 +01:00
|
|
|
on_boot:
|
|
|
|
- lambda: |-
|
|
|
|
id(ota).set_auth_password("New password");
|
|
|
|
ota:
|
|
|
|
password: "Old password"
|
|
|
|
id: ota
|
|
|
|
|
2018-06-01 18:10:00 +02:00
|
|
|
See Also
|
|
|
|
--------
|
|
|
|
|
2019-05-12 22:44:59 +02:00
|
|
|
- :apiref:`ota/ota_component.h`
|
2019-02-07 13:54:45 +01:00
|
|
|
- :ghedit:`Edit`
|