HTTP POST Transformation


Im a noob in HTTP things, so I hope i can get some help :slight_smile:

I have a ESP8622 which controlls 8 relais.

with sendHttpPostRequest(“”) Relay1 is ON and with
sendHttpPostRequest(“”) its OFF.

When I use this as Rule, it worked. Now I will use it in a Thing as Channel script, but how can I do this?

Is there any Tutorial?

I create a HTTP Thing and a Channel, but how do i set the parameters to get it work?

Thank you for your answers :slight_smile:

Show what you’ve done thus far. If you’ve created the Thing and Channel in the UI, click the code tab and post that using code fences instead of screen shots.

code goes here

In general, you’d configure the Thing with a base URL of “” and the command type of POST.

The Switch Channel would be configured with 1 for the “On Value” and 2 for the “Off Value” and /?relais=%2$ for the “command URL extension”. The %2$ is replaced with the transformed command. See HTTP - Bindings | openHAB


thanks for youre reply :slight_smile:)

UID: http:url:a487a2e751
label: Baugruppe 1
thingTypeUID: http:url
  authMode: BASIC
  ignoreSSLErrors: false
  delay: 0
  stateMethod: GET
  refresh: 30
  commandMethod: POST
  timeout: 3000
  bufferSize: 2048
  - id: Relay1
    channelTypeUID: http:switch
    label: Relay1
    description: Relay1
      onValue: "1"
      offValue: "2"
      commandTransformation: /?relais=%2$

And it doesnt Work :frowning:

“Doesn’t work” covers an infinity. Doesn’t work how? Errors in the log? What’s the status of the Thing? Items configuration? Are rules involved? Have you put the binding into debug logging to get more details?


Here are more informations:

  • fresh installed system, http Binding installed
  • only this Thing is created
  • one Item as switch is defined
  • the working rule ist diabled

There are no errors in the Log.

The relay doesnt Switch.

Again, what’s the status of the Thing? Is it ONLINE?

Again, have you put the binding into debug logging to get more details?

How is the Item linked to the HTTP Thing’s Channel?

You cannot provide too much information but with what’s provided :person_shrugging:

It could be anything.

Its online.

I linked it by the Channel.
And I created a Item in the Channel site.

I got a Message:

[form.CascadedValueTransformationImpl] - Transformation ignore, failed to parse /?relais=%2$: The transformation pattern must consist of the type and the pattern separated by a colon

You put the URL extension in the wrong parameter. It needs to go in the “command extension URL” as I said above and is shown in the docs.

This means that when you command the Item that command will go through any transformations configured (none in this case) and then the result of that replaces the %2$ in the command URL extension.

it works :smiley:
thank you :slight_smile:

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.