core: Sensor.Rest not able to start after 2022.11.1
The problem
I have a rest sensor that was working before 2022.11.1, and now it isn’t able to start anymore. Error returned is: homeassistant.exceptions.HomeAssistantError: Resource not set for RestData
I tried moving the rest sensor from the “sensor” list to the “rest” section, but I have different problem there. Probably a regression caused by the latest update.
What version of Home Assistant Core has the issue?
core-2022.11.1
What was the last working version of Home Assistant Core?
core-2022.10.5
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Rest
Link to integration documentation on our website
https://www.home-assistant.io/integrations/sensor.rest/
Diagnostics information
No response
Example YAML snippet
- platform: rest
resource_template: 'http://192.168.1.70/v1/feeds/ser4:141369-3N40-2417/'
name: Rest ABB
headers:
Authorization: >
X-Digest username=...
json_attributes_path: "$.feeds.ser4:141369-3N40-2417.datastreams"
json_attributes:
- "m64061_1_DayWH"
- "m101_1_WH"
- "m101_1_W"
- "m101_1_PowerPeakToday"
value_template: "OK"
scan_interval: 1800
Anything in the logs that might be useful for us?
No response
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 17 (12 by maintainers)
I think this line is the culprit when the corresponding file is empty:
I have no rest entities (in binary_sensors or sensors or rest). With the above line in the config, I get the error. If I comment it out and restart, the error does not reappear. If I put it back in and restart, the error is back.
I think other people that are moving rest sensors from “sensors.yaml” to “rest.yaml” are ‘incidentally’ fixing the problem by making the file non-empty, whereas before it was empty and causing the error.
I was able to reproduce the issue, by simply setting an empty config:
During the validation of the schema, this gets loaded as an empty dict
{}
, which gets converted by voluptuous into a list with a minimalist schema:As far as I can tell, in 2022.10.5 the component loads and then logs errors:
In 2022.11, the error is slightly earlier, preventing the setup from completing: