mirror of
https://github.com/esphome/esphome.git
synced 2026-02-18 15:35:59 -07:00
[http_request] Pass trigger variables into on_response/on_error (#11464)
This commit is contained in:
@@ -4,51 +4,6 @@ wifi:
|
||||
ssid: MySSID
|
||||
password: password1
|
||||
|
||||
esphome:
|
||||
on_boot:
|
||||
then:
|
||||
- http_request.get:
|
||||
url: https://esphome.io
|
||||
request_headers:
|
||||
Content-Type: application/json
|
||||
collect_headers:
|
||||
- age
|
||||
on_error:
|
||||
logger.log: "Request failed"
|
||||
on_response:
|
||||
then:
|
||||
- logger.log:
|
||||
format: "Response status: %d, Duration: %lu ms, age: %s"
|
||||
args:
|
||||
- response->status_code
|
||||
- (long) response->duration_ms
|
||||
- response->get_response_header("age").c_str()
|
||||
- http_request.post:
|
||||
url: https://esphome.io
|
||||
request_headers:
|
||||
Content-Type: application/json
|
||||
json:
|
||||
key: value
|
||||
- http_request.send:
|
||||
method: PUT
|
||||
url: https://esphome.io
|
||||
request_headers:
|
||||
Content-Type: application/json
|
||||
body: "Some data"
|
||||
|
||||
http_request:
|
||||
useragent: esphome/tagreader
|
||||
timeout: 10s
|
||||
verify_ssl: ${verify_ssl}
|
||||
|
||||
script:
|
||||
- id: does_not_compile
|
||||
parameters:
|
||||
api_url: string
|
||||
then:
|
||||
- http_request.get:
|
||||
url: "http://google.com"
|
||||
|
||||
ota:
|
||||
- platform: http_request
|
||||
id: http_request_ota
|
||||
|
||||
Reference in New Issue
Block a user