janpa
August 22, 2022, 2:53pm
1
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
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
Jajjaman
(Jajjaman)
May 6, 2024, 8:36am
4
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'] }}"
ozav
(Ondrej Zavodny)
September 25, 2024, 10:43am
5
Hi,
i tried your code, but Iām getting this errors in log:
Template variable error: 'value_json' is undefined when rendering '{{ value_json.root.sns[0]['@_val'] }}'
Template variable error: 'value_json' is undefined when rendering '{{ value_json.root.sns[1]['@_val'] }}'
Template variable error: 'value_json' is undefined when rendering '{{ value_json.root.sns[2]['@_val'] }}'
Any ideas please?