http_request: document new parameter duration_ms in on_response handler (#2578)

This commit is contained in:
Stas 2023-01-10 07:40:48 +03:00 committed by GitHub
parent f08998729a
commit 6a378af92e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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: