ETA heating: Problems reading outdoor temperature via REST and displaying it as a sensor in Home Assistant

ETA heating: Problems reading outdoor temperature via REST and displaying it as a sensor in Home Assistant

Hello,

I wanted to display the outdoor temperature in Home Assistant (Docker Version). For this I access the REST API from our ETA heating (Pellets Compact PC-20):

<?xml version="1.0" encoding="UTF-8"?>
<eta version="1.0" xmlns="http://www.eta.co.at/rest/v1">
 <value advTextOffset="0" unit="°C" uri="/user/var/40/10241/0/0/12197" strValue="13,6" scaleFactor="10" decPlaces="1">136</value>
</eta>

Using Free Online XML to JSON Converter - FreeFormatter.com I converted the XML to JSON so I know the structure for Home Assistant:

{
  "@version": "1.0",
  "value": {
    "@advTextOffset": "0",
    "@unit": "°C",
    "@uri": "/user/var/40/10241/0/0/12197",
    "@strValue": "13,6",
    "@scaleFactor": "10",
    "@decPlaces": "1",
    "#text": "136"
  }
}

With https://jsonpathfinder.com/ I searched for the path (x.value["@strValue"])

In the configuration.yaml I created a sensor:

sensor:
	- platform: rest
      name: "Aussentemperatur"
      unique_id: "AussenVerbr"
      resource: http://IP-FROM-ETA:8080/user/var/40/10241/0/0/12197
      value_template: "{{ value_json['@value']['@strValue'] }}"
      unit_of_measurement: "°C"
      device_class: "temperature"
      scan_interval: 300
      method: GET

Unfortunately, the sensor in Home Assistant only says “unknown” for the value.

I have tried different specifications for value_template, but I do not get the value displayed. Does anyone have an idea what I am doing wrong?

Many thanks in advance.

you are using the string “strValue”; i suggest to replace the comma by a decimal point “.”. the value template should look like this:

value_template: ‘{{ value_json[’@value’][‘@strValue’] | replace(‘,’,‘.’) | float }}’

Thanks, but unfortunately it doesn’t work with that either.
Nor if I access the value without a comma:

value_template: "{{ value_json['@value']['#text'] }}"

I solved my problem after reading this: My ETA boiler has an API - can I connect to it? - #3 by tattingstone