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
type: RGB24
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
time:
- platform: sntp
id: sntp_time
on_time:
- at: "13:37:42"
then: