mirror of
https://github.com/esphome/esphome-docs.git
synced 2024-10-31 08:31:29 +01:00
http_request: document new parameter duration_ms
in on_response
handler (#2578)
This commit is contained in:
parent
f08998729a
commit
6a378af92e
@ -63,9 +63,10 @@ This :ref:`action <config-action>` sends a GET request.
|
|||||||
on_response:
|
on_response:
|
||||||
then:
|
then:
|
||||||
- logger.log:
|
- logger.log:
|
||||||
format: 'Response status: %d'
|
format: 'Response status: %d, Duration: %u ms'
|
||||||
args:
|
args:
|
||||||
- status_code
|
- status_code
|
||||||
|
- duration_ms
|
||||||
# Short form
|
# Short form
|
||||||
- http_request.get: https://esphome.io
|
- http_request.get: https://esphome.io
|
||||||
|
|
||||||
@ -135,8 +136,10 @@ Configuration variables:
|
|||||||
``on_response`` Trigger
|
``on_response`` Trigger
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
This automation will be triggered when the HTTP request is finished and will supply the
|
This automation will be triggered when the HTTP request is finished and will supply these parameters:
|
||||||
http response code in parameter ``status_code`` as an ``int``.
|
|
||||||
|
* ``status_code`` as ``int`` - http response code
|
||||||
|
* ``duration_ms`` as ``uint32`` - time taken to complete the request
|
||||||
|
|
||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
@ -148,9 +151,10 @@ http response code in parameter ``status_code`` as an ``int``.
|
|||||||
on_response:
|
on_response:
|
||||||
then:
|
then:
|
||||||
- logger.log:
|
- logger.log:
|
||||||
format: "Response status: %d"
|
format: "Response status: %d, Duration: %u ms"
|
||||||
args:
|
args:
|
||||||
- status_code
|
- status_code
|
||||||
|
- duration_ms
|
||||||
|
|
||||||
|
|
||||||
.. _http_request-examples:
|
.. _http_request-examples:
|
||||||
|
Loading…
Reference in New Issue
Block a user