Problems sending http-put directly from thing to REST-Api device (ETA heating/boiler)

Hi there, i’ve got some problem getting a value of my pellet boiler as a switch-channel (read and write).

This is the code of my thing:

UID: http:url:ETA_PC25
label: ETA PC 25
thingTypeUID: http:url
configuration:
  authMode: BASIC
  ignoreSSLErrors: false
  baseURL: http://192.168.178.148:8080/user/var/
  delay: 0
  stateMethod: GET
  refresh: 20
  commandMethod: PUT
  contentType: text/xml
  timeout: 1000
  bufferSize: 2048
location: Heizraum Keller
channels:
  - id: ETA_HeizKreisOnOff
    channelTypeUID: http:switch
    label: ETA Heizkreis
    description: null
    configuration:
      onValue: "1803"
      offValue: "1802"
      stateExtension: 120/10101/0/0/12080
      commandExtension: 120/10101/0/0/12080
      stateTransformation: XSLT:eta_numeric.xsl

this is what API says/wants:

4.2 HTTP POST
Using HTTP POST you can set a variable to a certain value. Note, that you have to
provide the the variable’s raw value (without scaling)! If a variable with time interval
datatype should be set, value, begin and end parameters must be provided. The begin
and end time are integral multiples of 15 minutes since midnight. This implies a valid
range of [0, 96] for begin and end.
Note: The feature of setting the time slots requires an API version of 1.1 or
higher (available since system software version 1.25.0/2.25.0 or higher).

Attribute Description
uri This is the requested URI.
strValue The variable’s value as formatted string.
unit The variable’s unit as string.
decPlaces The number of decimal places.
scaleFactor The scale factor for processing the raw value.
advTextOffset The offset of text variables. If you read a text variable (e.g.
the ash removal key) you can subtract this value from the
variable’s raw value in order to get a value from [0, max] for
e.g. boolean evaluations.
Table 1: Description of XML attributes of element <value>.

Example 1 Set the deash key to On.
i
HTTP Request
POST /user/var/112/10021/0/0/12112 HTTP/1.1
Content-Type: application/x-www-form-urlencoded
value=1803
HTTP Response
HTTP/1.1 200 OK
Content-Encoding: utf-8
Content-Type: application/xml
<?xml version="1.0" encoding="utf-8"?>
<eta version="1.0" xmlns="http://www.eta.co.at/rest/v1">
<success uri="/user/var/112/10021/0/0/12112"/>
</eta>
Example 2 Set monday’s time slot 1 of the hot water tank’s charging times to 00:00-
12:00, 40 degrees: i
HTTP Request
POST /user/var/112/10111/12130/0/1082 HTTP/1.1
Content-Type: application/x-www-form-urlencoded
value=400&begin=0&end=48
HTTP Response
HTTP/1.1 200 OK
Content-Encoding: utf-8
Resource Description
/user/vars Get a list of all defined variable sets.
/user/vars/{Varset} Read all variables from the specified variable set
Varset.
Table 2: Description of resources under /user/vars.
Content-Type: application/xml
<?xml version="1.0" encoding="utf-8"?>
<eta version="1.0" xmlns="http://www.eta.co.at/rest/v1">
<success uri="/user/var/112/10111/12130/0/1082"/>
</eta>

And this is what OH-log says:

2022-07-25 16:20:32.285 [TRACE] [nding.http.internal.HttpThingHandler] - Sending to 'http://192.168.178.148:8080/user/var/120/10101/0/0/12080': Method = {PUT}, Headers = {Accept-Encoding: gzip, User-Agent: Jetty/9.4.43.v20210629, Content-Type: text/xml}, Content = {1803}
2022-07-25 16:20:32.288 [TRACE] [p.internal.http.HttpResponseListener] - Received from 'http://192.168.178.148:8080/user/var/120/10101/0/0/12080': Code = {400}, Headers = {Date: Mon, 25 Jul 2022 16:21:28 GMT, Connection: keep-alive, Content-Length: 0}, Content = {null}
2022-07-25 16:20:32.288 [WARN ] [p.internal.http.HttpResponseListener] - Requesting 'http://192.168.178.148:8080/user/var/120/10101/0/0/12080' (method='PUT', content='org.eclipse.jetty.client.util.StringContentProvider@13f8c50') failed: 400 Bad Request

I’m really out of ideas where to go from here. Would be happy for some advice.

regards
Jens

your binding configuration shows

commandMethod: PUT

while the vendors API requires “POST”

Hi and thank you, found that 2 mins ago. …/user/vars is put, but …/user/var is POST.
So it works basically, have to adjust some commandtransformation. I’ll post a working snippet here later.

Here the working code for sending values to an ETA heating/boiler:

Switching on/off heating circle

Thing:

 UID: http:url:ETA_PC25
label: ETA PC 25
thingTypeUID: http:url
configuration:
  authMode: BASIC
  ignoreSSLErrors: false
  baseURL: http://192.168.178.148:8080/user/var/
  delay: 0
  stateMethod: GET
  refresh: 10
  commandMethod: POST
  contentType: text/xml
  timeout: 1000
  bufferSize: 2048
 
 
  - id: ETA_HeizKreisOnOff
    channelTypeUID: http:switch
    label: ETA Heizkreis
    description: null
    configuration:
      onValue: "1803"
      commandTransformation: JS:EtaSendValue.js
      offValue: "1802"
      stateExtension: 120/10101/0/0/12080
      commandExtension: 120/10101/0/0/12080
      stateTransformation: XSLT:eta_numeric.xsl[/code]
Transformation-File:
[code](function(i) {
    var tempStr = 'value='+i ;
    return tempStr;
})(input)