Read XML File from Helios via http

Hello all,

i want to access my Helios ventilation system to read out the humidity (The internal sensor is not readable via Modbus).

I found a possible sollution here:
[Gelöst] Helios KWL - Zugriff auf xml

I was able to get the xml via curl with this code:

curl -X POST  -H "Host:" \
-H "User-Agent: Mozilla/5.0 (X11; Linux X86_64; Rv:104.0) Gecko/20100101 Firefox/104.0" \
-H "Accept: */*" \
-H "Accept-Language: De,En-Us;Q=0.7,En;Q=0.3" \
-H "Accept-Encoding: Gzip, Deflate"\
-H "Content-Type: Text/Plain;Charset=Utf-8" \
-H "Content-Length: 20" \
-H "Origin: Http://" \
-H "Connection: Keep-Alive" \
-H "Referer: Http://" \
-H "Dnt: 1" \
-d 'xml=/data/werte8.xml'


<?xml version="1.0" encoding="UTF-8"?>

Now my problem:
How can i translate the curl-Code to an http.thing in openhab?

I tried with the following, but i stuck in the correct way to declare the Channels for a Http-Post.

Thing http:url:helios "helios" [
    headers="User-Agent= Mozilla/5.0 (X11; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0", "Accept= */*", "Accept-Language= de,en-US;q=0.7,en;q=0.3", "Accept-Encoding= gzip, deflate", "Content-Type= text/plain;charset=UTF-8", "Content-Length= 20", "Origin=", "Connection= keep-alive", "Referer=", "DNT= 1",
    	refresh=15] {

It would be great if somebody can help me with this problem.


I am not that familiar that I can help with http binding.
You also could use execCommandLine, call a shell script that contains the call to curl and set an items value via the REST API.

Hi all,
i made some progress:

Thing http:url:helios "helios" [
      	refresh=15] {
			Type string : HeliosString "%s" [stateContent="xml=/data/werte8.xml" ]

And the item:

String TestHelios {channel="http:url:helios:HeliosString"}

Gave me:

 <?xml version="1.0" encoding="UTF-8"?> <PARAMETER> <LANG>de</LANG> <ID>v01306</ID> <VA>10011000000000000000000010000001</VA> <ID>v00024</ID> <VA>1</VA> <ID>v00033</ID> <VA>0</VA> <ID>v00037</ID> <VA>0</VA> <ID>v00040</ID> <VA>0</VA> <ID>v00092</ID> <VA>4</VA> <ID>v00094</ID> <VA>0</VA> <ID>v00097</ID> <VA>0</VA> <ID>v00099</ID> <VA>0</VA> <ID>v00101</ID> <VA>0</VA> <ID>v00102</ID> <VA>3</VA> <ID>v00103</ID> <VA>83</VA> <ID>v00104</ID> <VA>14.8</VA> <ID>v00105</ID> <VA>19.2</VA> <ID>v00106</ID> <VA>16.1</VA> <ID>v00107</ID> <VA>20.0</VA> <ID>v00108</ID> <VA>-</VA> <ID>v00109</ID> <VA>-</VA> <ID>v00110</ID> <VA>-</VA> <ID>v00111</ID> <VA>-</VA> <ID>v00112</ID> <VA>-</VA> <ID>v00113</ID> <VA>-</VA> <ID>v00114</ID> <VA>-</VA> <ID>v00115</ID> <VA>-</VA> <ID>v00116</ID> <VA>-</VA> <ID>v00117</ID> <VA>-</VA> <ID>v00118</ID> <VA>-</VA> <ID>v00119</ID> <VA>-</VA> <ID>v00120</ID> <VA>-</VA> <ID>v00121</ID> <VA>-</VA> <ID>v00122</ID> <VA>-</VA> <ID>v00123</ID> <VA>-</VA> <ID>v00124</ID> <VA>-</VA> <ID>v00125</ID> <VA>-</VA> <ID>v00126</ID> <VA>-</VA> <ID>v00128</ID> <VA>-</VA> <ID>v00129</ID> <VA>-</VA> <ID>v00130</ID> <VA>-</VA> <ID>v00131</ID> <VA>-</VA> <ID>v00132</ID> <VA>-</VA> <ID>v00133</ID> <VA>-</VA> <ID>v00134</ID> <VA>-</VA> <ID>v00135</ID> <VA>-</VA> <ID>v00136</ID> <VA>-</VA> <ID>v00137</ID> <VA>-</VA> <ID>v00138</ID> <VA>-</VA> <ID>v00139</ID> <VA>-</VA> <ID>v00140</ID> <VA>-</VA> <ID>v00141</ID> <VA>-</VA> <ID>v00142</ID> <VA>-</VA> <ID>v00143</ID> <VA>-</VA> <ID>v00144</ID> <VA>0</VA> <ID>v00146</ID> <VA>-</VA> <ID>v00201</ID> <VA>5</VA> <ID>v00348</ID> <VA>1672</VA> <ID>v00349</ID> <VA>1594</VA> <ID>v00601</ID> <VA>0</VA> <ID>v00602</ID> <VA>1</VA> <ID>v01020</ID> <VA>1</VA> <ID>v01050</ID> <VA>2</VA> <ID>v01051</ID> <VA>2</VA> <ID>v01300</ID> <VA>0</VA> <ID>v01301</ID> <VA>0</VA> <ID>v01302</ID> <VA>0</VA> <ID>v01071</ID> <VA>KWL%20FTF%20AD1</VA> <ID>v01072</ID> <VA>KWL%20FTF%20AD2</VA> <ID>v01073</ID> <VA>KWL%20FTF%20AD3</VA> <ID>v01074</ID> <VA>KWL%20FTF%20AD4</VA> <ID>v01075</ID> <VA>KWL%20FTF%20AD5</VA> <ID>v01076</ID> <VA>KWL%20FTF%20AD6</VA> <ID>v01077</ID> <VA>KWL%20FTF%20AD7</VA> <ID>v01078</ID> <VA>KWL%20FTF%20AD8</VA> <ID>v01081</ID> <VA>KWL%20CO2%20AD1</VA> <ID>v01082</ID> <VA>KWL%20CO2%20AD2</VA> <ID>v01083</ID> <VA>KWL%20CO2%20AD3</VA> <ID>v01084</ID> <VA>KWL%20CO2%20AD4</VA> <ID>v01085</ID> <VA>KWL%20CO2%20AD5</VA> <ID>v01086</ID> <VA>KWL%20CO2%20AD6</VA> <ID>v01087</ID> <VA>KWL%20CO2%20AD7</VA> <ID>v01088</ID> <VA>KWL%20CO2%20AD8</VA> <ID>v01091</ID> <VA>KWL%20VOC%20AD1</VA> <ID>v01092</ID> <VA>KWL%20VOC%20AD2</VA> <ID>v01093</ID> <VA>KWL%20VOC%20AD3</VA> <ID>v01094</ID> <VA>KWL%20VOC%20AD4</VA> <ID>v01095</ID> <VA>KWL%20VOC%20AD5</VA> <ID>v01096</ID> <VA>KWL%20VOC%20AD6</VA> <ID>v01097</ID> <VA>KWL%20VOC%20AD7</VA> <ID>v01098</ID> <VA>KWL%20VOC%20AD8</VA> <ID>v02020</ID> <VA>0</VA> <ID>v02021</ID> <VA>0</VA> <ID>v02022</ID> <VA>0</VA> <ID>v02023</ID> <VA>0</VA> <ID>v02024</ID> <VA>0</VA> <ID>v02025</ID> <VA>0</VA> <ID>v02026</ID> <VA>0</VA> <ID>v02027</ID> <VA>0</VA> <ID>v02117</ID> <VA>0</VA> <ID>v02118</ID> <VA>0</VA> <ID>v02119</ID> <VA>0</VA> <ID>v02136</ID> <VA>64</VA> <ID>v02137</ID> <VA>Int.%2BFF</VA> <ID>v02142</ID> <VA>1</VA> <ID>v02152</ID> <VA>1</VA> </PARAMETER> 

Now I just have to filter the xml to get the value (VA) for the ID: “v02136”…

Ok i want to filter the correct ID Value line with the following Regex :

<ID>v02136<\/ID> <VA>[0-9]*<\/VA>

I think i have to use the Regex-Transformation-Binding. But i don’t have experience with it.
I tried the following:

Thing http:url:helios "helios" [
      	refresh=15] {
			Type string : HeliosString "%s" [stateContent="xml=/data/werte8.xml" stateTransformation="REGEX:(<ID>v02136<\/ID> <VA>[0-9]*<\/VA>)"]

Can somebody give me a tip how to implement this corret?


You can do this with the Regex transform, but that’s the hard way. There’s also a transform that just parses xml trees for you, the XPath transform. Often XPath is much much easier than regex. In this case, your xml is a little odd because I would expect each <VA> element to be a child of the associated <ID> element, but XPath can work with this too, it’s just slightly more involved. If you install the Xpath transform add-on, then you can use an xpath like


as the transform. This looks for the <ID> element that has text containing the given id string (in this case: v02136), then selects and returns the value of the next <VA> element. This should be a little more robust than trying to get a regex in case there are ever strange formatting issues with the <VA> value.

Hi Justin,

i startet with XPATH but when i realized that i need a more complex query here i continued with regex.
I really would test your solution, but i have no idea how to build the correct channel object…

I tried:

Type string : HeliosString  [stateContent="xml=/data/werte8.xml" stateTransformation="XPath(ID[text()[contains(.,'v02136')]]/following-sibling::VA[1])"]

But this is not the correct solution:


I was not able to find some examples for an http-channel and XPath.
Have you an idea where i can find one?

i have a question about your example:


But i think the XML-Node “PARAMETER” is missing here:



It’s been forever since I’ve done file based items, but I believe there are a couple of issues with you stateTransformation declaration. 1) you forgot the :, 2) you don’t need the parentheses, 3) you left out the beginning of the xpath. Try:


