Hi, I’m new to the whole HA set-up and Im trying to get some XML read and simply displayed, but although I feel Im close, no cigar yet.
The XML is simple enough:
<xml>
<iKettle>
<status>Not Enough Water</status>
<allowboil>N</allowboil>
<temp>73</temp>
<waterlevel>9</waterlevel>
</iKettle>
</xml>
And I’ve followed the example given here RESTful Sensor - Home Assistant for " FETCH MULTIPLE JSON VALUES AND PRESENT THEM AS ATTRIBUTES" And created the following:
sensor:
- platform: rest
name: JSON ikettle2
resource: http://192.168.x.x:88/iKettle/xml.php
value_template: "{{ value_json.xml.iKettle }}"
json_attributes:
- status
- allowboil
- temp
- waterlevel
- platform: template
sensors:
ikettle2_status:
friendly_name: "Kettle Status"
value_template: "{{ state_attr('sensor.json_ikettle2', 'status' }}"
ikettle2_temperature:
friendly_name: "Kettle temperature"
value_template: "{{ state_attr('sensor.json_ikettle2', 'temp') }}"
But I cannot get the Status or temp to appear, and when I look at the JSON iKettle2 sensor it says the following:
{‘status’: ‘Not Enough Water’, ‘allowboil’: ‘N’, ‘temp’: ‘19’, ‘waterlevel’: ‘-34’}
So the data is there, but
Kettle status Unknown
Kettle temperature Unknown
And this is what I cant get my head around. I’ve looked at quite a few posts but they all seem to talk about getting one variable where as I want all of them. - I can get one variable if I do:
sensor:
- platform: rest
name: JSON ikettle2
resource: http://192.168.x.x:88/iKettle/xml.php
value_template: "{{ value_json.xml.iKettle.status }}"
json_attributes:
- status
Any help appreciated or tell me where I’m going wrong.