Hi,
I’m attempting to add a sensor that gets its value from a get request.
The returned information is in XML, which shouldn’t be an issue as according to the docs it should be converted to JSON. But, the content-type header is being set incorrectly, to “application/javascript” rather than xml.
How can I force the conversion to JSON? Or is there perhaps a different route I can take to get the sensor value?
For reference, this is the returned body:
<?xml version="1.0" encoding="utf-8"?>
<SpeakerPreset>1</SpeakerPreset>
with this being my config:
- platform: rest
resource: https://10.0.10.146:10443/ajax/speakers/get_config?type=11
verify_ssl: false
name: Speaker Preset
value_template: "{{ value_json.SpeakerPreset }}"
With this config, I get the error: Template variable error: ‘value_json’ is undefined when rendering ‘{{ value_json.SpeakerPreset }}’
That doesn’t make the most sense to me.