This advice may help those who want to send sensor values from esphome directly to IoT https server. For example, Home assistant only allows to send one value to thingspeak.com, but from esphome sensor you can send as many fields in one https request as you want.
The problem is that using https usually requires that you define fingeprint of the site and if the fingerprint changes, you have to recompile sensor firmware. That happened to me with telegram bot for example.
Following example shows how to make https get call without verification of ssl certificate. it uses one field value, but if you look at thingspeak documentation you can learn how to send more fields in one get request:
http_request:
useragent: esphome/device
timeout: 10s
sensor:
- platform: bh1750
name: "BH1750 Illuminance"
#address: 0x23
#internal: true
measurement_time: 31
update_interval: 5s
filters:
- lambda: |-
WiFiClientSecure wifiClient;
wifiClient.setInsecure();
HTTPClient http;
http.begin(wifiClient,"https://api.thingspeak.com/update.json?api_key=C.........5&field1="+String(x));
http.GET();
DynamicJsonBuffer doc(2048);
JsonObject& root = doc.parseObject(http.getStream());
return x;