Skip to content

Commit

Permalink
feat(WiFi): Add wifi.configure action (#4186)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rapsssito authored Nov 24, 2024
1 parent 79a438b commit 4a4d0ae
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions components/wifi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down

0 comments on commit 4a4d0ae

Please sign in to comment.