Force the RESTFul sensor component to use XML mode

The RESTFul sensor component (RESTful Sensor - Home Assistant) has a feature to parse XML data when the proper Content-Type header has been set on the response HTTP headers (text/xml, application/xml or application/xhtml+xml). However, some IOT devices don’t have the best webserver software and the header is either wrong or they omit the Content-Type header all together. In my case I’m talking to a closed-box system controlling a fireplace but it doesn’t set the Content-Type header at all.

The current implementation doesn’t like this and tries to parse it as JSON. This fails, obviously. When I pipe the request through a nginx man-in-the-middle reverse proxy and force the header to be present, the RESTFul sensor component parses the XML correctly and I can use it. However running a reverse proxy just to add one little header is kind of dumb.

Can we add a parameter to the RESTful components to force XML parsing and not rely on Content-Type headers? The default would still be JSON but optionally it would be parsed as XML. That would be great and would save people having to inject it themselves using proxies etc.

Don’t forget to vote for your own request. :slight_smile:

1 Like