Update wifi.rst (#3014)

This commit is contained in:
H. Árkosi Róbert 2023-06-22 12:10:46 +02:00 committed by GitHub
parent 3e9396ad62
commit 58cdc09af8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -273,17 +273,38 @@ Configuration variables:
Optionally encrypted with ``password``. Optionally encrypted with ``password``.
Turning on and off WiFi ``wifi.disable`` Action
----------------------- -----------------------
Using the actions ``wifi.enable`` and ``wifi.disable``, you can turn on and off the WiFi interface on demand. This action turns off 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.
.. code-block:: yaml
on_...:
then:
- wifi.disable:
.. note:: .. note::
Be aware that if you disable WiFi, the API timeout will need to be disabled otherwise the device will reboot. Be aware that if you disable WiFi, the API timeout will need to be disabled otherwise the device will reboot.
``wifi.enable`` Action
----------------------
This action turns on the WiFi interface on demand.
.. code-block:: yaml
on_...:
then:
- wifi.enable:
.. note::
The configuration option ``enable_on_boot`` can be set to ``false`` if you do not want wifi to be enabled on boot.
.. _wifi-connected_condition: .. _wifi-connected_condition:
``wifi.connected`` Condition ``wifi.connected`` Condition
@ -300,6 +321,31 @@ This :ref:`Condition <config-condition>` checks if the WiFi client is currently
then: then:
- logger.log: WiFi is connected! - logger.log: WiFi is connected!
The lambda equivalent for this is ``id(wifi_id).is_connected()``.
.. _wifi-enabled_condition:
``wifi.enabled`` Condition
--------------------------
This :ref:`Condition <config-condition>` checks if WiFi is currently enabled or not.
.. code-block:: yaml
on_...:
- if:
condition: wifi.enabled
then:
- wifi.disable:
else:
- wifi.enable:
The lambda equivalent for this is ``!id(wifi_id).is_disabled()``.
See Also See Also
-------- --------
@ -308,5 +354,6 @@ See Also
- :doc:`sensor/wifi_signal` - :doc:`sensor/wifi_signal`
- :doc:`network` - :doc:`network`
- :doc:`/components/ethernet` - :doc:`/components/ethernet`
- :doc:`api`
- :apiref:`wifi/wifi_component.h` - :apiref:`wifi/wifi_component.h`
- :ghedit:`Edit` - :ghedit:`Edit`