Http(s) requests are failing

I run esphome on a geekmagic smalltv ultra (esp8266/esp12f). I’m trying to get data from an https resource but have been getting only errors so far. What am I doing wrong, or what I can I do to debug a little deeper?

The json from the url is ~ 600 bytes

Things I checked/tried:

  • DNS works (can see the queries on the dns server)
  • max_response_buffer_size in different sizes did not help
  • calls to other http or https resources also do not work

Code:

# HTTP client component
http_request:
  id: http_client
  useragent: esphome/openhab-display
  timeout: 8s
  verify_ssl: false

# Interval to fetch data from openhab periodically
interval:
  - interval: 20s
    then:
      - http_request.get:
          url: https://server.home/rest/items/item1
          capture_response: true
          #max_response_buffer_size: 2
          request_headers:
            Content-Type: application/json
            Accept: application/json 
          on_response:
            then:
              - if:
                  condition:
                    lambda: return response->status_code == 200;
                  then:
                    - lambda: |-
                        id(openhab).publish_state(body.c_str());
                  else:
                    - logger.log:
                        format: "Error: Response status: %d, message %s"
                        args: [ 'response->status_code', 'body.c_str()' ]
          on_error:
            then:
              lambda: |-
                id(openhab).publish_state("Request failed.");

Logs:

[16:21:38.367][W][http_request.arduino:116]: HTTP Request failed; URL: https://server.home/rest/items/item1; Error: connection failed
[16:21:38.371][D][text_sensor:097]: 'Server': Sending state 'Request failed.'
[16:21:38.371][W][component:490]: interval took a long time for an operation (15299 ms)
[16:21:38.371][W][component:493]: Components should block for at most 30 ms
[16:21:38.371][W][component:490]: mdns took a long time for an operation (15312 ms)
[16:21:38.371][W][component:493]: Components should block for at most 30 ms
[16:21:39.326][E][component:379]: http_request cleared Error flag

Try with HTTP not HTTPS

tried http endpoint, got:

[20:25:11.499][E][component:379]: http_request cleared Error flag
[20:25:30.473][W][http_request.arduino:067]: Using HTTP on Arduino version >= 3.1 is **very** slow. Consider setting framework version to 3.0.2 in your YAML, or use HTTPS
[20:25:30.528][D][http_request.arduino:135]: Received response header, name: content-length, value: 
[20:25:30.534][D][http_request.arduino:135]: Received response header, name: content-type, value: application/json
[20:25:30.534][D][http_request.arduino:141]: Content-Length: -1
[20:25:30.534][D][text_sensor:097]: 'Openhab AS20': Sending state '24'