Integrating XML temp sensor

Hello, i have problem with integrating with my Papouch TH2E in to Home Assistant. Temp sensor is giving me output in XML form and i still not going in to my dash :frowning:

XML from device:

<root xmlns="http://www.papouch.com/xml/th2e/act">
<sns id="1" type="1" status="0" unit="0" val="19.6" w-min="" w-max="" e-min-val=" 19.56" e-max-val=" 40.63" e-min-dte="08/22/2022 16:22:38" e-max-dte="04/22/2018 21:05:14"/>
<sns id="2" type="2" status="0" unit="3" val="56.8" w-min="" w-max="" e-min-val=" 4.05" e-max-val=" 75.53" e-min-dte="05/27/2007 56:36:00" e-max-dte="01/01/2009 12:54:50"/>
<sns id="3" type="3" status="0" unit="0" val="10.8" w-min="" w-max="" e-min-val=" -17.82" e-max-val=" 21.35" e-min-dte="02/06/2012 56:24:13" e-max-dte="01/01/2009 12:54:50"/>
<status location="Honza-Kobylisy" time="08/22/2022 16:35:36"/>
</root>

I tried to convert it in to JSON and use REST to pull data from it:

sensor:

  • platform: rest
    method: POST
    resource: http://172.20.11.251/fresh.xml
    name: Teplota
    value_template: ā€œ{{ value_json.x.root.sns[0].val }}ā€
    unit_of_measurement: ā€œĀ°Cā€

Thank you!

1 Like

any solution ?

This works for me:

rest:
  - resource: http://192.168.1.201/fresh.xml
    scan_interval: 900
    sensor:
      - name: Papouch ute temp
        unit_of_measurement: "Ā°C"
        json_attributes_path: $.root.sns[0]
        json_attributes:
          - val
        value_template: "{{ value_json.root.sns[0]['@val'] }}"
      - name: Papouch ute fukt
        unit_of_measurement: " %"
        json_attributes_path: $.root.sns[1]
        json_attributes:
          - val
        value_template: "{{ value_json.root.sns[1]['@val'] }}"
      - name: Papouch ute daggpunkt
        unit_of_measurement: "Ā°C"
        json_attributes_path: $.root.sns[2]
        json_attributes:
          - val
        value_template: "{{ value_json.root.sns[2]['@val'] }}"