From 6a378af92ef50d150ba89ef96e90b5d87a358ae5 Mon Sep 17 00:00:00 2001 From: Stas Date: Tue, 10 Jan 2023 07:40:48 +0300 Subject: [PATCH] http_request: document new parameter `duration_ms` in `on_response` handler (#2578) --- components/http_request.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/components/http_request.rst b/components/http_request.rst index 791936439..ef7f7da45 100644 --- a/components/http_request.rst +++ b/components/http_request.rst @@ -63,9 +63,10 @@ This :ref:`action ` sends a GET request. on_response: then: - logger.log: - format: 'Response status: %d' + format: 'Response status: %d, Duration: %u ms' args: - status_code + - duration_ms # Short form - http_request.get: https://esphome.io @@ -135,8 +136,10 @@ Configuration variables: ``on_response`` Trigger ----------------------- -This automation will be triggered when the HTTP request is finished and will supply the -http response code in parameter ``status_code`` as an ``int``. +This automation will be triggered when the HTTP request is finished and will supply these parameters: + +* ``status_code`` as ``int`` - http response code +* ``duration_ms`` as ``uint32`` - time taken to complete the request .. code-block:: yaml @@ -148,9 +151,10 @@ http response code in parameter ``status_code`` as an ``int``. on_response: then: - logger.log: - format: "Response status: %d" + format: "Response status: %d, Duration: %u ms" args: - status_code + - duration_ms .. _http_request-examples: