Error on restful sensor (platform rest not ready yet)

After upgrading HA to 2021.6.3., my restful sensor does not show any value. In my log file, requesting and receiving to rest sensor seems OK, but it fails to show with following error.

2021-06-14 09:08:55 WARNING (MainThread) [homeassistant.components.sensor] Platform rest not ready yet: Server disconnected while attempting read; Retrying in background in 30 seconds

Anyone know how to solve this problem?

I see this error on restarting Home Assistant now too. Though my rest sensors do eventually update.

Mine’s not updating anymore. :cry:

You see the error once? For me, this error happens repeatedly (on every update attempts).

Yeah just once at start up.

Can you post your restful sensor config?

Sanitise the resource if needed.

Yup. My restful sensor configuration is simple.

  - platform: rest
    resource: http://192.168.1.228/powerMeasure
    name: powermeter
    value_template: '{{ (value_json.powerMeasure/1000 - 0.3) }}'
    unit_of_measurement: kWh
    device_class: power

Next is a result of sample query using curl command to see the status.

$ curl -X GET http://192.168.1.228/powerMeasure
{“powerMeasure”: 1148.07, “id”: “1”, “name”: “powme”, “hardware”: “esp8266”, “connected”: true}

Yeah that looks ok. Not sure why it can’t connect.

When you say this:

What do you mean?

This is part of my log file.

2021-06-14 09:37:06 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.rest
2021-06-14 09:37:06 DEBUG (MainThread) [homeassistant.components.rest.data] Updating from http://192.168.1.228/powerMeasure
2021-06-14 09:37:06 DEBUG (MainThread) [httpx._client] HTTP Request: GET http://192.168.1.228/powerMeasure “HTTP/1.1 200 OK”
2021-06-14 09:37:06 DEBUG (MainThread) [homeassistant.components.sensor] Platform rest not ready yet: Server disconnected while attempting read; Retrying in 180 seconds

If you see 3rd line, GET request receives 200 OK response. But it ended with an error (not ready yet) in the next row.

So HA is able to find the ip address of the resource and connect but then drops the connection.

But when you do it manually with curl, everything is ok.

:man_shrugging:

Yes, when I do it manually with curl, everything is OK.

Same problem here after an upgrade.

There are a few issues open for the restful sensor: Issues · home-assistant/core · GitHub

Nothing exactly like you have reported though.

Might be worthwhile opening a new issue.

I’m facing the same issue with my rest sensor

I wonder if this is the reason (fix will be in 2021.6.5):

1 Like

Same here with rest sensor not working to read out my HomeWizard, after update no temperature and read out of the switches.

  • platform: rest
    resource: !secret homewizard_sensor
    name: homewizard
    value_template: “{{ value_json.status }}”
    json_attributes:
    • response

hello, same probleme here :frowning:
i can’t make it works again.

sensor:
  - platform: rest
    resource: !secret legrand_source_instantanes
    name: legrand_source_instantanes
    scan_interval: 5
    json_attributes:
      - data1
      - data2
      - data3
      - data4
      - data5

i have tried to disable almost everything. Can’t make it work back.
The only relevent log is this one :

2021-06-14 11:14:15 WARNING (MainThread) [homeassistant.components.sensor] Platform rest not ready yet: Server disconnected while attempting read; Retrying in background in 30 seconds

Same issue here after updating to core-2021.6.4 , when rolling back to core-2021.6.3 everything is ok.

rolling back to core-2021.6.3 (binary and confioguration) also fixed the issue here. rolling back just binary isn’t enough.

Have any of you opened an issue?

https://github.com/home-assistant/core/issues/51781

2 Likes

Thanks!

I temporarily solved the problem via manually downgrading httpcore to version 0.13.3.

pip3 install httpcore==0.13.3

1 Like