online_image: add tests for http_request_headers

This commit is contained in:
Kjell Braden 2024-11-14 10:59:59 +01:00
parent e89f7fe385
commit 01c1894849

View File

@ -24,10 +24,26 @@ online_image:
format: PNG format: PNG
type: RGB24 type: RGB24
use_transparency: true use_transparency: true
- id: online_image_headers
url: http://www.libpng.org/pub/png/img_png/pnglogo-blk-tiny.png
format: PNG
type: RGBA
http_request_headers:
If-Modified-Since: !lambda |-
char age_buf[64];
auto now = id(sntp_time)->timestamp_now();
auto time = ESPTime::from_epoch_utc(now - 10 * 60);
auto age_len = time.strftime(age_buf, sizeof(age_buf), "%a, %d %b %Y %H:%M:%S %z");
if (age_len != 0) {
return age_buf;
} else {
return {};
}
# Check the set_url action # Check the set_url action
time: time:
- platform: sntp - platform: sntp
id: sntp_time
on_time: on_time:
- at: "13:37:42" - at: "13:37:42"
then: then: