ESPhome: How to store result returned by http_request.get

Hello, trying to retrieve weather forecast with following code, but I could not find in the documentation where is the text stored that web server returns:

http_request:
  useragent: esphome/device
  timeout: 10s

time:
  - platform: sntp
    # ...
    on_time:
      # Every x minutes
      - seconds: 0
        minutes: /2
        then:
          - http_request.get:
              url: https://api.openweathermap.org/data/2.5/onecall?lat=51&lon=14&appid=974---------------c0d&lang=cz&exclude=minutely,daily,alerts
              verify_ssl: false

Check this post:

@janbenes That linked post is what I was going to try in response to your other post when I had some time.

The only documented way I can see to parse JSON in ESPHome is via MQTT. If you have a broker on your network, you could publish the HTTP response and subscribe to it…

Thanks, but that seems a bit complicated. I can also get XML but that is even less documented. What I will try is to read web server response in lambda and use arduino library to unserialize. I never tried to include external library, so it will be lot of fun… :-/

See my response here:

2 Likes