mirror of
https://github.com/esphome/esphome.git
synced 2026-05-10 14:09:14 +08:00
87 lines
2.4 KiB
YAML
87 lines
2.4 KiB
YAML
substitutions:
|
|
verify_ssl: "true"
|
|
|
|
network:
|
|
|
|
esphome:
|
|
on_boot:
|
|
then:
|
|
- http_request.get:
|
|
url: https://esphome.io
|
|
request_headers:
|
|
Content-Type: application/json
|
|
on_error:
|
|
logger.log: "Request failed"
|
|
on_response:
|
|
then:
|
|
- logger.log:
|
|
format: "Response status: %d, Duration: %lu ms"
|
|
args:
|
|
- response->status_code
|
|
- (long) response->duration_ms
|
|
- 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.post:
|
|
url: https://esphome.io
|
|
request_headers:
|
|
Content-Type: application/json
|
|
json:
|
|
key: value
|
|
capture_response: true
|
|
on_response:
|
|
then:
|
|
- logger.log:
|
|
format: "Captured response status: %d, Body: %s"
|
|
args:
|
|
- response->status_code
|
|
- body.c_str()
|
|
- delay: 1s
|
|
- logger.log:
|
|
format: "After delay, body still: %s"
|
|
args:
|
|
- body.c_str()
|
|
# Regression test for esphome/esphome#16224: a LightControlAction
|
|
# nested inside on_response with capture_response: true puts
|
|
# `std::string &` into the trigger's Ts..., which exposed a codegen
|
|
# bug where the apply lambda's parameter list did not match the
|
|
# ApplyFn signature.
|
|
- light.turn_on:
|
|
id: test_regression_light
|
|
brightness: 100%
|
|
effect: "None"
|
|
|
|
http_request:
|
|
useragent: esphome/tagreader
|
|
timeout: 10s
|
|
verify_ssl: ${verify_ssl}
|
|
|
|
output:
|
|
- platform: template
|
|
id: test_regression_output
|
|
type: float
|
|
write_action:
|
|
- logger.log: "set"
|
|
|
|
light:
|
|
- platform: monochromatic
|
|
id: test_regression_light
|
|
output: test_regression_output
|
|
|
|
script:
|
|
- id: does_not_compile
|
|
parameters:
|
|
api_url: string
|
|
then:
|
|
- http_request.get:
|
|
url: "http://google.com"
|