mirror of
https://github.com/esphome/esphome-docs.git
synced 2024-12-25 17:17:54 +01:00
Update wifi.rst (#3014)
This commit is contained in:
parent
3e9396ad62
commit
58cdc09af8
@ -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`
|
||||||
|
Loading…
Reference in New Issue
Block a user