mirror of
https://github.com/esphome/esphome-docs.git
synced 2025-01-24 22:02:04 +01:00
feat(WiFi): Add wifi.configure action (#4186)
This commit is contained in:
parent
79a438b8a5
commit
4a4d0ae752
@ -327,6 +327,35 @@ This action turns on the WiFi interface on demand.
|
||||
|
||||
The configuration option ``enable_on_boot`` can be set to ``false`` if you do not want wifi to be enabled on boot.
|
||||
|
||||
.. _wifi-configure:
|
||||
|
||||
``wifi.configure`` Action
|
||||
--------------------------------
|
||||
|
||||
This action connects to an SSID and password, optionally saving it in persistent memory so that the next time the WiFi interface is enabled, it will connect to the stored access point.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
on_...:
|
||||
then:
|
||||
- wifi.configure:
|
||||
ssid: "MyHomeNetwork"
|
||||
password: "VerySafePassword"
|
||||
save: true
|
||||
timeout: 30000ms
|
||||
on_connect:
|
||||
- logger.log: "Connected to WiFi!"
|
||||
on_error:
|
||||
- logger.log: "Failed to connect to WiFi!"
|
||||
|
||||
Configuration variables:
|
||||
|
||||
- **ssid** (*Required*, string, :ref:`templatable <config-templatable>`): The name of the WiFi access point.
|
||||
- **password** (*Required*, string, :ref:`templatable <config-templatable>`): The password of the WiFi access point. Leave empty for no password.
|
||||
- **save** (*Optional*, boolean, :ref:`templatable <config-templatable>`): If set to ``true``, the SSID and password will be saved in persistent memory. Defaults to ``true``.
|
||||
- **timeout** (*Optional*, :ref:`config-time`, :ref:`templatable <config-templatable>`): The time to wait for the connection to be established. Defaults to 30 seconds.
|
||||
- **on_connect** (*Optional*, :ref:`Automation <automation>`): An action to be performed when a connection is established.
|
||||
- **on_error** (*Optional*, :ref:`Automation <automation>`): An action to be performed when the connection fails.
|
||||
|
||||
.. _wifi-connected_condition:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user