Parsing http request json ESPHome

Tags: #<Tag:0x00007fc3f12ae218> #<Tag:0x00007fc3f12ae128>

4 days of my life were not in vain. I found a solution to the problem, automation between nodes. I have put together a lot of instructions on how to parse json http reequest.
Unfortunately, I did not find any sensible instructions on the site, so I had to study and use the arduino libraries. As I understand it, the current version of esphome uses the ArduinoJson v5 library, so I got the following code

  - platform: template
    name: Template sensor
    id: temp_sensor

# some trigger here
        - lambda: |-
            WiFiClient client;
            HTTPClient http;
            // http.useHTTP10(true);  // Remember to call useHTTP10(true) when you use getStream()
            http.begin(client, "http://ip_of_node/sensor/name_of_sensor");  // details
            int httpCode = http.GET();
            if (httpCode > 0) {
              if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {
              // String payload = http.getString();  // some debug info
              // Serial.println(payload);
              DynamicJsonBuffer doc(200);
              JsonObject& root = doc.parseObject(http.getString());
              float bt = root["value"];
              Serial.println(bt); // some debug info