HTTP Binding with dynamic Authorization

  • Platform information:

    • Hardware: Pi
    • OS: Openhabian
  • Issue of the topic: HTTP Binding


I’m trying to configure the HTTP binding to boost my the hot water. I have the API working correctly with POSTMAN. However, I’m having some difficulty setting it up:

My config:

Switch item_boost_water “Boost Water” {http=">[ON:POST:{Authorization=XXXXXXXX&Accept=application/json}:{ “hours”: “1”, “zoneid”: “1234” }] >[OFF:POST:{Authorization=XXXXXXX&Accept=application/json}:{ “hours”: “0”, “zoneid”: “1234” }]"}

My two issues are:
It doesn’t appear to like the JSON post data, do I need to escape or wrap it in some way. I don’t need to parse it, so I’m presuming I don’t need the JSON transformation.

The Authorization expires after an hour. There is a separate request to refresh it. What is the best practice for doing this, and how do I pass it to the command - I couldn’t see how to do that from the documentation.

Apologies if this has been answered elsewhere and I missed it.

You will need to switch to using Rules and the sendHTTP actions. You can see an example that does something similar in OAuth2 using just OH Rules and

1 Like

Thank you.

I suspect it’s nearly as much work as creating a binding (which is a guess because I haven’t done either).