Adding Parameter would also work, but // is not a typo. /Parameter/ID means “find the Parameter element that is a child of the document root and then find the ID element that is child of that Parameter element”. //ID means “don’t worry about starting at the root of the document, just find every ID element”.

Hello all,

i have written now a rule, that gives me the humidity from the helios easyControls:

rule "humidity"
        Time cron "0 0/5 * * * ?"
        or System started

    logInfo("helios.rules", "humidity")
    var headers = newHashMap("User-Agent" -> "Mozilla/5.0 (X11; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0", 
    "Accept" -> "*/*",
    "Accept-Language" -> "de,en-US;q=0.7,en;q=0.3",
    "Accept-Encoding" -> "gzip, deflate",
    "Content-Type" -> "text/plain;charset=UTF-8",
    "Content-Length" -> "15",
    "Origin" -> "",
    "Connection" -> "keep-alive",
    "Referer" ->""    )

    logInfo("helios.rules", "login")
    var url = ""
    sendHttpPostRequest(url, "text/xml", "v00402=HELIOSLOGINPASSWORD", headers, 3000)

    logInfo("helios.rules", "get XML")
    var String response = sendHttpPostRequest("", "text/xml", "xml=/data/werte8.xml", 3000)

    var String FilteredHumidiy = transform("XPATH","//ID[text()[contains(.,'v02136')]]/following-sibling::VA[1]",response)   
    logInfo("helios.rules", FilteredHumidiy)
    var Number humidityvalue = Double.parseDouble(FilteredHumidiy)

Special thanks to @JustinG